Files
2026-02-10 22:11:06 -05:00

126 lines
3.1 KiB
YAML

openapi: 3.0.3
info:
title: Assignment API
version: 1.0.0
servers:
- url: https://your-domain.com/api/v1
tags: [ { name: Assignments } ]
security: [ { bearerAuth: [] } ]
paths:
/assignments:
get:
tags: [Assignments]
summary: List all assignments
parameters:
- in: query
name: page
schema: { type: integer, default: 1 }
- in: query
name: per_page
schema: { type: integer, default: 20 }
- in: query
name: class_id
schema: { type: integer }
- in: query
name: teacher_id
schema: { type: integer }
- in: query
name: student_id
schema: { type: integer }
responses:
"200":
description: Successful response
post:
tags: [Assignments]
summary: Create a new assignment
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AssignmentCreate'
responses:
"201":
description: Assignment created successfully
/assignments/{id}:
get:
tags: [Assignments]
summary: Get an assignment by ID
parameters:
- in: path
name: id
required: true
schema: { type: integer }
responses:
"200":
description: Assignment found
"404":
description: Assignment not found
put:
tags: [Assignments]
summary: Update an assignment
parameters:
- in: path
name: id
required: true
schema: { type: integer }
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AssignmentUpdate'
responses:
"200":
description: Assignment updated successfully
"404":
description: Assignment not found
delete:
tags: [Assignments]
summary: Delete an assignment
parameters:
- in: path
name: id
required: true
schema: { type: integer }
responses:
"200":
description: Assignment deleted successfully
"404":
description: Assignment not found
/assignments/student/{id}:
get:
tags: [Assignments]
summary: Get assignments for a specific student
parameters:
- in: path
name: id
required: true
schema: { type: integer }
responses:
"200":
description: List of student assignments
components:
schemas:
AssignmentCreate:
type: object
required: [title, due_date, class_id, teacher_id]
properties:
title: { type: string }
description: { type: string }
due_date: { type: string, format: date }
class_id: { type: integer }
teacher_id: { type: integer }
AssignmentUpdate:
type: object
properties:
title: { type: string }
description: { type: string }
due_date: { type: string, format: date }
class_id: { type: integer }
teacher_id: { type: integer }