File tree Expand file tree Collapse file tree 4 files changed +379
-35
lines changed Expand file tree Collapse file tree 4 files changed +379
-35
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "openapi" : " 3.0.0" ,
3
+ "info" : {
4
+ "version" : " 1.0.0" ,
5
+ "title" : " Swagger Petstore" ,
6
+ "license" : {
7
+ "name" : " MIT"
8
+ }
9
+ },
10
+ "servers" : [{
11
+ "url" : " http://petstore.swagger.io/v1"
12
+ }],
13
+ "paths" : {
14
+ "/pets" : {
15
+ "post" : {
16
+ "summary" : " List all pets" ,
17
+ "operationId" : " pets - updated" ,
18
+ "tags" : [
19
+ " pets"
20
+ ],
21
+ "parameters" : [{
22
+ "name" : " limit1" ,
23
+ "in" : " query" ,
24
+ "description" : " How many items to return at one time (max 100)" ,
25
+ "schema" : {
26
+ "type" : " integer" ,
27
+ "format" : " int32"
28
+ }
29
+ }],
30
+ "requestBody" : {
31
+ "content" : {
32
+ "application/json" : {
33
+ "schema" : {
34
+ "$ref" : " #/components/schemas/Error"
35
+ },
36
+ "examples" : {
37
+ "ok_example" : {
38
+ "value" : {
39
+ "message" : " ok"
40
+ }
41
+ },
42
+ "not_ok_example" : {
43
+ "value" : {
44
+ "message" : " fail"
45
+ }
46
+ }
47
+ }
48
+ },
49
+ "application/xml" : {
50
+ "schema" : {
51
+ "$ref" : " #/components/schemas/Error"
52
+ },
53
+ "examples" : {
54
+ "ok_example" : {
55
+ "value" : {
56
+ "message" : " ok"
57
+ }
58
+ },
59
+ "not_ok_example" : {
60
+ "value" : {
61
+ "message" : " fail"
62
+ }
63
+ }
64
+ }
65
+ }
66
+ }
67
+ },
68
+ "responses" : {
69
+ "default" : {
70
+ "description" : " unexpected error" ,
71
+ "content" : {
72
+ "application/json" : {
73
+ "schema" : {
74
+ "$ref" : " #/components/schemas/Error"
75
+ },
76
+ "example" : {
77
+ "message" : " Not Found"
78
+ }
79
+ },
80
+ "application/xml" : {
81
+ "schema" : {
82
+ "$ref" : " #/components/schemas/Error"
83
+ },
84
+ "example" : {
85
+ "message" : " Not Found"
86
+ }
87
+ }
88
+ }
89
+ },
90
+ "200" : {
91
+ "description" : " Ok" ,
92
+ "content" : {
93
+ "application/json" : {
94
+ "schema" : {
95
+ "$ref" : " #/components/schemas/Error"
96
+ },
97
+ "example" : {
98
+ "message" : " Found" ,
99
+ "code" : 200123
100
+ }
101
+ }
102
+ }
103
+ }
104
+ }
105
+ }
106
+ }
107
+ },
108
+ "components" : {
109
+ "schemas" : {
110
+ "Error" : {
111
+ "required" : [
112
+ " code" ,
113
+ " message"
114
+ ],
115
+ "properties" : {
116
+ "code" : {
117
+ "type" : " integer" ,
118
+ "format" : " int32"
119
+ },
120
+ "message" : {
121
+ "type" : " string"
122
+ }
123
+ }
124
+ }
125
+ }
126
+ }
127
+ }
Original file line number Diff line number Diff line change @@ -22,6 +22,10 @@ paths:
22
22
value :
23
23
includedFields :
24
24
- user
25
+ extra-value :
26
+ value :
27
+ includedFields :
28
+ - eyeColor
25
29
responses :
26
30
200 :
27
31
description : None
@@ -44,6 +48,10 @@ paths:
44
48
{
45
49
" user " : 1
46
50
}
51
+ extra-value-2 :
52
+ value :
53
+ includedFields :
54
+ - eyeColor
47
55
components :
48
56
schemas :
49
57
World :
Original file line number Diff line number Diff line change
1
+ openapi : 3.0.0
2
+ info :
3
+ title : None
4
+ version : 1.0.0
5
+ description : None
6
+ paths :
7
+ /v1 :
8
+ post :
9
+ requestBody :
10
+ content :
11
+ ' application/json ' :
12
+ schema :
13
+ $ref : " #/components/schemas/World"
14
+ examples :
15
+ valid-request :
16
+ value :
17
+ includedFields :
18
+ - user
19
+ - height
20
+ - weight
21
+ missing-required-parameter :
22
+ value :
23
+ includedFields :
24
+ - eyeColor
25
+ responses :
26
+ 200 :
27
+ description : None
28
+ content :
29
+ ' application/json ' :
30
+ schema :
31
+ $ref : " #/components/schemas/Request"
32
+ examples :
33
+ valid-request :
34
+ summary : Request with only required params
35
+ value :
36
+ {
37
+ " user " : 1
38
+ }
39
+ not-matching-key :
40
+ summary : Complete request
41
+ value :
42
+ {
43
+ " user " : 99,
44
+ " height " : 168,
45
+ " weight " : 44
46
+ }
47
+ 400 :
48
+ description : None
49
+ content :
50
+ ' application/json ' :
51
+ schema :
52
+ $ref : " #/components/schemas/Request"
53
+ examples :
54
+ missing-required-parameter :
55
+ summary : Request with only bad params
56
+ value :
57
+ {
58
+ " eyeColor " : " gray"
59
+ }
60
+ 500 :
61
+ description : None
62
+ content :
63
+ ' application/json ' :
64
+ schema :
65
+ $ref : " #/components/schemas/Request"
66
+ examples :
67
+ not-matching-key-1 :
68
+ summary : Failed request - Negative user
69
+ value :
70
+ {
71
+ " user " : -99
72
+ }
73
+ not-matching-key-2 :
74
+ summary : Failed request - All negatives
75
+ value :
76
+ {
77
+ " user " : -999,
78
+ " height " : -168,
79
+ " weight " : -44
80
+ }
81
+
82
+ components :
83
+ schemas :
84
+ World :
85
+ type : object
86
+ properties :
87
+ includedFields :
88
+ type : array
89
+ Request :
90
+ type : object
91
+ required :
92
+ - user
93
+ - height
94
+ - weight
95
+ properties :
96
+ user :
97
+ type : integer
98
+ description : None
99
+ height :
100
+ type : integer
101
+ description : None
102
+ weight :
103
+ type : integer
104
+ description : None
105
+ eyeColor :
106
+ type : string
You can’t perform that action at this time.
0 commit comments