diff --git a/public/openapi.yml b/public/openapi.yml index 5eb790d..d786c70 100644 --- a/public/openapi.yml +++ b/public/openapi.yml @@ -18,19 +18,16 @@ paths: schema: type: object properties: - user: - type: object - properties: - last_name: - type: string - name: - type: string - middle_name: - type: string - email: - type: string - phone: - type: string + last_name: + type: string + name: + type: string + middle_name: + type: string + email: + type: string + phone: + type: string password: type: string example: 'strong_password123' @@ -56,6 +53,12 @@ paths: schema: type: string example: 'bad_password' + 422: + description: Validation error + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' /api/users/login: post: tags: @@ -86,10 +89,13 @@ paths: | key | val | | --- | --- | - | `bad_email` | email is not a valid email | | `bad_password` | authentication unsuccessful; this means that there is either no user with this email, or password doesn't match | - - This error also might be sent by laravel if your body is corrupted + 422: + description: Validation error + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' /api/users/reset: post: tags: @@ -112,6 +118,12 @@ paths: 200: description: |- The password is reset + 422: + description: Validation error + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' /api/users/private/list: get: @@ -147,8 +159,12 @@ paths: application/json: schema: $ref: '#/components/schemas/User' - 400: - description: Invalid ID + 422: + description: Validation error + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' 404: description: User not found /api/users/private/edit/{id}: @@ -166,6 +182,12 @@ paths: responses: 200: description: OK + 422: + description: Validation error + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' requestBody: description: |- All fields of `user` are required. The whole record will be updated with exactly what you provide here. It is assumed that you already have all information about the user beforehand @@ -209,6 +231,12 @@ paths: items: type: string example: 'userid' + 422: + description: Validation error + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' delete: summary: Remove user(s) from trash tags: @@ -237,6 +265,12 @@ paths: items: type: string example: 'userid' + 422: + description: Validation error + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' /api/users/private/trash/clean: delete: summary: Delete user(s) for good from trash @@ -262,6 +296,12 @@ paths: type: array items: type: string + 422: + description: Validation error + content: + application/json: + schema: + $ref: '#/components/schemas/ValidationError' /api/users/private/trash/list: get: summary: List users in trash @@ -319,6 +359,14 @@ components: password: type: string example: 'argon2-hash-here' + ValidationError: + type: object + properties: + field_name: + type: array + items: + type: string + example: 'This field is invalid!' securitySchemes: session: type: http