|
|
@@ -0,0 +1,118 @@
|
|
|
+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
|