Advertisement
gakhov

swagger_talk_swagger.yml

Jul 5th, 2015
379
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 5.03 KB | None | 0 0
  1.    swagger: '2.0'
  2.     info:
  3.         title: DEMO API
  4.         description: Demonstration for techtalk @ ferret
  5.         version: 1.0.0
  6.         termsOfService: http://demo.berlin/terms/
  7.         contact:
  8.             name: API Support
  9.             url: http://demo.berlin/support
  10.             email: support@demo.berlin
  11.         license:
  12.             name: Apache 2.0
  13.             url: http://www.apache.org/licenses/LICENSE-2.0.html
  14.     host: api.demo.berlin
  15.     schemes:
  16.      - http
  17.       - https
  18.     basePath: /v1
  19.     consumes:
  20.      - application/json
  21.     produces:
  22.      - application/json
  23.     paths:
  24.         /articles:
  25.             get:
  26.                 summary: Get Articles
  27.                 operationId: getArticles
  28.                 parameters:
  29.                   - name: size
  30.                     in: query
  31.                     required: false
  32.                     default: 10
  33.                     maximum: 100
  34.                     type: integer
  35.                     format: int32
  36.                   - name: offset
  37.                     in: query
  38.                     required: false
  39.                     default: 1
  40.                     type: integer
  41.                     format: int32
  42.                 tags:
  43.                   - Articles
  44.                 responses:
  45.                     200:
  46.                         description: An array of articles
  47.                         schema:
  48.                             $ref: "#/definitions/Articles"
  49.                     default:
  50.                         description: Unexpected error
  51.                         schema:
  52.                             $ref: "#/definitions/Error"
  53.         /article/{id}/authors:
  54.             get:
  55.                 summary: Get Authors
  56.                 operationId: getAuthorsByArticleID
  57.                 description: The Authors endpoint returns all authors for the specific article identified by {id}
  58.                 parameters:
  59.                   - name: id
  60.                     in: path
  61.                     description: Id of the Article
  62.                     required: true
  63.                     type: string
  64.                 tags:
  65.                  - Articles
  66.                   - Authors
  67.                 responses:
  68.                     200:
  69.                         description: An array of authors
  70.                         schema:
  71.                             $ref: "#/definitions/Authors"
  72.                     404:
  73.                         description: Article Not Found
  74.                         schema:
  75.                             $ref: "#/definitions/Error"
  76.                     default:
  77.                         description: Unexpected error
  78.                         schema:
  79.                             $ref: "#/definitions/Error"
  80.     definitions:
  81.         Article:
  82.             properties:
  83.                 id:
  84.                     type: string
  85.                     description: Unique identifier.
  86.                 title:
  87.                     type: string
  88.                     description: Title of the article.
  89.                 text:
  90.                     type: string
  91.                     description: Text of the article.
  92.                 authors:
  93.                     type: array
  94.                     items:
  95.                         $ref: "#/definitions/Author"
  96.         Articles:
  97.             properties:
  98.                 offset:
  99.                     type: integer
  100.                     format: int32
  101.                     description: Position in pagination.
  102.                 size:
  103.                     type: integer
  104.                     format: int32
  105.                     description: Number of articles to retrieve (100 max).
  106.                 total:
  107.                     type: integer
  108.                     format: int32
  109.                     description: Total number of articles available.
  110.                 items:
  111.                     type: array
  112.                     items:
  113.                         $ref: "#/definitions/Article"
  114.         Author:
  115.             properties:
  116.                 id:
  117.                     type: string
  118.                     description: Unique identifier.
  119.                 name:
  120.                     type: string
  121.                     description: Name of the author.
  122.                 email:
  123.                     type: string
  124.                     description: Author’s email.
  125.         Authors:
  126.             properties:
  127.                 total:
  128.                     type: integer
  129.                     format: int32
  130.                     description: Total number of authors.
  131.                 items:
  132.                     type: array
  133.                     items:
  134.                         $ref: "#/definitions/Author"
  135.         Error:
  136.             properties:
  137.                 code:
  138.                     type: integer
  139.                     format: int32
  140.                 message:
  141.                     type: string
  142.                 fields:
  143.                     type: string
  144.     tags:
  145.       - name: Articles
  146.         description: Articles operations
  147.       - name: Authors
  148.         description: Authors operations
  149.     externalDocs:
  150.         description: Find more info here
  151.         url: https://docs.demo.berlin
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement