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

Function TestGatherSchemas_ComponentHeaders

pkg/codegen/gather_test.go:123–146  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

121}
122
123func TestGatherSchemas_ComponentHeaders(t *testing.T) {
124 spec := &openapi3.T{
125 Components: &openapi3.Components{
126 Headers: openapi3.Headers{
127 "X-Rate-Limit": &openapi3.HeaderRef{
128 Value: &openapi3.Header{
129 Parameter: openapi3.Parameter{
130 Schema: &openapi3.SchemaRef{
131 Value: &openapi3.Schema{Type: &openapi3.Types{"integer"}},
132 },
133 },
134 },
135 },
136 },
137 },
138 }
139
140 opts := Configuration{}
141 schemas := GatherSchemas(spec, opts)
142
143 require.Len(t, schemas, 1)
144 assert.Equal(t, SchemaPath{"components", "headers", "X-Rate-Limit"}, schemas[0].Path)
145 assert.Equal(t, ContextComponentHeader, schemas[0].Context)
146}
147
148func TestGatherSchemas_ClientResponseWrappers(t *testing.T) {
149 paths := openapi3.NewPaths()

Callers

nothing calls this directly

Calls 2

GatherSchemasFunction · 0.85
LenMethod · 0.45

Tested by

no test coverage detected