GatherSchemas walks the entire OpenAPI spec and collects all schemas that will need Go type names. This is the first pass of the multi-pass resolution.
(spec *openapi3.T, opts Configuration)
| 108 | // GatherSchemas walks the entire OpenAPI spec and collects all schemas that |
| 109 | // will need Go type names. This is the first pass of the multi-pass resolution. |
| 110 | func GatherSchemas(spec *openapi3.T, opts Configuration) []*GatheredSchema { |
| 111 | var schemas []*GatheredSchema |
| 112 | |
| 113 | if spec.Components != nil { |
| 114 | schemas = slices.Concat( |
| 115 | gatherComponentSchemas(spec.Components), |
| 116 | gatherComponentParameters(spec.Components), |
| 117 | gatherComponentResponses(spec.Components), |
| 118 | gatherComponentRequestBodies(spec.Components), |
| 119 | gatherComponentHeaders(spec.Components), |
| 120 | ) |
| 121 | } |
| 122 | |
| 123 | // Gather client response wrapper types for operations that will generate |
| 124 | // client code. These synthetic entries exist so wrapper types like |
| 125 | // `CreateChatCompletionResponse` participate in collision detection. |
| 126 | if opts.Generate.Client { |
| 127 | schemas = append(schemas, gatherClientResponseWrappers(spec)...) |
| 128 | } |
| 129 | |
| 130 | return schemas |
| 131 | } |
| 132 | |
| 133 | func gatherComponentSchemas(components *openapi3.Components) []*GatheredSchema { |
| 134 | var result []*GatheredSchema |