--- openapi: 3.0.1 info: title: API V1 version: v1 description: API V1 documentation tags: - name: Auth description: Operations about authentication - name: User description: Operations about users - name: Task description: Operations about tasks - name: UserTask description: Operations about user-specific tasks components: schemas: User: type: object properties: id: type: string full_name: type: string email: type: string role: type: string enum: - admin - user - guest UserTask: description: User-specific task schema type: object properties: id: type: string full_name: type: string email: type: string role: type: string enum: - admin - user - guest tasks: type: array items: $ref: "#/components/schemas/Task" Task: type: object properties: id: type: string title: type: string description: type: string status: type: string enum: - pending - completed - expired - archived due_date: type: string format: date-time CreateTask: type: object properties: task: $ref: "#/components/schemas/Task" Error: type: object properties: error: type: string errors: type: array items: type: string securitySchemes: bearer_auth: type: http scheme: bearer responses: NotFound: description: Resource not found content: application/json: schema: $ref: "#/components/schemas/Error" UnprocessableEntity: description: Validation errors content: application/json: schema: $ref: "#/components/schemas/Error" paths: "/api/auth/register": post: tags: - Auth summary: register user requestBody: required: true content: application/json: schema: type: object properties: user: type: object properties: full_name: type: string email: type: string password: type: string role: type: string enum: - admin - user - guest responses: "201": description: successful registration content: application/json: schema: $ref: "#/components/schemas/User" "422": description: Unprocessable Entity content: application/json: schema: $ref: "#/components/responses/UnprocessableEntity" "/api/auth/login": post: tags: - Auth summary: login user requestBody: required: true content: application/json: schema: type: object properties: email: type: string password: type: string responses: "200": description: successful content: application/json: schema: type: object properties: token: type: string "422": description: Unprocessable Entity content: application/json: schema: $ref: "#/components/responses/UnprocessableEntity" "/api/auth/logout": post: tags: - Auth summary: logout user security: - bearer_auth: [] responses: "204": description: successful logout "401": description: Unauthorized content: application/json: schema: $ref: "#/components/responses/NotFound" "/api/users/{user_id}/tasks": parameters: - name: user_id in: path description: User ID required: true schema: type: string get: security: - bearer_auth: [] tags: - Task summary: list tasks responses: "200": description: successful content: application/json: schema: type: array items: $ref: "#/components/schemas/Task" post: security: - bearer_auth: [] tags: - Task summary: create task requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateTask" responses: "201": description: created content: application/json: schema: $ref: "#/components/schemas/Task" "422": description: Unprocessable Entity content: application/json: schema: $ref: "#/components/responses/UnprocessableEntity" "/api/tasks/{id}": parameters: - name: id in: path description: id required: true schema: type: string get: security: - bearer_auth: [] tags: - Task summary: show task responses: "200": description: successful content: application/json: schema: $ref: "#/components/schemas/Task" "404": description: Not Found content: application/json: schema: $ref: "#/components/responses/NotFound" patch: security: - bearer_auth: [] tags: - Task summary: update task requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/Task" responses: "200": description: successful content: application/json: schema: $ref: "#/components/schemas/Task" "404": description: Not Found content: application/json: schema: $ref: "#/components/responses/NotFound" "422": description: Unprocessable Entity content: application/json: schema: $ref: "#/components/responses/UnprocessableEntity" put: security: - bearer_auth: [] tags: - Task summary: update task requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/Task" responses: "200": description: successful content: application/json: schema: $ref: "#/components/schemas/Task" "404": description: Not Found content: application/json: schema: $ref: "#/components/responses/NotFound" "422": description: Unprocessable Entity content: application/json: schema: $ref: "#/components/responses/UnprocessableEntity" delete: security: - bearer_auth: [] tags: - Task summary: delete task responses: "204": description: Task delete successfully "404": description: Not Found content: application/json: schema: $ref: "#/components/responses/NotFound" "422": description: Unprocessable Entity content: application/json: schema: $ref: "#/components/responses/UnprocessableEntity" "/api/users": get: security: - bearer_auth: [] tags: - User summary: list users responses: "200": description: successful content: application/json: schema: type: array items: $ref: "#/components/schemas/UserTask" "/api/users/{id}": parameters: - name: id in: path description: id required: true schema: type: string get: security: - bearer_auth: [] tags: - User summary: show user responses: "200": description: successful content: application/json: schema: $ref: "#/components/schemas/UserTask" "404": description: Not Found content: application/json: schema: $ref: "#/components/responses/NotFound" servers: - url: http://{defaultHost} description: Development server variables: defaultHost: default: localhost:3000 description: Development host