1+ {
2+ "swagger" : " 2.0" ,
3+ "info" : {
4+ "description" : " This is a sample server." ,
5+ "title" : " Swagger Example API" ,
6+ "contact" : {},
7+ "version" : " 1.0"
8+ },
9+ "host" : " localhost:8080" ,
10+ "basePath" : " /api" ,
11+ "paths" : {
12+ "/" : {
13+ "get" : {
14+ "produces" : [
15+ " application/json"
16+ ],
17+ "summary" : " Generic Response" ,
18+ "responses" : {
19+ "200" : {
20+ "description" : " OK" ,
21+ "schema" : {
22+ "$ref" : " #/definitions/types.GenericResponse-api_GetGeneric_User"
23+ }
24+ },
25+ "201" : {
26+ "description" : " Created" ,
27+ "schema" : {
28+ "$ref" : " #/definitions/types.GenericResponse-api_GetGeneric_Post"
29+ }
30+ }
31+ }
32+ }
33+ },
34+ "/multi" : {
35+ "get" : {
36+ "produces" : [
37+ " application/json"
38+ ],
39+ "summary" : " Multiple Generic Response" ,
40+ "responses" : {
41+ "200" : {
42+ "description" : " OK" ,
43+ "schema" : {
44+ "$ref" : " #/definitions/types.GenericMultiResponse-api_GetGenericMulti_MyStructA-api_GetGenericMulti_MyStructB"
45+ }
46+ },
47+ "201" : {
48+ "description" : " Created" ,
49+ "schema" : {
50+ "$ref" : " #/definitions/types.GenericMultiResponse-api_GetGenericMulti_MyStructB-api_GetGenericMulti_MyStructA"
51+ }
52+ }
53+ }
54+ }
55+ },
56+ "/multi-renamed" : {
57+ "get" : {
58+ "produces" : [
59+ " application/json"
60+ ],
61+ "summary" : " Multiple Generic Response With Custom Type Names" ,
62+ "responses" : {
63+ "200" : {
64+ "description" : " OK" ,
65+ "schema" : {
66+ "$ref" : " #/definitions/types.GenericMultiResponse-NameForMyStructA-NameForMyStructB"
67+ }
68+ },
69+ "201" : {
70+ "description" : " Created" ,
71+ "schema" : {
72+ "$ref" : " #/definitions/types.GenericMultiResponse-NameForMyStructB-NameForMyStructA"
73+ }
74+ }
75+ }
76+ }
77+ },
78+ "/renamed" : {
79+ "get" : {
80+ "produces" : [
81+ " application/json"
82+ ],
83+ "summary" : " Generic Response With Custom Type Names" ,
84+ "responses" : {
85+ "200" : {
86+ "description" : " OK" ,
87+ "schema" : {
88+ "$ref" : " #/definitions/types.GenericResponse-RenamedUserData"
89+ }
90+ },
91+ "201" : {
92+ "description" : " Created" ,
93+ "schema" : {
94+ "$ref" : " #/definitions/types.GenericResponse-RenamedPostData"
95+ }
96+ }
97+ }
98+ }
99+ }
100+ },
101+ "definitions" : {
102+ "NameForMyStructA" : {
103+ "type" : " object" ,
104+ "properties" : {
105+ "some_field_a" : {
106+ "type" : " string"
107+ }
108+ }
109+ },
110+ "NameForMyStructB" : {
111+ "type" : " object" ,
112+ "properties" : {
113+ "some_field_b" : {
114+ "type" : " string"
115+ }
116+ }
117+ },
118+ "RenamedPostData" : {
119+ "type" : " object" ,
120+ "properties" : {
121+ "slug" : {
122+ "type" : " integer"
123+ },
124+ "title" : {
125+ "type" : " string"
126+ }
127+ }
128+ },
129+ "RenamedUserData" : {
130+ "type" : " object" ,
131+ "properties" : {
132+ "email" : {
133+ "type" : " string"
134+ },
135+ "username" : {
136+ "type" : " integer"
137+ }
138+ }
139+ },
140+ "api.GetGeneric.Post" : {
141+ "type" : " object" ,
142+ "properties" : {
143+ "slug" : {
144+ "type" : " integer"
145+ },
146+ "title" : {
147+ "type" : " string"
148+ }
149+ }
150+ },
151+ "api.GetGeneric.User" : {
152+ "type" : " object" ,
153+ "properties" : {
154+ "email" : {
155+ "type" : " string"
156+ },
157+ "username" : {
158+ "type" : " integer"
159+ }
160+ }
161+ },
162+ "api.GetGenericMulti.MyStructA" : {
163+ "type" : " object" ,
164+ "properties" : {
165+ "some_field_a" : {
166+ "type" : " string"
167+ }
168+ }
169+ },
170+ "api.GetGenericMulti.MyStructB" : {
171+ "type" : " object" ,
172+ "properties" : {
173+ "some_field_b" : {
174+ "type" : " string"
175+ }
176+ }
177+ },
178+ "types.GenericMultiResponse-NameForMyStructA-NameForMyStructB" : {
179+ "type" : " object" ,
180+ "properties" : {
181+ "data_t" : {
182+ "$ref" : " #/definitions/NameForMyStructA"
183+ },
184+ "data_x" : {
185+ "$ref" : " #/definitions/NameForMyStructB"
186+ },
187+ "status" : {
188+ "type" : " string"
189+ }
190+ }
191+ },
192+ "types.GenericMultiResponse-NameForMyStructB-NameForMyStructA" : {
193+ "type" : " object" ,
194+ "properties" : {
195+ "data_t" : {
196+ "$ref" : " #/definitions/NameForMyStructB"
197+ },
198+ "data_x" : {
199+ "$ref" : " #/definitions/NameForMyStructA"
200+ },
201+ "status" : {
202+ "type" : " string"
203+ }
204+ }
205+ },
206+ "types.GenericMultiResponse-api_GetGenericMulti_MyStructA-api_GetGenericMulti_MyStructB" : {
207+ "type" : " object" ,
208+ "properties" : {
209+ "data_t" : {
210+ "$ref" : " #/definitions/api.GetGenericMulti.MyStructA"
211+ },
212+ "data_x" : {
213+ "$ref" : " #/definitions/api.GetGenericMulti.MyStructB"
214+ },
215+ "status" : {
216+ "type" : " string"
217+ }
218+ }
219+ },
220+ "types.GenericMultiResponse-api_GetGenericMulti_MyStructB-api_GetGenericMulti_MyStructA" : {
221+ "type" : " object" ,
222+ "properties" : {
223+ "data_t" : {
224+ "$ref" : " #/definitions/api.GetGenericMulti.MyStructB"
225+ },
226+ "data_x" : {
227+ "$ref" : " #/definitions/api.GetGenericMulti.MyStructA"
228+ },
229+ "status" : {
230+ "type" : " string"
231+ }
232+ }
233+ },
234+ "types.GenericResponse-RenamedPostData" : {
235+ "type" : " object" ,
236+ "properties" : {
237+ "data" : {
238+ "$ref" : " #/definitions/RenamedPostData"
239+ },
240+ "status" : {
241+ "type" : " string"
242+ }
243+ }
244+ },
245+ "types.GenericResponse-RenamedUserData" : {
246+ "type" : " object" ,
247+ "properties" : {
248+ "data" : {
249+ "$ref" : " #/definitions/RenamedUserData"
250+ },
251+ "status" : {
252+ "type" : " string"
253+ }
254+ }
255+ },
256+ "types.GenericResponse-api_GetGeneric_Post" : {
257+ "type" : " object" ,
258+ "properties" : {
259+ "data" : {
260+ "$ref" : " #/definitions/api.GetGeneric.Post"
261+ },
262+ "status" : {
263+ "type" : " string"
264+ }
265+ }
266+ },
267+ "types.GenericResponse-api_GetGeneric_User" : {
268+ "type" : " object" ,
269+ "properties" : {
270+ "data" : {
271+ "$ref" : " #/definitions/api.GetGeneric.User"
272+ },
273+ "status" : {
274+ "type" : " string"
275+ }
276+ }
277+ }
278+ }
279+ }
0 commit comments