Skip to content

Instantly share code, notes, and snippets.

@habvh
Last active May 22, 2020 16:31
Show Gist options
  • Save habvh/9d090621f29ac475ba57059b0fb283f6 to your computer and use it in GitHub Desktop.
Save habvh/9d090621f29ac475ba57059b0fb283f6 to your computer and use it in GitHub Desktop.
Swagger
openapi: 3.0.0
# Added by API Auto Mocking Plugin
servers:
- description: SwaggerHub API Auto Mocking
url: https://virtserver.swaggerhub.com/Hippo82/Book-Manager/1.0.0
info:
description: This is a book manager API
version: "1.0.0"
title: Simple Book API
contact:
email: [email protected]
license:
name: Apache 2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
tags:
- name: Login
description: Login account's user
- name: Book
description: Operations available to regular developers
- name: User
description: Operations available to regular developers
- name: Transaction
description: Operations available to regular developers
paths:
/auth/login:
post:
tags:
- Login
summary: Login account
operationId: addAcount
description: Adds an item to the system
responses:
'400':
description: 'invalid infor, infor invalid'
'409':
description: an existing item already exists
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Login'
description: Infor a Account of user
/books/seeBookPagination:
get:
tags:
- Book
parameters:
- in: query
name: page
description: Page number to return
required: false
schema:
type: integer
example: 1
- in: query
name: limit
description: Limit page number to return
required: false
schema:
type: integer
example: 8
responses:
200:
description: This is a book of the books
content:
application/json:
schema:
type: array
items:
properties:
_id:
type: string
example: 21j58f340fhi37dh
title:
type: string
example: You don't know js
description:
type: string
example: Everything
picture:
type: string
example: https://picsum.photos/200
/books/add/book:
post:
tags:
- Book
summary: Add a book in the books
operationId: addBookWithForm
requestBody:
content:
application/x-www-form-urlencoded:
schema:
properties:
title:
type: string
example: JavaScript New
description:
type: string
example: This is a book that write to JS
picture:
type: string
example: https://picsum.photos/200
responses:
'200':
description: Book add
content:
application/json: {}
application/xml: {}
'405':
description: Method Not Allowed
content:
application/json: {}
application/xml: {}
/books/modify:
get:
tags:
- Book
parameters:
- in: query
name: page
description: Page number to return
required: false
schema:
type: integer
example: 1
- in: query
name: limit
description: Limit page number to return
required: false
schema:
type: integer
minimum: 1
maximum: 100
default: 20
example: 8
responses:
200:
description: This is a book of the books
content:
application/json:
schema:
type: array
items:
properties:
_id:
type: string
example: 21j58f340fhi37dh
title:
type: string
example: You don't know js
/books/modify/{id}/title:
get:
tags:
- Book
parameters:
- in: path
name: id
required: true
schema:
type: string
example: adkjf239487fjgh45
responses:
200:
description: This is a book of the books
content:
application/json:
schema:
type: object
properties:
_id:
type: string
example: 21j58f340fhi37dh
title:
type: string
example: You don't know js
description:
type: string
example: Everything
picture:
type: string
example: https://picsum.photos/200
/books/modify/title:
post:
tags:
- Book
summary: Modify a book in the books
operationId: modifyBookWithForm
requestBody:
content:
application/x-www-form-urlencoded:
schema:
properties:
title:
type: string
example: JavaScript New
responses:
'200':
description: Book add
content:
application/json: {}
application/xml: {}
'405':
description: Method Not Allowed
content:
application/json: {}
application/xml: {}
/books/delete:
get:
tags:
- Book
parameters:
- in: query
name: page
description: Page number to return
required: false
schema:
type: integer
example: 1
- in: query
name: limit
description: Limit page number to return
required: false
schema:
type: integer
minimum: 1
maximum: 100
default: 20
example: 8
responses:
200:
description: This is a book of the books
content:
application/json:
schema:
type: array
items:
properties:
_id:
type: string
example: 21j58f340fhi37dh
title:
type: string
example: You don't know js
/books/{id}/delete:
post:
tags:
- Book
summary: Delete a book in the books
operationId: deleteBookWithForm
parameters:
- in: path
name: id
required: true
schema:
type: string
example: 9384uhf764ew6ergh39f
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
title:
type: string
example: JavaScript New
responses:
'200':
description: Book add
content:
application/json: {}
application/xml: {}
'405':
description: Method Not Allowed
content:
application/json: {}
application/xml: {}
/transactions/transaction:
get:
tags:
- Transaction
parameters:
- in: query
name: page
description: Page number to return
required: false
schema:
type: integer
example: 1
- in: query
name: limit
description: Limit page number to return
required: false
schema:
type: integer
example: 8
responses:
200:
description: This is list book of the books
content:
application/json:
schema:
type: array
items:
properties:
_id:
type: string
example: 21j58f340fhi37dh
userId:
type: string
example: Admin
bookId:
type: string
example: You don't know js
isComplete:
type: boolean
example: false
amount:
type: integer
example: 1
post:
tags:
- Transaction
summary: Create transaction a book in the books
operationId: createTransactionBookWithForm
requestBody:
content:
application/x-www-form-urlencoded:
schema:
properties:
name:
type: string
example: Admin
phone:
type: number
example: 8945720303
email:
type: string
example: [email protected]
password:
type: string
example: 123123
responses:
'200':
description: Book add
content:
application/json: {}
application/xml: {}
'405':
description: Method Not Allowed
content:
application/json: {}
application/xml: {}
/users/see:
get:
tags:
- User
parameters:
- in: query
name: page
description: Page number to return
required: false
schema:
type: integer
example: 1
- in: query
name: limit
description: Limit page number to return
required: false
schema:
type: integer
example: 8
responses:
200:
description: This is a user of the users
content:
application/json:
schema:
type: array
items:
properties:
_id:
type: string
example: 21j58f340fhi37dh
name:
type: string
example: Admin
phone:
type: number
example: 088346646328
email:
type: string
example: [email protected]
password:
type: string
example: $2b$10$P3XoJwxukLinEMs/yyHWg.El.jkfxpJW0ngDoMSB
isAdmin:
type: boolean
example: false
wrongLoginCount:
type: number
example: 3
avater:
type: string
example: https://res.cloudinary.com/buivanha/image/upload/v1590131280/avatarUrl/image.png
/users/add/user:
post:
tags:
- User
summary: Add a user in the users
operationId: addUserWithForm
requestBody:
content:
application/x-www-form-urlencoded:
schema:
properties:
name:
type: string
example: Admin
phone:
type: number
example: 09783466428
email:
type: string
example: [email protected]
password:
type: string
example: 123123
isAdmin:
type: boolean
example: false
wrongLoginCount:
type: number
example: 0
avatar:
type: string
example: https://res.cloudinary.com/buivanha/image/upload/v1589704912/avatarUrl/1137866_dlrfpb.png
responses:
'200':
description: Book add
content:
application/json: {}
application/xml: {}
'405':
description: Method Not Allowed
content:
application/json: {}
application/xml: {}
/users/delete/users:
get:
tags:
- User
parameters:
- in: query
name: page
description: Page number to return
required: false
schema:
type: integer
example: 1
- in: query
name: limit
description: Limit page number to return
required: false
schema:
type: integer
minimum: 1
maximum: 100
default: 20
example: 8
responses:
200:
description: This is a user of the users
content:
application/json:
schema:
type: array
items:
properties:
_id:
type: string
example: 21j58f340fhi37dh
name:
type: string
example: Admin
phone:
type: number
example: 09783466428
email:
type: string
example: [email protected]
password:
type: string
example: 123123
isAdmin:
type: boolean
example: false
wrongLoginCount:
type: number
example: 0
avatar:
type: string
example: https://res.cloudinary.com/buivanha/image/upload/v1589704912/avatarUrl/1137866_dlrfpb.png
/users/{id}/delete/user:
post:
tags:
- User
parameters:
- in: path
name: id
required: true
schema:
type: string
example: sakjf834gf893hjd
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
namr:
type: string
example: Admin
responses:
'200':
description: Book add
content:
application/json: {}
application/xml: {}
'405':
description: Method Not Allowed
content:
application/json: {}
application/xml: {}
components:
schemas:
Login:
type: object
required:
- email
- password
properties:
_id:
type: string
format: string
example: 5ec785ce7d9962e4d8181c63
email:
type: string
example: [email protected]
password:
type: string
example: 123abc!@#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment