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

[GH-166] doc(Author): update openApi spec #171

Merged
merged 1 commit into from
Jun 6, 2024
Merged
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
343 changes: 342 additions & 1 deletion src/apps/apiApp/openApi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ servers:

tags:
- name: Auth
- name: Authors
- name: Books
- name: Health

Expand Down Expand Up @@ -196,6 +197,282 @@ paths:
example:
message: 'Invalid token'

/api/v1/Authors:
get:
tags:
- Authors
summary: Get all authors
operationId: GetAllAuthors
security:
- bearerAuth: []
parameters:
- name: include
description: Include relateds
in: query
required: false
schema:
type: string
- name: fields
description: Return only specific fields
in: query
schema:
type: string
required: false
responses:
'200':
description: Successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Author'

post:
deprecated: false
tags:
- Authors
summary: Create Author
operationId: CreateAuthor
security:
- bearerAuth: []
parameters: []
requestBody:
description: ''
content:
application/json:
example:
id: '{{$guid}}'
name: '{{$randomWords}}'
required: true

responses:
'201':
description: Created
headers:
vary:
$ref: '#/components/headers/vary'
access-control-allow-credentials:
$ref: '#/components/headers/access-control-allow-credentials'
x-xss-protection:
$ref: '#/components/headers/x-xss-protection'
x-content-type-options:
$ref: '#/components/headers/x-content-type-options'
x-frame-options:
$ref: '#/components/headers/x-frame-options'
date:
$ref: '#/components/headers/date'
content-length:
$ref: '#/components/headers/content-length'
x-envoy-upstream-service-time:
$ref: '#/components/headers/x-envoy-upstream-service-time'
server:
$ref: '#/components/headers/server'
content: {}

'400':
description: Bad Request
headers:
vary:
$ref: '#/components/headers/vary'
access-control-allow-credentials:
$ref: '#/components/headers/access-control-allow-credentials'
x-xss-protection:
$ref: '#/components/headers/x-xss-protection'
x-content-type-options:
$ref: '#/components/headers/x-content-type-options'
x-frame-options:
$ref: '#/components/headers/x-frame-options'
date:
$ref: '#/components/headers/date'
connection:
$ref: '#/components/headers/connection'
keep-alive:
$ref: '#/components/headers/keep-alive'
content-length:
$ref: '#/components/headers/content-length'
content:
application/json:
schema:
$ref: '#/components/schemas/400'
example:
errors:
- id: 'Invalid value at params. Value: USB'
- name: 'Invalid value at body. Value: undefined'

/api/v1/Authors/{id}:
get:
tags:
- Authors
summary: Get Author by id
operationId: GetAuthorById
security:
- bearerAuth: []
parameters:
- name: id
in: path
description: required
required: true
style: simple
schema:
type: string
example: '{{authorId}}'
- name: include
description: Include relateds
in: query
required: false
schema:
type: string
- name: fields
description: Return only specific fields
in: query
schema:
type: string
required: false
responses:
'200':
description: Successful operation
headers:
vary:
$ref: '#/components/headers/vary'
access-control-allow-credentials:
$ref: '#/components/headers/access-control-allow-credentials'
x-xss-protection:
$ref: '#/components/headers/x-xss-protection'
x-content-type-options:
$ref: '#/components/headers/x-content-type-options'
x-frame-options:
$ref: '#/components/headers/x-frame-options'
date:
$ref: '#/components/headers/date'
content-length:
$ref: '#/components/headers/content-length'
etag:
$ref: '#/components/headers/etag'
x-envoy-upstream-service-time:
$ref: '#/components/headers/x-envoy-upstream-service-time'
server:
$ref: '#/components/headers/server'
content:
application/json:
schema:
$ref: '#/components/schemas/Author'
patch:
deprecated: false
tags:
- Authors
summary: Update Author by Id
operationId: UpdateAuthor
security:
- bearerAuth: []
parameters:
- name: id
in: path
description: required
required: true
style: simple
schema:
type: string
example: '{{$guid}}'
requestBody:
description: ''
content:
application/json:
example:
name: "Sempere"
required: true
responses:
'200':
description: Updated
headers:
vary:
$ref: '#/components/headers/vary'
access-control-allow-credentials:
$ref: '#/components/headers/access-control-allow-credentials'
x-xss-protection:
$ref: '#/components/headers/x-xss-protection'
x-content-type-options:
$ref: '#/components/headers/x-content-type-options'
x-frame-options:
$ref: '#/components/headers/x-frame-options'
date:
$ref: '#/components/headers/date'
connection:
$ref: '#/components/headers/connection'
keep-alive:
$ref: '#/components/headers/keep-alive'
content-length:
content:
text/plain:
schema:
type: string
example: '0'
content: {}
'400':
description: Bad Request
headers:
vary:
$ref: '#/components/headers/vary'
access-control-allow-credentials:
$ref: '#/components/headers/access-control-allow-credentials'
x-xss-protection:
$ref: '#/components/headers/x-xss-protection'
x-content-type-options:
$ref: '#/components/headers/x-content-type-options'
x-frame-options:
$ref: '#/components/headers/x-frame-options'
date:
$ref: '#/components/headers/date'
connection:
$ref: '#/components/headers/connection'
keep-alive:
$ref: '#/components/headers/keep-alive'
content:
application/json:
schema:
$ref: '#/components/schemas/400'
example:
errors:
- message: 'Empty body is not allowed'
delete:
deprecated: false
tags:
- Authors
summary: Delete Author by Id
operationId: DeleteAuthorById
security:
- bearerAuth: []
parameters:
- name: id
in: path
description: required
required: true
style: simple
schema:
type: string
example: '{{authorId}}'
responses:
'204':
description: Deleted
headers:
vary:
$ref: '#/components/headers/vary'
access-control-allow-credentials:
$ref: '#/components/headers/access-control-allow-credentials'
x-xss-protection:
$ref: '#/components/headers/x-xss-protection'
x-content-type-options:
$ref: '#/components/headers/x-content-type-options'
x-frame-options:
$ref: '#/components/headers/x-frame-options'
date:
$ref: '#/components/headers/date'
connection:
$ref: '#/components/headers/connection'
keep-alive:
$ref: '#/components/headers/keep-alive'
content: {}

/api/v1/Books:
get:
tags:
Expand All @@ -204,6 +481,19 @@ paths:
operationId: GetAllBooks
security:
- bearerAuth: []
parameters:
- name: include
description: Include relateds
in: query
required: false
schema:
type: string
- name: fields
description: Return only specific fields
in: query
schema:
type: string
required: false
responses:
'200':
description: Successful operation
Expand Down Expand Up @@ -308,6 +598,18 @@ paths:
schema:
type: string
example: '{{bookId}}'
- name: include
description: Include relateds
in: query
required: false
schema:
type: string
- name: fields
description: Return only specific fields
in: query
schema:
type: string
required: false
responses:
'200':
description: Successful operation
Expand Down Expand Up @@ -595,6 +897,17 @@ components:
version: 2.0.0
status: OK

Author:
type: object
properties:
id:
type: string
name:
type: string
metadata:
$ref: '#/components/schemas/Metadata'


Book:
type: object
properties:
Expand All @@ -610,13 +923,41 @@ components:
type: string
pages:
type: number
metadata:
$ref: '#/components/schemas/Metadata'
example:
id: 'b1d9b21-f695-4abd-910b-78c42204f1f9'
title: 'Book title'
author: 'Mr. Cont'
author: '51ad86d3-a782-4222-b96e-c1999cd7e2c9'
isbn: '978-3-16-148410-0'
releaseDate: '2023-10-15T22:00:21.845Z'
pages: 576
metadata:
createdAt: "2023-10-15T22:00:21.845Z"
createdBy: "admin"
updatedAt: "2023-10-15T22:00:21.845Z"
updatedBy: "admin"

Metadata:
type: object
properties:
createdAt:
type: string
format: date-time
createdBy:
type: string
updatedAt:
type: string
format: date-time
updatedBy:
type: string
example:
metadata:
createdAt: "2023-10-15T22:00:21.845Z"
createdBy: "admin"
updatedAt: "2023-10-15T22:00:21.845Z"
updatedBy: "admin"


securitySchemes:
bearerAuth:
Expand Down
Loading