Advertisement
gakhov

swagger_talk_swagger.json

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