tests/fixtures/petstore20.json 3.5 K raw
1
{
2
  "swagger": "2.0",
3
  "info": { "title": "Pet Store 2.0", "version": "1.0.0" },
4
  "host": "api.pets.example.com",
5
  "basePath": "/v2",
6
  "schemes": ["http", "https"],
7
  "consumes": ["application/json"],
8
  "produces": ["application/json"],
9
  "securityDefinitions": {
10
    "petstore_auth": {
11
      "type": "oauth2",
12
      "flow": "application",
13
      "tokenUrl": "https://auth.pets.example.com/oauth/token",
14
      "scopes": {
15
        "read:pets": "Read pets",
16
        "write:pets": "Modify pets"
17
      }
18
    },
19
    "api_key": {
20
      "type": "apiKey",
21
      "name": "X-Api-Key",
22
      "in": "header"
23
    }
24
  },
25
  "security": [{ "api_key": [] }],
26
  "parameters": {
27
    "PetId": {
28
      "name": "petId",
29
      "in": "path",
30
      "required": true,
31
      "type": "integer",
32
      "format": "int64",
33
      "x-example": 123
34
    }
35
  },
36
  "definitions": {
37
    "Pet": {
38
      "type": "object",
39
      "required": ["name"],
40
      "properties": {
41
        "id": { "type": "integer", "format": "int64" },
42
        "name": { "type": "string" },
43
        "tag": { "type": "string", "default": "friendly" },
44
        "status": { "type": "string", "enum": ["available", "pending", "sold"] }
45
      }
46
    },
47
    "Error": {
48
      "type": "object",
49
      "properties": { "message": { "type": "string" } }
50
    }
51
  },
52
  "paths": {
53
    "/pets": {
54
      "get": {
55
        "operationId": "listPets",
56
        "tags": ["pets"],
57
        "description": "Lists pets, newest first.",
58
        "parameters": [
59
          {
60
            "name": "limit",
61
            "in": "query",
62
            "required": false,
63
            "type": "integer",
64
            "default": 20,
65
            "description": "How many pets to return."
66
          },
67
          {
68
            "name": "tags",
69
            "in": "query",
70
            "required": false,
71
            "type": "array",
72
            "collectionFormat": "csv",
73
            "items": { "type": "string", "enum": ["cat", "dog"] }
74
          },
75
          {
76
            "name": "X-Tenant-Id",
77
            "in": "header",
78
            "required": true,
79
            "type": "string",
80
            "x-example": "acme"
81
          }
82
        ],
83
        "responses": {
84
          "200": {
85
            "description": "a list of pets",
86
            "schema": { "type": "array", "items": { "$ref": "#/definitions/Pet" } }
87
          },
88
          "default": {
89
            "description": "error",
90
            "schema": { "$ref": "#/definitions/Error" }
91
          }
92
        }
93
      },
94
      "post": {
95
        "operationId": "createPet",
96
        "tags": ["pets"],
97
        "parameters": [
98
          {
99
            "name": "body",
100
            "in": "body",
101
            "required": true,
102
            "schema": { "$ref": "#/definitions/Pet" }
103
          }
104
        ],
105
        "responses": {
106
          "201": { "description": "created", "schema": { "$ref": "#/definitions/Pet" } }
107
        }
108
      }
109
    },
110
    "/pets/{petId}": {
111
      "parameters": [{ "$ref": "#/parameters/PetId" }],
112
      "get": {
113
        "operationId": "getPet",
114
        "tags": ["pets"],
115
        "responses": {
116
          "200": { "description": "a pet", "schema": { "$ref": "#/definitions/Pet" } }
117
        }
118
      },
119
      "post": {
120
        "operationId": "uploadPetPhoto",
121
        "tags": ["pets"],
122
        "consumes": ["multipart/form-data"],
123
        "parameters": [
124
          { "name": "caption", "in": "formData", "required": true, "type": "string" },
125
          { "name": "photo", "in": "formData", "required": false, "type": "file" }
126
        ],
127
        "responses": { "200": { "description": "uploaded" } }
128
      }
129
    }
130
  }
131
}