Advertisement
Fhernd

hr-employees.yaml

Mar 8th, 2018
523
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 2.92 KB | None | 0 0
  1. openapi: 3.0.0
  2. info:
  3.   version: '1.0.0'
  4.   title: 'HR API'
  5.   description: 'An API to allow user to obtain existing information about employees.'
  6.   termsOfService: https://ortizol.co/tos
  7.   contact:
  8.     name: John
  9.     url: ortizol.co
  10.     email: johnortizo@outlook.com
  11.   license:
  12.     name: BSD
  13.     url: license.bsd.org
  14.  
  15. servers:
  16.   - url: http://localhost:8080
  17.     description: Devevelopment server
  18.   - url: http://ortizol.co:4748
  19.     description: Production server
  20.  
  21. paths:
  22.   /employees:
  23.     get:
  24.       description: Obtain information about employees from the HR DB.
  25.       parameters:
  26.         - name: bodyLimit
  27.           in: query
  28.           description: The amount of employees returned
  29.           schema:
  30.             type: integer
  31.             minimum: 1
  32.             maximum: 5
  33.             example: 2
  34.         - name: pageLimit
  35.           in: query
  36.           description: The pages to return employees info
  37.           schema:
  38.             type: integer
  39.             minimum: 1
  40.             maximum: 5
  41.             example: 2
  42.       responses:
  43.         200:
  44.           description: Successful pull of employee info
  45.           content:
  46.             application/json:
  47.               schema:
  48.                 type: array
  49.                 items:
  50.                 $ref: '#/components/schemas/Employee'
  51.         404:
  52.           description: Server not found
  53.     post:
  54.       description: Create a new employee in the DB.
  55.       requestBody:
  56.         required: true
  57.         content:
  58.           application/json:
  59.             schema:
  60.               type: object
  61.               $ref: '#/components/schemas/Employee'
  62.           application/xml:
  63.             schema:
  64.               type: object
  65.               $ref: '#/components/schemas/Employee'
  66.       responses:
  67.         200:
  68.            description: Successfully created a new employee.
  69.   /employees/{id}:
  70.     get:
  71.       description: Obtain information about specific employee
  72.       parameters:
  73.         - in: path
  74.           name: id
  75.           required: true
  76.           description: The ID of the employee
  77.           schema:
  78.             type: integer
  79.             example: 13
  80.       responses:
  81.         200:
  82.           description: Sucesss
  83.           content:
  84.             application/json:
  85.               schema:
  86.                 type: object
  87.                 $ref: '#/components/schemas/Employee'
  88.             application/xml:
  89.               schema:
  90.                 type: object
  91.                 $ref: '#/components/schemas/Employee'
  92. components:
  93.   schemas:
  94.     Employees:
  95.       description: Array of employee info
  96.       type: array
  97.       items:
  98.         $ref: '#/components/schemas/Employee'
  99.     Employee:
  100.       description: Model containing employee info
  101.       properties:
  102.         id:
  103.           type: integer
  104.           example: 4
  105.         employee_name:
  106.           type: string
  107.           example: John Ortiz
  108.         employee_title:
  109.           type: string
  110.           example: Developer
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement