| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- post:
- summary: Create a new user
- operationId: createUser
- tags:
- - Users
- requestBody:
- required: true
- content:
- application/json:
- schema:
- type: object
- required:
- - name
- - email
- - password
- - confirm_password
- properties:
- name:
- type: string
- example: Lee
- email:
- type: string
- format: email
- example: lee@example.com
- password:
- type: string
- minLength: 12
- example: supersecret123
- confirm_password:
- type: string
- minLength: 12
- example: supersecret123
- responses:
- '201':
- description: User created successfully.
- content:
- application/json:
- schema:
- $ref: '../components/schemas/SuccessResponse.yaml'
- '400':
- description: Validation error (invalid email, passwords do not match, or password too short).
- content:
- application/json:
- schema:
- $ref: '../components/schemas/ErrorResponse.yaml'
- examples:
- invalidEmail:
- summary: Invalid email address
- value:
- error: Invalid email address
- passwordMismatch:
- summary: Passwords do not match
- value:
- error: Passwords do not match
- passwordTooShort:
- summary: Password too short
- value:
- error: Password must be at least 12 characters
- '409':
- description: Email already in use.
- content:
- application/json:
- schema:
- $ref: '../components/schemas/ErrorResponse.yaml'
- example:
- error: Email already in use
- '500':
- description: Internal server error.
- content:
- application/json:
- schema:
- $ref: '../components/schemas/ErrorResponse.yaml'
- get:
- summary: Get the current user
- operationId: getUser
- tags:
- - Users
- security:
- - cookieAuth: []
- responses:
- '200':
- description: Current user data.
- content:
- application/json:
- schema:
- type: object
- required:
- - id
- - name
- - email
- properties:
- id:
- type: string
- format: uuid
- example: 0191a23b-dead-7000-beef-000000000001
- name:
- type: string
- example: Lee
- email:
- type: string
- format: email
- example: lee@example.com
- '401':
- description: Missing or invalid auth token.
- content:
- application/json:
- schema:
- $ref: '../components/schemas/ErrorResponse.yaml'
- examples:
- missing:
- summary: No cookie present
- value:
- error: Missing auth token
- invalid:
- summary: Token invalid or expired
- value:
- error: Invalid auth token
|