@@ -12,20 +12,20 @@ import (
12
12
// T is the root of an OpenAPI v2 document
13
13
type T struct {
14
14
openapi3.ExtensionProps
15
- Swagger string `json:"swagger"`
16
- Info openapi3.Info `json:"info"`
17
- ExternalDocs * openapi3.ExternalDocs `json:"externalDocs,omitempty"`
18
- Schemes []string `json:"schemes,omitempty"`
19
- Consumes []string `json:"consumes,omitempty"`
20
- Host string `json:"host,omitempty"`
21
- BasePath string `json:"basePath,omitempty"`
22
- Paths map [string ]* PathItem `json:"paths,omitempty"`
23
- Definitions map [string ]* openapi3.SchemaRef `json:"definitions,omitempty,noref"`
24
- Parameters map [string ]* Parameter `json:"parameters,omitempty,noref"`
25
- Responses map [string ]* Response `json:"responses,omitempty,noref"`
26
- SecurityDefinitions map [string ]* SecurityScheme `json:"securityDefinitions,omitempty"`
27
- Security SecurityRequirements `json:"security,omitempty"`
28
- Tags openapi3.Tags `json:"tags,omitempty"`
15
+ Swagger string `json:"swagger" yaml:"swagger" `
16
+ Info openapi3.Info `json:"info" yaml:"info" `
17
+ ExternalDocs * openapi3.ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty" `
18
+ Schemes []string `json:"schemes,omitempty" yaml:"schemes,omitempty" `
19
+ Consumes []string `json:"consumes,omitempty" yaml:"consumes,omitempty" `
20
+ Host string `json:"host,omitempty" yaml:"host,omitempty" `
21
+ BasePath string `json:"basePath,omitempty" yaml:"basePath,omitempty" `
22
+ Paths map [string ]* PathItem `json:"paths,omitempty" yaml:"paths,omitempty" `
23
+ Definitions map [string ]* openapi3.SchemaRef `json:"definitions,omitempty,noref" yaml:"definitions,omitempty,noref" `
24
+ Parameters map [string ]* Parameter `json:"parameters,omitempty,noref" yaml:"parameters,omitempty,noref" `
25
+ Responses map [string ]* Response `json:"responses,omitempty,noref" yaml:"responses,omitempty,noref" `
26
+ SecurityDefinitions map [string ]* SecurityScheme `json:"securityDefinitions,omitempty" yaml:"securityDefinitions,omitempty" `
27
+ Security SecurityRequirements `json:"security,omitempty" yaml:"security,omitempty" `
28
+ Tags openapi3.Tags `json:"tags,omitempty" yaml:"tags,omitempty" `
29
29
}
30
30
31
31
func (doc * T ) MarshalJSON () ([]byte , error ) {
@@ -52,15 +52,15 @@ func (doc *T) AddOperation(path string, method string, operation *Operation) {
52
52
53
53
type PathItem struct {
54
54
openapi3.ExtensionProps
55
- Ref string `json:"$ref,omitempty"`
56
- Delete * Operation `json:"delete,omitempty"`
57
- Get * Operation `json:"get,omitempty"`
58
- Head * Operation `json:"head,omitempty"`
59
- Options * Operation `json:"options,omitempty"`
60
- Patch * Operation `json:"patch,omitempty"`
61
- Post * Operation `json:"post,omitempty"`
62
- Put * Operation `json:"put,omitempty"`
63
- Parameters Parameters `json:"parameters,omitempty"`
55
+ Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty" `
56
+ Delete * Operation `json:"delete,omitempty" yaml:"delete,omitempty" `
57
+ Get * Operation `json:"get,omitempty" yaml:"get,omitempty" `
58
+ Head * Operation `json:"head,omitempty" yaml:"head,omitempty" `
59
+ Options * Operation `json:"options,omitempty" yaml:"options,omitempty" `
60
+ Patch * Operation `json:"patch,omitempty" yaml:"patch,omitempty" `
61
+ Post * Operation `json:"post,omitempty" yaml:"post,omitempty" `
62
+ Put * Operation `json:"put,omitempty" yaml:"put,omitempty" `
63
+ Parameters Parameters `json:"parameters,omitempty" yaml:"parameters,omitempty" `
64
64
}
65
65
66
66
func (pathItem * PathItem ) MarshalJSON () ([]byte , error ) {
@@ -141,16 +141,16 @@ func (pathItem *PathItem) SetOperation(method string, operation *Operation) {
141
141
142
142
type Operation struct {
143
143
openapi3.ExtensionProps
144
- Summary string `json:"summary,omitempty"`
145
- Description string `json:"description,omitempty"`
146
- ExternalDocs * openapi3.ExternalDocs `json:"externalDocs,omitempty"`
147
- Tags []string `json:"tags,omitempty"`
148
- OperationID string `json:"operationId,omitempty"`
149
- Parameters Parameters `json:"parameters,omitempty"`
150
- Responses map [string ]* Response `json:"responses"`
151
- Consumes []string `json:"consumes,omitempty"`
152
- Produces []string `json:"produces,omitempty"`
153
- Security * SecurityRequirements `json:"security,omitempty"`
144
+ Summary string `json:"summary,omitempty" yaml:"summary,omitempty" `
145
+ Description string `json:"description,omitempty" yaml:"description,omitempty" `
146
+ ExternalDocs * openapi3.ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty" `
147
+ Tags []string `json:"tags,omitempty" yaml:"tags,omitempty" `
148
+ OperationID string `json:"operationId,omitempty" yaml:"operationId,omitempty" `
149
+ Parameters Parameters `json:"parameters,omitempty" yaml:"parameters,omitempty" `
150
+ Responses map [string ]* Response `json:"responses" yaml:"responses" `
151
+ Consumes []string `json:"consumes,omitempty" yaml:"consumes,omitempty" `
152
+ Produces []string `json:"produces,omitempty" yaml:"produces,omitempty" `
153
+ Security * SecurityRequirements `json:"security,omitempty" yaml:"security,omitempty" `
154
154
}
155
155
156
156
func (operation * Operation ) MarshalJSON () ([]byte , error ) {
@@ -179,30 +179,30 @@ func (ps Parameters) Less(i, j int) bool {
179
179
180
180
type Parameter struct {
181
181
openapi3.ExtensionProps
182
- Ref string `json:"$ref,omitempty"`
183
- In string `json:"in,omitempty"`
184
- Name string `json:"name,omitempty"`
185
- Description string `json:"description,omitempty"`
186
- CollectionFormat string `json:"collectionFormat,omitempty"`
187
- Type string `json:"type,omitempty"`
188
- Format string `json:"format,omitempty"`
189
- Pattern string `json:"pattern,omitempty"`
190
- AllowEmptyValue bool `json:"allowEmptyValue,omitempty"`
191
- Required bool `json:"required,omitempty"`
192
- UniqueItems bool `json:"uniqueItems,omitempty"`
193
- ExclusiveMin bool `json:"exclusiveMinimum,omitempty"`
194
- ExclusiveMax bool `json:"exclusiveMaximum,omitempty"`
195
- Schema * openapi3.SchemaRef `json:"schema,omitempty"`
196
- Items * openapi3.SchemaRef `json:"items,omitempty"`
197
- Enum []interface {} `json:"enum,omitempty"`
198
- MultipleOf * float64 `json:"multipleOf,omitempty"`
199
- Minimum * float64 `json:"minimum,omitempty"`
200
- Maximum * float64 `json:"maximum,omitempty"`
201
- MaxLength * uint64 `json:"maxLength,omitempty"`
202
- MaxItems * uint64 `json:"maxItems,omitempty"`
203
- MinLength uint64 `json:"minLength,omitempty"`
204
- MinItems uint64 `json:"minItems,omitempty"`
205
- Default interface {} `json:"default,omitempty"`
182
+ Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty" `
183
+ In string `json:"in,omitempty" yaml:"in,omitempty" `
184
+ Name string `json:"name,omitempty" yaml:"name,omitempty" `
185
+ Description string `json:"description,omitempty" yaml:"description,omitempty" `
186
+ CollectionFormat string `json:"collectionFormat,omitempty" yaml:"collectionFormat,omitempty" `
187
+ Type string `json:"type,omitempty" yaml:"type,omitempty" `
188
+ Format string `json:"format,omitempty" yaml:"format,omitempty" `
189
+ Pattern string `json:"pattern,omitempty" yaml:"pattern,omitempty" `
190
+ AllowEmptyValue bool `json:"allowEmptyValue,omitempty" yaml:"allowEmptyValue,omitempty" `
191
+ Required bool `json:"required,omitempty" yaml:"required,omitempty" `
192
+ UniqueItems bool `json:"uniqueItems,omitempty" yaml:"uniqueItems,omitempty" `
193
+ ExclusiveMin bool `json:"exclusiveMinimum,omitempty" yaml:"exclusiveMinimum,omitempty" `
194
+ ExclusiveMax bool `json:"exclusiveMaximum,omitempty" yaml:"exclusiveMaximum,omitempty" `
195
+ Schema * openapi3.SchemaRef `json:"schema,omitempty" yaml:"schema,omitempty" `
196
+ Items * openapi3.SchemaRef `json:"items,omitempty" yaml:"items,omitempty" `
197
+ Enum []interface {} `json:"enum,omitempty" yaml:"enum,omitempty" `
198
+ MultipleOf * float64 `json:"multipleOf,omitempty" yaml:"multipleOf,omitempty" `
199
+ Minimum * float64 `json:"minimum,omitempty" yaml:"minimum,omitempty" `
200
+ Maximum * float64 `json:"maximum,omitempty" yaml:"maximum,omitempty" `
201
+ MaxLength * uint64 `json:"maxLength,omitempty" yaml:"maxLength,omitempty" `
202
+ MaxItems * uint64 `json:"maxItems,omitempty" yaml:"maxItems,omitempty" `
203
+ MinLength uint64 `json:"minLength,omitempty" yaml:"minLength,omitempty" `
204
+ MinItems uint64 `json:"minItems,omitempty" yaml:"minItems,omitempty" `
205
+ Default interface {} `json:"default,omitempty" yaml:"default,omitempty" `
206
206
}
207
207
208
208
func (parameter * Parameter ) MarshalJSON () ([]byte , error ) {
@@ -215,11 +215,11 @@ func (parameter *Parameter) UnmarshalJSON(data []byte) error {
215
215
216
216
type Response struct {
217
217
openapi3.ExtensionProps
218
- Ref string `json:"$ref,omitempty"`
219
- Description string `json:"description,omitempty"`
220
- Schema * openapi3.SchemaRef `json:"schema,omitempty"`
221
- Headers map [string ]* Header `json:"headers,omitempty"`
222
- Examples map [string ]interface {} `json:"examples,omitempty"`
218
+ Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty" `
219
+ Description string `json:"description,omitempty" yaml:"description,omitempty" `
220
+ Schema * openapi3.SchemaRef `json:"schema,omitempty" yaml:"schema,omitempty" `
221
+ Headers map [string ]* Header `json:"headers,omitempty" yaml:"headers,omitempty" `
222
+ Examples map [string ]interface {} `json:"examples,omitempty" yaml:"examples,omitempty" `
223
223
}
224
224
225
225
func (response * Response ) MarshalJSON () ([]byte , error ) {
@@ -232,9 +232,9 @@ func (response *Response) UnmarshalJSON(data []byte) error {
232
232
233
233
type Header struct {
234
234
openapi3.ExtensionProps
235
- Ref string `json:"$ref,omitempty"`
236
- Description string `json:"description,omitempty"`
237
- Type string `json:"type,omitempty"`
235
+ Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty" `
236
+ Description string `json:"description,omitempty" yaml:"description,omitempty" `
237
+ Type string `json:"type,omitempty" yaml:"type,omitempty" `
238
238
}
239
239
240
240
func (header * Header ) MarshalJSON () ([]byte , error ) {
@@ -249,16 +249,16 @@ type SecurityRequirements []map[string][]string
249
249
250
250
type SecurityScheme struct {
251
251
openapi3.ExtensionProps
252
- Ref string `json:"$ref,omitempty"`
253
- Description string `json:"description,omitempty"`
254
- Type string `json:"type,omitempty"`
255
- In string `json:"in,omitempty"`
256
- Name string `json:"name,omitempty"`
257
- Flow string `json:"flow,omitempty"`
258
- AuthorizationURL string `json:"authorizationUrl,omitempty"`
259
- TokenURL string `json:"tokenUrl,omitempty"`
260
- Scopes map [string ]string `json:"scopes,omitempty"`
261
- Tags openapi3.Tags `json:"tags,omitempty"`
252
+ Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty" `
253
+ Description string `json:"description,omitempty" yaml:"description,omitempty" `
254
+ Type string `json:"type,omitempty" yaml:"type,omitempty" `
255
+ In string `json:"in,omitempty" yaml:"in,omitempty" `
256
+ Name string `json:"name,omitempty" yaml:"name,omitempty" `
257
+ Flow string `json:"flow,omitempty" yaml:"flow,omitempty" `
258
+ AuthorizationURL string `json:"authorizationUrl,omitempty" yaml:"authorizationUrl,omitempty" `
259
+ TokenURL string `json:"tokenUrl,omitempty" yaml:"tokenUrl,omitempty" `
260
+ Scopes map [string ]string `json:"scopes,omitempty" yaml:"scopes,omitempty" `
261
+ Tags openapi3.Tags `json:"tags,omitempty" yaml:"tags,omitempty" `
262
262
}
263
263
264
264
func (securityScheme * SecurityScheme ) MarshalJSON () ([]byte , error ) {
0 commit comments