Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- swagger: "2.0"
- info:
- version: "0.0.1"
- title: Happy clean Server
- # during dev, should point to your local machine
- host: localhost:10010
- # basePath prefixes all resource paths
- basePath: /_aVlM10DR
- #
- schemes:
- # tip: remove http to make production-grade
- - http
- - https
- # format of bodies a client can send (Content-Type)
- consumes:
- - application/json
- - text/html
- - text/plain; charset=UTF-8
- # format of the responses to the client (Accepts)
- produces:
- - application/json
- - text/plain; charset=UTF-8
- - text/html
- paths:
- /m/user:
- # our controller name
- x-swagger-router-controller: user
- get:
- operationId: getAll
- description: get the users list
- # define the type of response for Success "200" and Error
- responses:
- "200":
- description: Success
- schema:
- $ref: "#/definitions/GetusersListResponse"
- default:
- description: Error
- schema:
- $ref: "#/definitions/ErrorResponse"
- post:
- operationId: save
- description: add a new user
- # user info to be stored
- parameters:
- - name: body
- description: User information
- in: body
- required: true
- schema:
- $ref: "#/definitions/user"
- - name: password
- in: header
- description: User password
- type: string
- format: password
- required: true
- responses:
- "201":
- description: Created confirmation.
- schema:
- $ref: "#/definitions/GeneralResponse"
- "409":
- description: 'Must be sended when user_email already exist'
- default:
- description: Error
- schema:
- $ref: "#/definitions/ErrorResponse"
- #/m/user/{id}/{email}:
- /m/user/{id}:
- # our controller name
- x-swagger-router-controller: user
- get:
- operationId: getOne
- description: get a user data
- # define the type of response for Success "200" and Error
- parameters:
- - name: id
- type: string
- in: path
- required: true
- responses:
- "200":
- description: Success
- schema:
- $ref: "#/definitions/GetuserResponse"
- default:
- description: Error
- schema:
- $ref: "#/definitions/ErrorResponse"
- /swagger:
- x-swagger-pipe: swagger_raw
- # complex objects have schema definitions
- definitions:
- ErrorResponse:
- required:
- - message
- properties:
- message:
- type: string
- GetusersListResponse:
- required:
- - users
- properties:
- # The array of users
- users:
- type: array
- items:
- type: object
- properties:
- id:
- type: string
- email:
- type: string
- password:
- type: string
- user:
- type: object
- properties:
- username:
- type: string
- description: Name of new user
- email:
- type: string
- description: email from the user
- pattern: '^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]{2,64}$'
- required:
- - username
- - email
- GeneralResponse:
- type: object
- properties:
- success:
- type: number
- description: returns 1 if successful
- description:
- type: string
- description: a short comment
- required:
- - success
- - description
- GetuserResponse:
- required:
- - id
- - email
- - password
- properties:
- id:
- type: string
- email:
- type: string
- password:
- type: string
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement