Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add documentation for get user by id endpoint #48

Merged
merged 2 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions openapi/features/user/components/find-user-by-id-body.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
required: true
content:
application/json:
schema:
type: object
properties:
id:
type: string
example: '1'
name:
type: string
example: 'John Doe'
username:
type: string
example: 'johndoe123'
email:
type: string
example: 'johndoe@example.com'
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- in: path
name: id
required: true
schema:
type: string
description: The user ID.s
19 changes: 19 additions & 0 deletions openapi/features/user/find-user-by-id-path.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
get:
operationId: findUserById
summary: Find a user by id
description: This endpoint allows you to find a user by id.
tags:
- user

parameters:
- $ref: './components/find-user-by-id-parameters.yaml'

responses:
'200':
$ref: './components/find-user-by-id-body.yaml'
'400':
$ref: '../../shared/errors/validation-error.yaml'
'404':
$ref: '../../shared/errors/user-not-found-error.yaml'
'500':
$ref: '../../shared/errors/server-error.yaml'
2 changes: 2 additions & 0 deletions openapi/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ paths:
$ref: './features/user/user-create-path.yaml'
/auth/login:
$ref: './features/auth/login-path.yaml'
/api/users/{id}:
$ref: './features/user/find-user-by-id-path.yaml'
22 changes: 22 additions & 0 deletions openapi/shared/errors/user-not-found-error.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
description: User not found
content:
application/json:
schema:
type: object
properties:
code:
type: number
example: 404
message:
type: string
example: User not found
details:
type: string
example: The user with the provided ID does not exist in our records
errors:
type: array
items:
type: string
example:
- 'User ID is invalid'
- 'User does not exist'
Loading