(components *openapi3.Components)
| 180 | } |
| 181 | |
| 182 | func gatherComponentResponses(components *openapi3.Components) []*GatheredSchema { |
| 183 | var result []*GatheredSchema |
| 184 | for _, name := range SortedMapKeys(components.Responses) { |
| 185 | responseRef := components.Responses[name] |
| 186 | if responseRef == nil || responseRef.Value == nil { |
| 187 | continue |
| 188 | } |
| 189 | response := responseRef.Value |
| 190 | var goNameOverride string |
| 191 | if responseRef.Ref == "" { |
| 192 | goNameOverride = extractGoNameOverride(response.Extensions) |
| 193 | } |
| 194 | for _, mediaType := range SortedMapKeys(response.Content) { |
| 195 | if !util.IsMediaTypeJson(mediaType) { |
| 196 | continue |
| 197 | } |
| 198 | mt := response.Content[mediaType] |
| 199 | if mt.Schema != nil && mt.Schema.Value != nil { |
| 200 | result = append(result, &GatheredSchema{ |
| 201 | Path: SchemaPath{"components", "responses", name, "content", mediaType}, |
| 202 | Context: ContextComponentResponse, |
| 203 | Ref: responseRef.Ref, |
| 204 | Schema: mt.Schema.Value, |
| 205 | ContentType: mediaType, |
| 206 | ComponentName: name, |
| 207 | GoNameOverride: goNameOverride, |
| 208 | }) |
| 209 | } |
| 210 | } |
| 211 | } |
| 212 | return result |
| 213 | } |
| 214 | |
| 215 | func gatherComponentRequestBodies(components *openapi3.Components) []*GatheredSchema { |
| 216 | var result []*GatheredSchema |
no test coverage detected