MCPcopy Index your code
hub / github.com/oapi-codegen/oapi-codegen / gatherComponentResponses

Function gatherComponentResponses

pkg/codegen/gather.go:182–213  ·  view source on GitHub ↗
(components *openapi3.Components)

Source from the content-addressed store, hash-verified

180}
181
182func 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
215func gatherComponentRequestBodies(components *openapi3.Components) []*GatheredSchema {
216 var result []*GatheredSchema

Callers 1

GatherSchemasFunction · 0.85

Calls 3

IsMediaTypeJsonFunction · 0.92
SortedMapKeysFunction · 0.85
extractGoNameOverrideFunction · 0.85

Tested by

no test coverage detected