Skip to content

Commit 6b45736

Browse files
test: add test case
1 parent 477683c commit 6b45736

File tree

4 files changed

+555
-0
lines changed

4 files changed

+555
-0
lines changed
Lines changed: 222 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,222 @@
1+
{
2+
"openapi": "3.1.0",
3+
"info": {
4+
"title": "API Docs",
5+
"description": "API Docs",
6+
"version": "1.0.0"
7+
},
8+
"paths": {
9+
"/": {
10+
"get": {
11+
"summary": "Hello World",
12+
"operationId": "home",
13+
"responses": {
14+
"200": {
15+
"description": "Successful Response",
16+
"content": {
17+
"application/json": {
18+
"schema": {
19+
"type": "string",
20+
"title": "Response Home"
21+
}
22+
}
23+
}
24+
}
25+
}
26+
}
27+
},
28+
"/city/{city}": {
29+
"get": {
30+
"summary": "Getcity",
31+
"operationId": "city_list",
32+
"parameters": [
33+
{
34+
"required": true,
35+
"schema": {
36+
"type": "string",
37+
"title": "City"
38+
},
39+
"name": "city",
40+
"in": "path"
41+
},
42+
{
43+
"required": false,
44+
"schema": {
45+
"type": "string",
46+
"title": "Query String"
47+
},
48+
"name": "query_string",
49+
"in": "query"
50+
}
51+
],
52+
"responses": {
53+
"200": {
54+
"description": "Successful Response",
55+
"content": {
56+
"application/json": {
57+
"schema": {
58+
"$ref": "#/components/schemas/CityGetRes"
59+
}
60+
}
61+
}
62+
},
63+
"422": {
64+
"description": "Validation Error",
65+
"content": {
66+
"application/json": {
67+
"schema": {
68+
"$ref": "#/components/schemas/HTTPValidationError"
69+
}
70+
}
71+
}
72+
}
73+
}
74+
},
75+
"put": {
76+
"summary": "Putcity",
77+
"operationId": "put_city",
78+
"parameters": [
79+
{
80+
"required": true,
81+
"schema": {
82+
"$ref": "#/components/schemas/Poi2CategoryEnum"
83+
},
84+
"name": "city",
85+
"in": "path"
86+
}
87+
],
88+
"responses": {
89+
"200": {
90+
"description": "Successful Response",
91+
"content": {
92+
"application/json": {
93+
"schema": {
94+
"$ref": "#/components/schemas/CityPutRes"
95+
}
96+
}
97+
}
98+
},
99+
"422": {
100+
"description": "Validation Error",
101+
"content": {
102+
"application/json": {
103+
"schema": {
104+
"$ref": "#/components/schemas/HTTPValidationError"
105+
}
106+
}
107+
}
108+
}
109+
}
110+
}
111+
}
112+
},
113+
"components": {
114+
"schemas": {
115+
"CityGetRes": {
116+
"properties": {
117+
"city": {
118+
"type": "string",
119+
"title": "City"
120+
},
121+
"query_string": {
122+
"type": "string",
123+
"title": "Query String"
124+
}
125+
},
126+
"type": "object",
127+
"required": ["city"],
128+
"title": "CityGetRes"
129+
},
130+
"CityPutRes": {
131+
"properties": {
132+
"city": {
133+
"$ref": "#/components/schemas/Poi2CategoryEnum"
134+
}
135+
},
136+
"type": "object",
137+
"required": ["city"],
138+
"title": "CityPutRes"
139+
},
140+
"HTTPValidationError": {
141+
"properties": {
142+
"detail": {
143+
"items": {
144+
"$ref": "#/components/schemas/ValidationError"
145+
},
146+
"type": "array",
147+
"title": "Detail"
148+
}
149+
},
150+
"type": "object",
151+
"title": "HTTPValidationError"
152+
},
153+
"Poi2CategoryEnum": {
154+
"type": "string",
155+
"enum": [
156+
"010700",
157+
"010800",
158+
"010900",
159+
"010901",
160+
"011000",
161+
"011100",
162+
"011101",
163+
"011102",
164+
"011103",
165+
"130500",
166+
"130501",
167+
"130502",
168+
"130503",
169+
"150210",
170+
"150300",
171+
"150301",
172+
"150302",
173+
"150304",
174+
"150305",
175+
"150306",
176+
"151000",
177+
"151001",
178+
"151002",
179+
"151003",
180+
"180200",
181+
"180201",
182+
"180202",
183+
"180203",
184+
"180300",
185+
"180301",
186+
"180302"
187+
],
188+
"title": "Poi2CategoryEnum",
189+
"description": "poi2分类"
190+
},
191+
"ValidationError": {
192+
"properties": {
193+
"loc": {
194+
"items": {
195+
"anyOf": [
196+
{
197+
"type": "string"
198+
},
199+
{
200+
"type": "integer"
201+
}
202+
]
203+
},
204+
"type": "array",
205+
"title": "Location"
206+
},
207+
"msg": {
208+
"type": "string",
209+
"title": "Message"
210+
},
211+
"type": {
212+
"type": "string",
213+
"title": "Error Type"
214+
}
215+
},
216+
"type": "object",
217+
"required": ["loc", "msg", "type"],
218+
"title": "ValidationError"
219+
}
220+
}
221+
}
222+
}
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
{
2+
"openapi": "3.0.2",
3+
"info": {
4+
"title": "Swagger Petstore - OpenAPI 3.0",
5+
"description": "This is a sample Pet Store Server based on the OpenAPI 3.0 specification. You can find out more about\nSwagger at [http://swagger.io](http://swagger.io). In the third iteration of the pet store, we've switched to the design first approach!\nYou can now help us improve the API whether it's by making changes to the definition itself or to the code.\nThat way, with time, we can improve the API in general, and expose some of the new features in OAS3.\n\nSome useful links:\n- [The Pet Store repository](https://github.com/swagger-api/swagger-petstore)\n- [The source API definition for the Pet Store](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml)",
6+
"termsOfService": "http://swagger.io/terms/",
7+
"contact": {
8+
"email": "[email protected]"
9+
},
10+
"license": {
11+
"name": "Apache 2.0",
12+
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
13+
},
14+
"version": "1.0.19"
15+
},
16+
"externalDocs": {
17+
"description": "Find out more about Swagger",
18+
"url": "http://swagger.io"
19+
},
20+
"servers": [
21+
{
22+
"url": "/api/v3"
23+
}
24+
],
25+
"paths": {
26+
"/pet/findByStatus": {
27+
"get": {
28+
"tags": [],
29+
"summary": "Finds Pets by status",
30+
"description": "Multiple status values can be provided with comma separated strings",
31+
"operationId": "findPetsByStatus",
32+
"parameters": [
33+
{
34+
"name": "status",
35+
"in": "query",
36+
"description": "Status values that need to be considered for filter",
37+
"required": false,
38+
"explode": true,
39+
"schema": {
40+
"type": "string",
41+
"default": "available",
42+
"enum": ["available", "pending", "sold"]
43+
}
44+
}
45+
],
46+
"responses": {
47+
"200": {
48+
"description": "successful operation",
49+
"content": {
50+
"application/xml": {
51+
"schema": {
52+
"type": "array",
53+
"items": {
54+
"$ref": "#/components/schemas/Pet"
55+
}
56+
}
57+
},
58+
"application/json": {
59+
"schema": {
60+
"type": "array",
61+
"items": {
62+
"$ref": "#/components/schemas/Pet"
63+
}
64+
}
65+
}
66+
}
67+
},
68+
"400": {
69+
"description": "Invalid status value"
70+
}
71+
}
72+
}
73+
}
74+
},
75+
"components": {
76+
"schemas": {
77+
"Category": {
78+
"type": "object",
79+
"properties": {
80+
"id": {
81+
"type": "integer",
82+
"format": "int64",
83+
"example": 1
84+
},
85+
"name": {
86+
"type": "string",
87+
"example": "Dogs"
88+
}
89+
},
90+
"xml": {
91+
"name": "category"
92+
}
93+
},
94+
"Tag": {
95+
"type": "object",
96+
"properties": {
97+
"id": {
98+
"type": "integer",
99+
"format": "int64"
100+
},
101+
"name": {
102+
"type": "string"
103+
}
104+
},
105+
"xml": {
106+
"name": "tag"
107+
}
108+
},
109+
"Pet": {
110+
"required": ["name", "photoUrls"],
111+
"type": "object",
112+
"properties": {
113+
"id": {
114+
"type": "integer",
115+
"format": "int64",
116+
"example": 10
117+
},
118+
"name": {
119+
"type": "string",
120+
"example": "doggie"
121+
},
122+
"category": {
123+
"$ref": "#/components/schemas/Category"
124+
},
125+
"photoUrls": {
126+
"type": "array",
127+
"xml": {
128+
"wrapped": true
129+
},
130+
"items": {
131+
"type": "string",
132+
"xml": {
133+
"name": "photoUrl"
134+
}
135+
}
136+
},
137+
"tags": {
138+
"type": "array",
139+
"xml": {
140+
"wrapped": true
141+
},
142+
"items": {
143+
"$ref": "#/components/schemas/Tag"
144+
}
145+
},
146+
"status": {
147+
"type": "string",
148+
"description": "pet status in the store",
149+
"enum": ["available", "pending", "sold"]
150+
}
151+
},
152+
"xml": {
153+
"name": "pet"
154+
}
155+
}
156+
}
157+
}
158+
}

0 commit comments

Comments
 (0)