(components *openapi3.Components)
| 213 | } |
| 214 | |
| 215 | func gatherComponentRequestBodies(components *openapi3.Components) []*GatheredSchema { |
| 216 | var result []*GatheredSchema |
| 217 | for _, name := range SortedMapKeys(components.RequestBodies) { |
| 218 | bodyRef := components.RequestBodies[name] |
| 219 | if bodyRef == nil || bodyRef.Value == nil { |
| 220 | continue |
| 221 | } |
| 222 | body := bodyRef.Value |
| 223 | var goNameOverride string |
| 224 | if bodyRef.Ref == "" { |
| 225 | goNameOverride = extractGoNameOverride(body.Extensions) |
| 226 | } |
| 227 | for _, mediaType := range SortedMapKeys(body.Content) { |
| 228 | if !util.IsMediaTypeJson(mediaType) { |
| 229 | continue |
| 230 | } |
| 231 | mt := body.Content[mediaType] |
| 232 | if mt.Schema != nil && mt.Schema.Value != nil { |
| 233 | result = append(result, &GatheredSchema{ |
| 234 | Path: SchemaPath{"components", "requestBodies", name, "content", mediaType}, |
| 235 | Context: ContextComponentRequestBody, |
| 236 | Ref: bodyRef.Ref, |
| 237 | Schema: mt.Schema.Value, |
| 238 | ContentType: mediaType, |
| 239 | ComponentName: name, |
| 240 | GoNameOverride: goNameOverride, |
| 241 | }) |
| 242 | } |
| 243 | } |
| 244 | } |
| 245 | return result |
| 246 | } |
| 247 | |
| 248 | func gatherComponentHeaders(components *openapi3.Components) []*GatheredSchema { |
| 249 | var result []*GatheredSchema |
no test coverage detected