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

Function gatherComponentHeaders

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

Source from the content-addressed store, hash-verified

246}
247
248func gatherComponentHeaders(components *openapi3.Components) []*GatheredSchema {
249 var result []*GatheredSchema
250 for _, name := range SortedMapKeys(components.Headers) {
251 headerRef := components.Headers[name]
252 if headerRef == nil || headerRef.Value == nil {
253 continue
254 }
255 header := headerRef.Value
256 if header.Schema != nil && header.Schema.Value != nil {
257 var goNameOverride string
258 if headerRef.Ref == "" {
259 goNameOverride = extractGoNameOverride(header.Extensions)
260 }
261 result = append(result, &GatheredSchema{
262 Path: SchemaPath{"components", "headers", name},
263 Context: ContextComponentHeader,
264 Ref: headerRef.Ref,
265 Schema: header.Schema.Value,
266 ComponentName: name,
267 GoNameOverride: goNameOverride,
268 })
269 }
270 }
271 return result
272}
273
274// gatherClientResponseWrappers creates synthetic schema entries for each
275// operation that would generate a client response wrapper type like

Callers 1

GatherSchemasFunction · 0.85

Calls 2

SortedMapKeysFunction · 0.85
extractGoNameOverrideFunction · 0.85

Tested by

no test coverage detected