{"modulePath":"github.com/ifc7/oapi-codegen","version":"v0.0.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package codegen\n\nCopyright 2019 DeepMap, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\nCopyright 2019 DeepMap, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\nCopyright 2019 DeepMap, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\n## Variables\n\n```go\nvar DefaultTypeMapping = TypeMapping{\n\tInteger: FormatMapping{\n\t\tDefault: SimpleTypeSpec{Type: \"int\"},\n\t\tFormats: map[string]SimpleTypeSpec{\n\t\t\t\"int\":    {Type: \"int\"},\n\t\t\t\"int8\":   {Type: \"int8\"},\n\t\t\t\"int16\":  {Type: \"int16\"},\n\t\t\t\"int32\":  {Type: \"int32\"},\n\t\t\t\"int64\":  {Type: \"int64\"},\n\t\t\t\"uint\":   {Type: \"uint\"},\n\t\t\t\"uint8\":  {Type: \"uint8\"},\n\t\t\t\"uint16\": {Type: \"uint16\"},\n\t\t\t\"uint32\": {Type: \"uint32\"},\n\t\t\t\"uint64\": {Type: \"uint64\"},\n\t\t},\n\t},\n\tNumber: FormatMapping{\n\t\tDefault: SimpleTypeSpec{Type: \"float32\"},\n\t\tFormats: map[string]SimpleTypeSpec{\n\t\t\t\"float\":  {Type: \"float32\"},\n\t\t\t\"double\": {Type: \"float64\"},\n\t\t},\n\t},\n\tBoolean: FormatMapping{\n\t\tDefault: SimpleTypeSpec{Type: \"bool\"},\n\t},\n\tString: FormatMapping{\n\t\tDefault: SimpleTypeSpec{Type: \"string\"},\n\t\tFormats: map[string]SimpleTypeSpec{\n\t\t\t\"byte\":      {Type: \"[]byte\"},\n\t\t\t\"email\":     {Type: \"OpenAPIEmail\"},\n\t\t\t\"date\":      {Type: \"OpenAPIDate\"},\n\t\t\t\"date-time\": {Type: \"time.Time\", Import: \"time\"},\n\t\t\t\"duration\":  {Type: \"OpenAPIDuration\"},\n\t\t\t\"json\":      {Type: \"json.RawMessage\", Import: \"encoding/json\"},\n\t\t\t\"uuid\":      {Type: \"uuid.UUID\", Import: \"github.com/google/uuid\"},\n\t\t\t\"binary\":    {Type: \"OpenAPIFile\"},\n\t\t},\n\t},\n}\n```\nDefaultTypeMapping provides the default OpenAPI type/format to Go type mappings.\n\n```go\nvar NameNormalizers = NameNormalizerMap{\n\tNameNormalizerFunctionUnset:                      ToCamelCase,\n\tNameNormalizerFunctionToCamelCase:                ToCamelCase,\n\tNameNormalizerFunctionToCamelCaseWithDigits:      ToCamelCaseWithDigits,\n\tNameNormalizerFunctionToCamelCaseWithInitialisms: ToCamelCaseWithInitialisms,\n}\n```\nNameNormalizers contains the valid options for \\`NameNormalizerFunction\\`s that \\`oapi-codegen\\` supports.\n\nIf you are calling \\`oapi-codegen\\` as a library, this allows you to specify your own normalisation types before generating code.\n\n```go\nvar TemplateFunctions = template.FuncMap{\n\t\"dict\":                       dict,\n\t\"formBind\":                   formBind,\n\t\"formEncode\":                 formEncode,\n\t\"genParamArgs\":               genParamArgs,\n\t\"genParamNames\":              genParamNames,\n\t\"genPathString\":              GenPathString,\n\t\"swaggerUriToStdHttpUri\":     SwaggerUriToStdHttpUri,\n\t\"lcFirst\":                    LowercaseFirstCharacter,\n\t\"ucFirst\":                    UppercaseFirstCharacter,\n\t\"ucFirstWithPkgName\":         UppercaseFirstCharacterWithPkgName,\n\t\"camelCase\":                  ToCamelCase,\n\t\"genResponsePayload\":         genResponsePayload,\n\t\"genResponseTypeName\":        genResponseTypeName,\n\t\"genResponseUnmarshal\":       genResponseUnmarshal,\n\t\"getConditionOfResponseName\": getConditionOfResponseName,\n\t\"responsesWithHeaders\":       responsesWithHeaders,\n\t\"getResponseTypeDefinitions\": getResponseTypeDefinitions,\n\t\"lower\":                      strings.ToLower,\n\t\"title\":                      titleCaser.String,\n\t\"stripNewLines\":              stripNewLines,\n\t\"sanitizeGoIdentity\":         SanitizeGoIdentity,\n\t\"schemaNameToTypeName\":       SchemaNameToTypeName,\n\t\"toGoString\":                 StringToGoString,\n\t\"toGoComment\":                StringWithTypeNameToGoComment,\n\t\"withoutPkgName\":             withoutPkgName,\n\t\"httpMethodConstant\":         httpMethodConstant,\n}\n```\nTemplateFunctions is passed to the template engine, and we can call each function here by keyName from the template code.\n\n## Functions\n\n```go\nfunc DeprecationComment(reason string) string\n```\n\n```go\nfunc EscapePathElements(path string) string\n```\nEscapePathElements breaks apart a path, and looks at each element. If it's not a path parameter, eg, {param}, it will URL-escape the element.\n\n```go\nfunc GenFieldsFromProperties(props []Property) []string\n```\nGenFieldsFromProperties produce corresponding field names with JSON annotations, given a list of schema descriptors\n\n```go\nfunc GenPathString(uri, paramVarName string) string\n```\nGenPathString constructs a Go expression that builds the given URI by concatenating its literal segments with the path-parameter variables named \\\u003cparamVarName\u003e0 through \\\u003cparamVarName\u003eN. Literal segments are quoted with strconv.Quote so that characters which are significant in Go source, such as quotes, backslashes and percent signs, survive into the generated code unchanged.\n\n```go\nfunc GenStructFromSchema(schema Schema) string\n```\n\n```go\nfunc Generate(spec *model.Document, opts Configuration) (string, error)\n```\nGenerate uses the Go templating engine to generate all of our server wrappers from the descriptions we've built up above from the schema objects. opts defines\n\n```go\nfunc GenerateAdditionalPropertyBoilerplate(t *template.Template, typeDefs []TypeDefinition) (string, error)\n```\nGenerateAdditionalPropertyBoilerplate generates all the glue code which provides the API for interacting with additional properties and JSON-ification\n\n```go\nfunc GenerateBodyDefinitions(operationID string, bodyOrRef *model.RequestBodyRef, pathItemRef string) ([]RequestBodyDefinition, []TypeDefinition, error)\n```\nGenerateBodyDefinitions turns the Swagger body definitions into a list of our body definitions which will be used for code generation.\n\npathItemRef is the path item's $ref (if any). When non-empty and pointing at an external file, the body type that would otherwise be hoisted locally is replaced by a reference to the imported package's same-named type — the imported package already declares it (with any As/From/Merge methods), so redeclaring locally would just produce an awkward duplicate with package-qualified union elements.\n\n```go\nfunc GenerateCallbackInitiator(t *template.Template, callbackOps []OperationDefinition) (string, error)\n```\nGenerateCallbackInitiator generates the CallbackInitiator -- the client-side analog for OpenAPI callbacks. Structurally identical to GenerateWebhookInitiator but takes the callback OperationDefinitions gathered via CallbackOperationDefinitions, which walk paths/operations/ callbacks rather than spec.Webhooks.\n\n```go\nfunc GenerateClient(t *template.Template, ops []OperationDefinition) (string, error)\n```\nGenerateClient generates the client for the operations.\n\n```go\nfunc GenerateClientWithResponses(t *template.Template, ops []OperationDefinition) (string, error)\n```\nGenerateClientWithResponses generates a client which extends the basic client which does response unmarshaling.\n\n```go\nfunc GenerateEnums(t *template.Template, types []TypeDefinition) (string, error)\n```\n\n```go\nfunc GenerateFormatTypes(t *template.Template) (string, error)\n```\nGenerateFormatTypes declares the formatTypes that schemas resolved to while generating, in formatTypes order.\n\n```go\nfunc GenerateImports(t *template.Template, externalImports []string, packageName string, versionOverride *string) (string, error)\n```\nGenerateImports generates our import statements and package definition.\n\n```go\nfunc GenerateServer(t *template.Template, operations []OperationDefinition) (string, error)\n```\nGenerateServer generates the server: each operation's request and response objects, the ServerInterface, the net/http handler that routes requests to it, and the operations' security requirements.\n\n```go\nfunc GenerateServerResponses(t *template.Template, responses []ResponseDefinition) (string, error)\n```\nGenerateServerResponses generates the server's response types for the spec's reusable responses.\n\n```go\nfunc GenerateStdHTTPReceiver(t *template.Template, prefix string, ops []OperationDefinition) (string, error)\n```\nGenerateStdHTTPReceiver renders the merged stdhttp receiver template (used for both webhook and callback receivers). The caller selects between them by passing prefix \"Webhook\" or \"Callback\" along with the matching OperationDefinitions. The template emits a {Prefix}Receiver interface plus per-operation {Op}{Prefix}Handler factories with query/header parameter binding inline (matching the param-binding machinery used by the path-server middleware).\n\n```go\nfunc GenerateTemplates(templates []string, t *template.Template, ops any) (string, error)\n```\nGenerateTemplates used to generate templates\n\n```go\nfunc GenerateTemplatesIntoBuffer(buf *bytes.Buffer, templates []string, t *template.Template, ops any) error\n```\nGenerateTemplatesIntoBuffer executes the named templates against ops and writes the results to buf, separating consecutive templates with a newline. Rendering into a caller-owned buffer lets a caller compose several passes — e.g. feeding spec-ordered operations to the registration template while the rest of a server uses the pipeline's default order (issue #1887).\n\n```go\nfunc GenerateTypes(t *template.Template, types []TypeDefinition) (string, error)\n```\nGenerateTypes passes a bunch of types to the template engine, and buffers its output into a string.\n\n```go\nfunc GenerateTypesForOperations(t *template.Template, ops []OperationDefinition) (string, error)\n```\nGenerateTypesForOperations generates code for all types produced within operations\n\n```go\nfunc GenerateUnionAndAdditionalProopertiesBoilerplate(t *template.Template, typeDefs []TypeDefinition) (string, error)\n```\n\n```go\nfunc GenerateUnionBoilerplate(t *template.Template, typeDefs []TypeDefinition) (string, error)\n```\n\n```go\nfunc GenerateWebhookInitiator(t *template.Template, webhookOps []OperationDefinition) (string, error)\n```\nGenerateWebhookInitiator generates the WebhookInitiator -- the client-side analog for OpenAPI 3.1 webhooks. It mirrors the path Client (struct + options + per-method calls + request builders) but takes the target URL per-call instead of from a stored Server field. The caller passes only the webhook OperationDefinitions (gathered via WebhookOperationDefinitions); path operations are emitted by the regular Client templates.\n\n```go\nfunc GetParametersImports(params map[string]*model.ParameterRef) (map[string]goImport, error)\n```\n\n```go\nfunc GetRequestBodiesImports(bodies map[string]*model.RequestBodyRef) (map[string]goImport, error)\n```\n\n```go\nfunc GetResponsesImports(responses map[string]*model.ResponseRef) (map[string]goImport, error)\n```\n\n```go\nfunc GetSchemaImports(schemas map[string]*model.SchemaRef, excludeSchemas []string) (map[string]goImport, error)\n```\n\n```go\nfunc GetTypeDefinitionsImports(swagger *model.Document, excludeSchemas []string) (map[string]goImport, error)\n```\n\n```go\nfunc GetUserTemplateText(inputData string) (template string, err error)\n```\nGetUserTemplateText attempts to retrieve the template text from a passed in URL or file path when inputData is more than one line. This function will attempt to load a file first, and if it fails, will try to get the data from the remote endpoint. The timeout for remote download file is 30 seconds.\n\n```go\nfunc GoSchemaImports(schemas ...*model.SchemaRef) (map[string]goImport, error)\n```\n\n```go\nfunc IsGoIdentity(str string) bool\n```\nIsGoIdentity checks if the given string can be used as an identity in the generated code like a type name or constant name.\n\nSee [https://golang.org/ref/spec#Identifiers](https://golang.org/ref/spec#Identifiers)\n\n```go\nfunc IsGoKeyword(str string) bool\n```\nIsGoKeyword returns whether the given string is a go keyword\n\n```go\nfunc IsGoTypeReference(ref string) bool\n```\nIsGoTypeReference takes a $ref value and checks if it has link to go type. #/components/schemas/Foo                     -\u003e true ./local/file.yml#/components/parameters/Bar  -\u003e true ./local/file.yml                             -\u003e false IsGoTypeReference can be used to check whether RefPathToGoType($ref) is possible.\n\n```go\nfunc IsPredeclaredGoIdentifier(str string) bool\n```\nIsPredeclaredGoIdentifier returns whether the given string is a predefined go identifier.\n\nSee [https://golang.org/ref/spec#Predeclared\\_identifiers](https://golang.org/ref/spec#Predeclared_identifiers)\n\n```go\nfunc IsValidGoIdentity(str string) bool\n```\nIsValidGoIdentity checks if the given string can be used as a name of variable, constant, or type.\n\n```go\nfunc IsWholeDocumentReference(ref string) bool\n```\nIsWholeDocumentReference takes a $ref value and checks if it is whole document reference. #/components/schemas/Foo                             -\u003e false ./local/file.yml#/components/parameters/Bar          -\u003e false ./local/file.yml                                     -\u003e true [http://deepmap.com/schemas/document.json](http://deepmap.com/schemas/document.json)             -\u003e true [http://deepmap.com/schemas/document.json#/Foo](http://deepmap.com/schemas/document.json#/Foo)        -\u003e false\n\n```go\nfunc LoadTemplates(src embed.FS, t *template.Template) error\n```\nLoadTemplates loads all of our template files into a text/template. The path of template is relative to the templates directory.\n\n```go\nfunc LowercaseFirstCharacter(str string) string\n```\nLowercaseFirstCharacter Lowercases the first character in a string. This assumes UTF-8, so we have to be careful with unicode, don't treat it as a byte array.\n\n```go\nfunc LowercaseFirstCharacters(str string) string\n```\nLowercase the first upper characters in a string for case of abbreviation. This assumes UTF-8, so we have to be careful with unicode, don't treat it as a byte array.\n\n```go\nfunc OperationImports(ops []OperationDefinition) (map[string]goImport, error)\n```\n\n```go\nfunc OperationSchemaImports(s *Schema) (map[string]goImport, error)\n```\n\n```go\nfunc OrderedParamsFromUri(uri string) []string\n```\nOrderedParamsFromUri returns the argument names, in order, in a given URI string, so for /path/{param1}/{.param2\\*}/{?param3}, it would return param1, param2, param3\n\n```go\nfunc ParseGoImportExtension(v *model.SchemaRef) (*goImport, error)\n```\n\n```go\nfunc PathToTypeName(path []string) string\n```\nPathToTypeName converts a path, like Object/field1/nestedField into a go type name.\n\n```go\nfunc RefPathToGoType(refPath string) (string, error)\n```\nRefPathToGoType takes a $ref value and converts it to a Go typename. #/components/schemas/Foo -\u003e Foo #/components/parameters/Bar -\u003e Bar #/components/responses/Baz -\u003e Baz Remote components (document.json#/Foo) are supported if they present in --import-mapping URL components ([http://deepmap.com/schemas/document.json#/Foo](http://deepmap.com/schemas/document.json#/Foo)) are supported if they present in --import-mapping Remote and URL also support standard local paths even though the spec doesn't mention them.\n\n```go\nfunc RefPathToObjName(refPath string) string\n```\nRefPathToObjName returns the name of referenced object without changes.\n\n\t#/components/schemas/Foo -\u003e Foo\n\t#/components/parameters/Bar -\u003e Bar\n\t#/components/responses/baz_baz -\u003e baz_baz\n\tdocument.json#/Foo -\u003e Foo\n\thttp://deepmap.com/schemas/document.json#/objObj -\u003e objObj\n\nDoes not check refPath correctness.\n\n```go\nfunc ResolveNames(schemas []*GatheredSchema) map[string]string\n```\nResolveNames takes the gathered schemas and assigns unique Go type names to each. It returns a map from the schema's path string to the resolved Go type name.\n\n```go\nfunc SanitizeCode(goCode string) string\n```\nSanitizeCode runs sanitizers across the generated Go code to ensure the generated code will be able to compile.\n\n```go\nfunc SanitizeEnumNames(enumNames, enumValues []string) map[string]string\n```\nSanitizeEnumNames fixes illegal chars in the enum names and removes duplicates\n\n```go\nfunc SanitizeGoIdentifier(str string) string\n```\nSanitizeGoIdentifier replaces illegal runes in the given string so that it is a valid Go identifier. Unlike SanitizeGoIdentity, it does not prefix reserved keywords or predeclared identifiers. This is useful for contexts where the name must be a valid identifier but is not used as a Go symbol (e.g. net/http ServeMux wildcard names).\n\n```go\nfunc SanitizeGoIdentity(str string) string\n```\nSanitizeGoIdentity deletes and replaces the illegal runes in the given string to use the string as a valid identity. It also prefixes reserved keywords and predeclared identifiers with an underscore.\n\n```go\nfunc SchemaHasAdditionalProperties(schema *model.Schema) bool\n```\nAccording to the spec, additionalProperties may be true, false, or a schema. If not present, true is implied. If it's a schema, true is implied. If it's false, no additional properties are allowed. We're going to act a little differently, in that if you want additionalProperties code to be generated, you must specify an additionalProperties type If additionalProperties it true/false, this field will be non-nil.\n\n```go\nfunc SchemaNameToTypeName(name string) string\n```\nSchemaNameToTypeName converts a Schema name to a valid Go type name. It converts to camel case, and makes sure the name is valid in Go\n\n```go\nfunc SetGlobalStateSpec(spec *model.Document)\n```\n\n```go\nfunc SortedMapKeys[T any](m map[string]T) []string\n```\nSortedMapKeys takes a map with keys of type string and returns a slice of those keys sorted lexicographically.\n\n```go\nfunc SortedSchemaKeys(dict map[string]*model.SchemaRef) []string\n```\nSortedSchemaKeys returns the keys of the given SchemaRef dictionary in sorted order, since Golang scrambles dictionary keys. This isn't a generic key sort, because we support an extension to grant specific orders to schemas to help control output ordering.\n\n```go\nfunc StringToGoComment(in string) string\n```\nStringToGoComment renders a possible multi-line string as a valid Go-Comment. Each line is prefixed as a comment.\n\n```go\nfunc StringToGoString(in string) string\n```\nStringToGoString takes an arbitrary string and converts it to a valid Go string literal, including the quotes. For instance, \\`foo \"bar\"\\` would be converted to \\`\"foo \\\\\"bar\\\\\"\"\\`.\n\nstrconv.Quote escapes backslashes, newlines and other control characters too, so untrusted spec text cannot break out of the generated string literal.\n\n```go\nfunc StringWithTypeNameToGoComment(in, typeName string) string\n```\nStringWithTypeNameToGoComment renders a possible multi-line string as a valid Go-Comment, including the name of the type being referenced. Each line is prefixed as a comment.\n\n```go\nfunc SwaggerUriToStdHttpUri(uri string) string\n```\nSwaggerUriToStdHttpUri converts a swagger style path URI with parameters to a net/http ServeMux compatible path URI. Parameter names are sanitized to be valid Go identifiers, as required by ServeMux wildcard segments. A parameter that shares its segment with literal text, such as \"{Sid}.json\", is widened to a wildcard occupying the whole segment; the handler checks the literal text and strips it before binding. Valid input parameters are:\n\n\t{param}\n\t{param*}\n\t{.param}\n\t{.param*}\n\t{;param}\n\t{;param*}\n\t{?param}\n\t{?param*}\n\n```go\nfunc ToCamelCase(str string) string\n```\nToCamelCase will convert query-arg style strings to CamelCase. We will use \\`., -, +, :, ;, \\_, ~, ' ', (, ), {, }, \\[, ]\\` as valid delimiters for words. So, \"word.word-word+word:word;word\\_word~word word(word)word{word}\\[word]\" would be converted to WordWordWordWordWordWordWordWordWordWordWordWordWord\n\n```go\nfunc ToCamelCaseWithDigits(s string) string\n```\nToCamelCaseWithDigits function will convert query-arg style strings to CamelCase. We will use \\`., -, +, :, ;, \\_, ~, ' ', (, ), {, }, \\[, ]\\` as valid delimiters for words. The difference of ToCamelCase that letter after a number becomes capitalized. So, \"word.word-word+word:word;word\\_word~word word(word)word{word}\\[word]3word\" would be converted to WordWordWordWordWordWordWordWordWordWordWordWordWord3Word\n\n```go\nfunc ToCamelCaseWithInitialism(str string) string\n```\n\n```go\nfunc ToCamelCaseWithInitialisms(s string) string\n```\nToCamelCaseWithInitialisms function will convert query-arg style strings to CamelCase with initialisms in uppercase. So, httpOperationId would be converted to HTTPOperationID\n\n```go\nfunc TypeDefinitionsEquivalent(t1, t2 TypeDefinition) bool\n```\nTypeDefinitionsEquivalent checks for equality between two type definitions, but not every field is considered. We only want to know if they are fundamentally the same type.\n\n```go\nfunc UppercaseFirstCharacter(str string) string\n```\nUppercaseFirstCharacter Uppercases the first character in a string. This assumes UTF-8, so we have to be careful with unicode, don't treat it as a byte array.\n\n```go\nfunc UppercaseFirstCharacterWithPkgName(str string) string\n```\nUppercase the first character in a identifier with pkg name. This assumes UTF-8, so we have to be careful with unicode, don't treat it as a byte array.\n\n```go\nfunc ValidateOpenAPIVersion(spec *model.Document) error\n```\nValidateOpenAPIVersion rejects a document that isn't OpenAPI 3: an OpenAPI 2.0 (Swagger) document, which loads as an OpenAPI 3 document with nothing in it that generation understands, or one that declares another version. Without it, such a document fails partway through generation, on whichever part of it first differs from OpenAPI 3. A document that declares no version is taken to be OpenAPI 3, as a file of shared definitions often is.\n\n```go\nfunc ValidateSpec(spec *model.Document) error\n```\nValidateSpec walks a loaded OpenAPI document and rejects values that cannot be represented in the generated Go source.\n\noapi-codegen copies many spec strings verbatim into the code it emits: parameter names, property names, media types and enum values become Go string literals and struct-tag contents; the \\`x-go-name\\`/\\`x-go-type\\`/\\`x-go-type-name\\` extensions become Go identifiers and type expressions. A value containing a quote, a backtick or a control character (such as a newline) would produce Go that does not compile. Catching that here turns an obscure compiler error on generated code into a clear message that points at the offending part of the spec.\n\nIt is meant to run after any overlay has been applied and after tag/operation filtering and component pruning, so only values that will actually be emitted are checked. \\`$ref\\`s are not followed: every ref resolves to a component that is validated at its own definition, and the contents of external documents are never copied into the generated output, so they cannot affect it.\n\n```go\nfunc ValidateStdHTTPPath(path string) error\n```\nValidateStdHTTPPath reports whether one OpenAPI path can be rewritten into a ServeMux pattern. A parameter may share its segment with literal text; adjacent parameters in one segment cannot, because nothing marks where one ends and the next begins.\n\n```go\nfunc ValidateStdHTTPPaths(spec *model.Document) error\n```\nValidateStdHTTPPaths validates every path in the document for ServeMux. Paths whose operations have all been removed (e.g. by tag or operation-id filtering) emit no routes, so they are skipped.\n\nA mixed segment is widened to a whole-segment wildcard. Two operations that then register as the same pattern, or whose widened patterns overlap, are rejected here: ServeMux would panic when the handler is constructed. Overlaps between paths that were already legal ServeMux patterns are left alone, matching generation from before mixed segments were accepted.\n\n## Types\n\n```go\ntype AdditionalImport struct {\n\tAlias   string `yaml:\"alias,omitempty\"`\n\tPackage string `yaml:\"package\"`\n}\n```\n\n```go\ntype ClientMethodVariant struct {\n\t// Suffix is appended to the OperationId to form the method name and its\n\t// request-builder name: \"\" or \"WithBody\" for the generic variant,\n\t// \"WithJSONBody\" etc. for a typed-body variant.\n\tSuffix string\n\n\t// ArgsDecl is the parameter-declaration fragment that follows the leading\n\t// ctx/server parameter, with a leading comma when non-empty, e.g.\n\t// \", id string, params *FooParams, contentType string, body io.Reader\".\n\tArgsDecl string\n\n\t// CallArgs is the argument fragment passed when a method forwards to\n\t// another function (the request builder, or the wrapped client method),\n\t// with a leading comma when non-empty, e.g. \", id, params, contentType, body\".\n\tCallArgs string\n\n\t// InterfaceComment / MethodComment are the fully rendered Godoc comments\n\t// (including any deprecation notice) for the ClientInterface declaration and\n\t// the *Client method implementation respectively. The interface form places\n\t// a blank \"//\" line before the deprecation notice; the implementation form\n\t// does not -- matching the historical output of both sites.\n\tInterfaceComment string\n\tMethodComment    string\n\n\t// WithResponseInterfaceComment / WithResponseMethodComment are the analogous\n\t// comments for the ClientWithResponsesInterface declaration and the\n\t// *ClientWithResponses method implementation.\n\tWithResponseInterfaceComment string\n\tWithResponseMethodComment    string\n}\n```\nClientMethodVariant is a precomputed view of one generated client method. Every operation yields a generic variant (the bodyless method, or the \"WithBody\" method taking an io.Reader when the operation has a request body) followed by one typed-body variant per request body that RequestBodyDefinition.IsSupportedByClient reports.\n\nAll naming, signature, and comment decisions are made here in Go so that client.tmpl and client-with-responses.tmpl can render linearly, without the repeated \\`{{if .HasBody}}WithBody{{end}}\\` suffix dance and four-fragment signature assembly the templates previously carried at every declaration, implementation, and call site.\n\n```go\ntype Configuration struct {\n\t// PackageName to generate the code under\n\tPackageName string `yaml:\"package\"`\n\t// Generate specifies which supported output formats to generate\n\tGenerate GenerateOptions `yaml:\"generate,omitempty\"`\n\t// OutputOptions are used to modify the output code in some way.\n\tOutputOptions OutputOptions `yaml:\"output-options,omitempty\"`\n\t// ImportMapping specifies the golang package path for each external reference\n\tImportMapping map[string]string `yaml:\"import-mapping,omitempty\"`\n\t// AdditionalImports defines any additional Go imports to add to the generated code\n\tAdditionalImports []AdditionalImport `yaml:\"additional-imports,omitempty\"`\n\t// NoVCSVersionOverride allows overriding the version of the application for cases where no Version Control System (VCS) is available when building, for instance when using a Nix derivation.\n\t// See documentation for how to use it in examples/no-vcs-version-override/README.md\n\tNoVCSVersionOverride *string `yaml:\"-\"`\n}\n```\nConfiguration defines code generation customizations\n\n```go\nfunc (o Configuration) UpdateDefaults() Configuration\n```\nUpdateDefaults sets reasonable default values for unset fields in Configuration\n\n```go\nfunc (o Configuration) Validate() error\n```\nValidate checks whether Configuration represent a valid configuration\n\n```go\nfunc (o Configuration) Warnings() map[string]string\n```\nWarnings returns informational diagnostics about cross-field configuration combinations that aren't outright errors but are likely to produce generated code that doesn't compile, or that requires the user to know a specific multi-config convention. The warnings are surfaced on stderr by the CLI so the user notices before running \\`go build\\`.\n\n```go\ntype Constants struct {\n\t// EnumDefinitions holds type and value information for all enums\n\tEnumDefinitions []EnumDefinition\n\t// SkipEnumValidate suppresses generation of the `Valid()` method on\n\t// enum types. Mirrors OutputOptions.SkipEnumValidate.\n\tSkipEnumValidate bool\n}\n```\n\n```go\ntype Discriminator struct {\n\t// maps discriminator value to go type\n\tMapping map[string]string\n\n\t// JSON property name that holds the discriminator\n\tProperty string\n\n\t// ValueType is the JSON type of the discriminator property's values:\n\t// \"boolean\", \"integer\" or \"number\" when the schemas declare one, and \"\"\n\t// for the usual string discriminator.\n\tValueType string\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (d *Discriminator) IsString() bool\n```\nIsString reports whether the discriminator's values are JSON strings.\n\n```go\nfunc (d *Discriminator) JSONTag() string\n```\n\n```go\nfunc (d *Discriminator) SwitchType() string\n```\nSwitchType returns the Go type ValueByDiscriminator decodes the discriminator into and switches on: int64 or float64 for an integer or number discriminator, and \"\" when it compares the value's JSON text.\n\n```go\ntype DiscriminatorCase struct {\n\t// Value is the discriminator value that selects this element, e.g. \"GitDiffFile\".\n\tValue string\n\t// Method is the union element method suffix, e.g. \"ExternalRef0GitDiffFile\",\n\t// so the generated call is t.As\u003cMethod\u003e().\n\tMethod string\n}\n```\nDiscriminatorCase is one arm of a union's ValueByDiscriminator() switch: a discriminator value and the As\\* helper it dispatches to.\n\n```go\ntype DiscriminatorStamp struct {\n\t// Value is the discriminator value mapped to this union element.\n\tValue string\n\t// Literal is Value written as a JSON and Go literal of the\n\t// discriminator's type: \"cat\" for a string discriminator, false for a\n\t// boolean one (issue #1619).\n\tLiteral string\n\t// Property is the union struct's own discriminator field, matched by\n\t// JSON property name, when it declares one; nil when it doesn't.\n\tProperty *Property\n\t// JSONPatch is the JSON object literal merged into the union data,\n\t// e.g. {\"code\":\"resource_exists\"}. Safe to embed in a backtick string\n\t// literal: spec validation rejects discriminator property names and\n\t// mapping keys containing quotes, backticks or control characters.\n\tJSONPatch string\n}\n```\nDiscriminatorStamp describes how the generated From\\*/Merge\\* union helpers record the discriminator value for one union element.\n\nThe value is always merged into the marshaled JSON via JSONPatch, so Discriminator() and ValueByDiscriminator() — which read the union data — see it immediately after From\\*/Merge\\*. Stamping at the JSON level stays correct regardless of how the variant declares the property — pointer, named enum type, renamed or absent field, or a type in an imported package — none of which is knowable from the union's side (see issue #2297). When the union struct itself declares the discriminator property, the helpers additionally assign Value to that field: its JSON rendering overwrites the union data in MarshalJSON, so the field is load-bearing.\n\n```go\ntype EnumDefinition struct {\n\t// Schema is the scheme of a type which has a list of enum values, eg, the\n\t// \"container\" of the enum.\n\tSchema Schema\n\t// TypeName is the name of the enum's type, usually aliased from something.\n\tTypeName string\n\t// ValueWrapper wraps the value. It's used to conditionally apply quotes\n\t// around strings.\n\tValueWrapper string\n\t// PrefixTypeName determines if the enum value is prefixed with its TypeName.\n\t// This is set to true when this enum conflicts with another in terms of\n\t// TypeNames or when explicitly requested via the\n\t// `output-options.always-prefix-enum-values` option.\n\tPrefixTypeName bool\n\t// contains filtered or unexported fields\n}\n```\nEnumDefinition holds type information for enum\n\n```go\nfunc (e *EnumDefinition) GetValues() map[string]string\n```\nGetValues generates enum names in a way to minimize global conflicts\n\n```go\ntype FieldDescriptor struct {\n\tRequired bool   // Is the schema required? If not, we'll pass by pointer\n\tGoType   string // The Go type needed to represent the json type.\n\tGoName   string // The Go compatible type name for the type\n\tJsonName string // The json type name for the type\n\tIsRef    bool   // Is this schema a reference to predefined object?\n}\n```\n\n```go\ntype FormatMapping struct {\n\tDefault SimpleTypeSpec            `yaml:\"default\" json:\"default\"`\n\tFormats map[string]SimpleTypeSpec `yaml:\"formats,omitempty\" json:\"formats,omitempty\"`\n}\n```\nFormatMapping defines the default Go type and format-specific overrides for an OpenAPI type.\n\n```go\nfunc (fm FormatMapping) Resolve(format string) SimpleTypeSpec\n```\nResolve returns the SimpleTypeSpec for a given format string. If the format has a specific mapping, that is returned; otherwise the default is used.\n\n```go\ntype GatheredSchema struct {\n\tPath           SchemaPath\n\tContext        SchemaContext\n\tRef            string        // $ref string if this is a reference\n\tSchema         *model.Schema // The resolved schema value\n\tOperationID    string        // Enclosing operation's ID, if any\n\tContentType    string        // Media type, if from request/response body\n\tStatusCode     string        // HTTP status code, if from a response\n\tParamIndex     int           // Parameter index within an operation\n\tComponentName  string        // The component name (e.g., \"Bar\" for components/schemas/Bar)\n\tGoNameOverride string        // x-go-name override from the component or its parent container\n}\n```\nGatheredSchema represents a schema discovered during the gather pass, along with its document location and context metadata.\n\n```go\nfunc GatherSchemas(spec *model.Document, opts Configuration) []*GatheredSchema\n```\nGatherSchemas 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.\n\n```go\nfunc (gs *GatheredSchema) FormatPath() string\n```\nFormatPath returns a human-readable representation of the path for debugging.\n\n```go\nfunc (gs *GatheredSchema) IsComponentSchema() bool\n```\nIsComponentSchema returns true if this schema came from components/schemas.\n\n```go\ntype GenerateOptions struct {\n\t// Server specifies whether to generate the net/http server\n\tServer bool `yaml:\"server,omitempty\"`\n\t// Client specifies whether to generate client boilerplate\n\tClient bool `yaml:\"client,omitempty\"`\n\t// Models specifies whether to generate type definitions\n\tModels bool `yaml:\"models,omitempty\"`\n}\n```\nGenerateOptions specifies which supported output formats to generate.\n\n```go\nfunc (g GenerateOptions) AnyOperationGenerator() bool\n```\nAnyOperationGenerator returns true if any code generator that emits per-operation Go code (the client or the server) is enabled. Used to detect configurations where operation-derived type references would be emitted without a corresponding declaration.\n\n```go\nfunc (oo GenerateOptions) Validate() map[string]string\n```\n\n```go\nfunc (oo GenerateOptions) Warnings() map[string]string\n```\n\n```go\ntype InitiatorTemplateData struct {\n\tPrefix      string // \"Webhook\" or \"Callback\"\n\tPrefixLower string // lowercase form of Prefix, for prose\n\tOperations  []OperationDefinition\n}\n```\nInitiatorTemplateData is the input to the shared webhook / callback initiator template. Prefix selects between \"Webhook\" and \"Callback\" (and the lowercase form for prose), so a single template handles both the OpenAPI 3.1 webhook and OpenAPI callback client-side initiators.\n\n```go\nfunc NewInitiatorTemplateData(prefix string, ops []OperationDefinition) (InitiatorTemplateData, error)\n```\nNewInitiatorTemplateData builds the template input for the given prefix (\"Webhook\" or \"Callback\") and operation list.\n\nInitiator operations must not carry path parameters: the initiator takes an opaque targetURL per call, so there is no route template to substitute into, and the generated request builders accept no path arguments while the initiator methods would forward them (producing uncompilable code). Webhook/CallbackOperationDefinitions reject in:path parameters at extraction time; this check is defense in depth for direct callers of the exported API.\n\n```go\ntype NameNormalizer func(string) string\n```\nNameNormalizer is a function that takes a type name, and returns that type name converted into a different format.\n\nThis may be an Operation ID i.e. \\`retrieveUserRequests\\` or a Schema name i.e. \\`BigBlockOfCheese\\`\n\nNOTE: this must return a string that can be used as a valid Go type name\n\n```go\ntype NameNormalizerFunction string\n```\n\n```go\nconst (\n\t// NameNormalizerFunctionUnset is the default case, where the `name-normalizer` option hasn't been set. This will use the `ToCamelCase` function.\n\t//\n\t// See the docs for `NameNormalizerFunctionToCamelCase` for more details.\n\tNameNormalizerFunctionUnset NameNormalizerFunction = \"\"\n\t// NameNormalizerFunctionToCamelCase will use the `ToCamelCase` function.\n\t//\n\t// For instance:\n\t//\n\t// - `getHttpPet`   =\u003e `GetHttpPet`\n\t// - `OneOf2things` =\u003e `OneOf2things`\n\tNameNormalizerFunctionToCamelCase NameNormalizerFunction = \"ToCamelCase\"\n\t// NameNormalizerFunctionToCamelCaseWithDigits will use the `NameNormalizerFunctionToCamelCaseWithDigits` function.\n\t//\n\t// For instance:\n\t//\n\t// - `getHttpPet`   =\u003e `GetHttpPet`\n\t// - `OneOf2things` =\u003e `OneOf2Things`\n\tNameNormalizerFunctionToCamelCaseWithDigits NameNormalizerFunction = \"ToCamelCaseWithDigits\"\n\t// NameNormalizerFunctionToCamelCaseWithInitialisms will use the `NameNormalizerFunctionToCamelCaseWithInitialisms` function.\n\t//\n\t// For instance:\n\t//\n\t// - `getHttpPet`   =\u003e `GetHTTPPet`\n\t// - `OneOf2things` =\u003e `OneOf2things`\n\tNameNormalizerFunctionToCamelCaseWithInitialisms NameNormalizerFunction = \"ToCamelCaseWithInitialisms\"\n)\n```\n\n```go\ntype NameNormalizerMap map[NameNormalizerFunction]NameNormalizer\n```\n\n```go\nfunc (m NameNormalizerMap) Options() []string\n```\n\n```go\ntype ObjectCodec struct {\n\t// contains filtered or unexported fields\n}\n```\nObjectCodec binds and styles an object parameter: an object's properties are key-value pairs, which the style lays out in the value.\n\n```go\ntype OperationDefinition struct {\n\t// OperationId is the `operationId` field from the OpenAPI Specification, after going through a `nameNormalizer`, and will be used to generate function names\n\tOperationId string\n\n\tPathParams      []ParameterDefinition // Parameters in the path, eg, /path/:param\n\tHeaderParams    []ParameterDefinition // Parameters in HTTP headers\n\tQueryParams     []ParameterDefinition // Parameters in the query, /path?param\n\tCookieParams    []ParameterDefinition // Parameters in cookies\n\tTypeDefinitions []TypeDefinition      // These are all the types we need to define for this operation\n\tBodyRequired    bool\n\tBodies          []RequestBodyDefinition // The list of bodies for which to generate handlers.\n\tResponses       []ResponseDefinition    // The list of responses that can be accepted by handlers.\n\tSummary         string                  // Summary string from Swagger, used to generate a comment\n\tMethod          string                  // GET, POST, DELETE, etc.\n\tPath            string                  // The Swagger path for the operation, like /resource/{id}\n\t// SpecOrder is the source line on which this operation's path is\n\t// declared in the spec, used to register routes in the order the paths\n\t// appear in the spec rather than sorted (issue #1887). Zero when the\n\t// source location is unavailable (e.g. a programmatically-built spec),\n\t// in which case route registration falls back to the default order.\n\tSpecOrder   int\n\tSpec        *model.Operation\n\tIsAlias     bool   // True when this path is a $ref alias of another path item\n\tAliasTarget string // When IsAlias is true, this is the OperationId of the canonical operation (for route registration to reference the correct wrapper)\n\tPathItemRef string // The path item's $ref (if any); used to qualify externally-loaded schemas referenced from this operation's responses\n\t// SecurityRequirements are the ways a request may satisfy the\n\t// operation's security, any one of which is enough. Empty when the\n\t// operation declares no security.\n\tSecurityRequirements []SecurityRequirementDefinition\n\n\t// IsWebhook is true when this OperationDefinition was sourced from\n\t// spec.Webhooks (OpenAPI 3.1+). Webhook operations have no path\n\t// template; the target URL is supplied per-call by the initiator.\n\tIsWebhook bool\n\t// WebhookName is the spec.Webhooks map key when IsWebhook is true.\n\tWebhookName string\n\n\t// IsCallback is true when this OperationDefinition was sourced from\n\t// a parent operation's `callbacks:` block (OpenAPI 3.0+). Callback\n\t// operations have no path template at codegen time; the target URL\n\t// is the runtime callback URL discovered via the spec's callback\n\t// expression (typically a field on the parent operation's request\n\t// body) and is supplied per-call by the initiator.\n\tIsCallback bool\n\t// CallbackName is the parent operation's `callbacks:` map key\n\t// (e.g. \"treePlanted\") when IsCallback is true.\n\tCallbackName string\n}\n```\nOperationDefinition describes an Operation\n\n```go\nfunc CallbackOperationDefinitions(swagger *model.Document) ([]OperationDefinition, error)\n```\nCallbackOperationDefinitions extracts OpenAPI callback operations from spec.Paths.\\\u003cpath\u003e.\\\u003cmethod\u003e.Callbacks into the same OperationDefinition shape used for path operations, so they flow through the same downstream pipeline (body / response generation, type definitions, etc.) but are routed to callback-specific templates.\n\nCallbacks have been part of the OpenAPI spec since 3.0, so this is not gated on version: any spec that declares callbacks gets them generated. The spec shape:\n\n\tpaths:\n\t  /api/plant_tree:\n\t    post:\n\t      operationId: PlantTree\n\t      callbacks:\n\t        treePlanted:                 # the callback map key\n\t          '{$request.body#/url}':    # the runtime URL expression\n\t            post:\n\t              operationId: TreePlanted\n\nEach leaf operation (the inner \\`post:\\` above) becomes one OperationDefinition with IsCallback=true and CallbackName set to the outer map key (\"treePlanted\"). The codegen does not interpret the URL expression itself -- the caller of the generated CallbackInitiator supplies the resolved target URL at runtime (the same way it would for a webhook).\n\n```go\nfunc OperationDefinitions(swagger *model.Document) ([]OperationDefinition, error)\n```\n\n```go\nfunc WebhookOperationDefinitions(swagger *model.Document) ([]OperationDefinition, error)\n```\nWebhookOperationDefinitions extracts OpenAPI 3.1+ webhook operations from swagger.Webhooks into the same OperationDefinition shape used for path operations, so they flow through the same downstream pipeline (body / response generation, type definitions, etc.) but are routed to webhook-specific templates.\n\nWebhooks is only populated for OpenAPI 3.1+ documents, so a missing/empty map naturally short-circuits this for 3.0 specs without an explicit version check.\n\nThe result mirrors OperationDefinitions in structure, minus the path-alias logic (webhooks have no path template) and the path- parameter extraction (webhooks have no path params).\n\n```go\nfunc (o *OperationDefinition) AllParams() []ParameterDefinition\n```\nAllParams returns all parameters\n\n```go\nfunc (o OperationDefinition) ClientMethodVariants() []ClientMethodVariant\n```\nClientMethodVariants returns the precomputed client method variants for this operation: the generic variant first, then one per client-supported request body. It is consumed by client.tmpl and client-with-responses.tmpl.\n\n```go\nfunc (o *OperationDefinition) DeprecationComment() string\n```\nDeprecationComment returns a Go-style deprecation comment if the operation is deprecated, otherwise returns an empty string.\n\n```go\nfunc (o OperationDefinition) GenerateFunctionComment(originalFunctionName string, functionSuffix string, isFunctionWithResponses bool) string\n```\nGenerateFunctionComment returns a full Godoc-style multi-line comment with: - the Summary, if present, as the first line of the comment - if not present, an indication of the HTTP call this corresponds with - the Description, if present - whether this function takes a body and a content type\n\nTakes originalFunctionName (the OperationId or the function name being generated for this Operation), a suffix (if necessary) and whether this is being generated for ClientInterface or ClientWithResponsesInterface\n\n```go\nfunc (o OperationDefinition) GenericClientVariant() ClientMethodVariant\n```\nGenericClientVariant returns the generic (bodyless or \"WithBody\") client method variant, which every operation always has as its first variant. The request-builder template uses it for the New{OperationId}Request{Suffix} signature.\n\n```go\nfunc (o *OperationDefinition) GetResponseTypeDefinitions() ([]ResponseTypeDefinition, error)\n```\nGetResponseTypeDefinitions produces a list of type definitions for a given Operation for the response types which we know how to parse. These will be turned into fields on a response object for automatic deserialization of responses in the generated Client code. See \"client-with-responses.tmpl\".\n\n```go\nfunc (o *OperationDefinition) HandlerName() string\n```\nHandlerName returns the OperationId of the server-side handler method that serves the operation. For alias operations this is the canonical operation's ID, since the alias doesn't generate its own handler.\n\n```go\nfunc (o *OperationDefinition) HasBody() bool\n```\nHasBody is called by the template engine to determine whether to generate body marshaling code on the client. This is true for all body types, whether we generate types for them.\n\n```go\nfunc (o *OperationDefinition) HasMaskedRequestContentTypes() bool\n```\n\n```go\nfunc (o *OperationDefinition) Params() []ParameterDefinition\n```\nParams returns the list of all parameters except Path parameters. Path parameters are handled differently from the rest, since they're mandatory.\n\n```go\nfunc (o OperationDefinition) RequiresParamObject() bool\n```\nIf we have parameters other than path parameters, they're bundled into an object. Returns true if we have any of those. This is used from the template engine.\n\n```go\nfunc (o OperationDefinition) SecurityRequirementsLiteral() string\n```\nSecurityRequirementsLiteral returns the operation's security requirements as a \\[]SecurityRequirement composite literal with the type elided. This is used from the template engine.\n\n```go\nfunc (o OperationDefinition) SourceName() string\n```\nSourceName returns WebhookName when IsWebhook, CallbackName when IsCallback, or empty otherwise. Templates use this to label the emitted handler uniformly without branching on which kind of source the operation came from.\n\n```go\nfunc (o *OperationDefinition) SummaryAsComment(prefix string) string\n```\nSummaryAsComment returns the Operations summary as a Godoc-style multi line comment\n\n```go\ntype OutputOptions struct {\n\t// Whether to skip go imports on the generated code\n\tSkipFmt bool `yaml:\"skip-fmt,omitempty\"`\n\t// Whether to skip pruning unused components on the generated code\n\tSkipPrune bool `yaml:\"skip-prune,omitempty\"`\n\t// SkipFormatTypes stops the models from declaring the types that string\n\t// formats map to by default (OpenAPIDate, OpenAPIDuration, OpenAPIEmail\n\t// and OpenAPIFile). Set it when another generated file in the same\n\t// package already declares them, so they aren't declared twice.\n\tSkipFormatTypes bool `yaml:\"skip-format-types,omitempty\"`\n\t// When set to true, always prefix enum values with their type name instead of only\n\t// when typenames would be conflicting.\n\tAlwaysPrefixEnumValues bool `yaml:\"always-prefix-enum-values,omitempty\"`\n\t// AllowUnexportedStructFieldNames makes it possible to output structs that have fields that are unexported.\n\t//\n\t// This is expected to be used in conjunction with `x-go-name` and `x-oapi-codegen-only-honour-go-name` to override the resulting output field name, and `x-oapi-codegen-extra-tags` to not produce JSON tags for `encoding/json`, such as:\n\t//\n\t//  ```yaml\n\t//   id:\n\t//     type: string\n\t//     x-go-name: accountIdentifier\n\t//     x-oapi-codegen-extra-tags:\n\t//       json: \"-\"\n\t//     x-oapi-codegen-only-honour-go-name: true\n\t//   ```\n\t//\n\t// NOTE that this can be confusing to users of your OpenAPI specification, who may see a field present and therefore be expecting to see/use it in the request/response, without understanding the nuance of how `oapi-codegen` generates the code.\n\tAllowUnexportedStructFieldNames bool `yaml:\"allow-unexported-struct-field-names,omitempty\"`\n\t// SkipEnumValidate disables the generation of the `Valid()` method on\n\t// enum types. By default each generated enum type includes a `Valid()\n\t// bool` method which returns true when the value matches one of the\n\t// defined constants; set this to true to suppress that method when it\n\t// conflicts with user-defined methods of the same name.\n\tSkipEnumValidate bool `yaml:\"skip-enum-validate,omitempty\"`\n\t// SkipEnumViaOneOf disables detection of the OpenAPI 3.1 enum-via-oneOf\n\t// idiom: a schema with `type: string|integer` and `oneOf:` members that\n\t// each carry `const` + `title` will normally be emitted as a Go enum with\n\t// named constants. Set this to true to fall through to the standard union\n\t// generator instead.\n\tSkipEnumViaOneOf bool `yaml:\"skip-enum-via-oneof,omitempty\"`\n\t// LenientUnionAccessors makes a union's As* methods ignore the properties\n\t// a variant with `additionalProperties: false` doesn't declare, as they\n\t// do for any other variant. By default such a variant's As* returns an\n\t// error for a property that neither the variant nor anything else in the\n\t// union's object declares, so that data of another variant isn't taken\n\t// for it.\n\tLenientUnionAccessors bool `yaml:\"lenient-union-accessors,omitempty\"`\n\t// Only include operations that have one of these tags. Ignored when empty.\n\tIncludeTags []string `yaml:\"include-tags,omitempty\"`\n\t// Exclude operations that have one of these tags. Ignored when empty.\n\tExcludeTags []string `yaml:\"exclude-tags,omitempty\"`\n\t// Only include operations that have one of these operation-ids. Ignored when empty.\n\tIncludeOperationIDs []string `yaml:\"include-operation-ids,omitempty\"`\n\t// Exclude operations that have one of these operation-ids. Ignored when empty.\n\tExcludeOperationIDs []string `yaml:\"exclude-operation-ids,omitempty\"`\n\t// Override built-in templates from user-provided files\n\tUserTemplates map[string]string `yaml:\"user-templates,omitempty\"`\n\n\t// Exclude from generation schemas with given names. Ignored when empty.\n\tExcludeSchemas []string `yaml:\"exclude-schemas,omitempty\"`\n\t// The suffix used for responses types\n\tResponseTypeSuffix string `yaml:\"response-type-suffix,omitempty\"`\n\t// Override the default generated client type with the value\n\tClientTypeName string `yaml:\"client-type-name,omitempty\"`\n\t// AdditionalInitialisms is a list of additional initialisms to use when generating names.\n\t// NOTE that this has no effect unless the `name-normalizer` is set to `ToCamelCaseWithInitialisms`\n\tAdditionalInitialisms []string `yaml:\"additional-initialisms,omitempty\"`\n\t// StreamingContentTypes are regex patterns matched against response\n\t// Content-Type to decide when to generate a flush-per-chunk streaming\n\t// response path. User-provided patterns are merged with the defaults\n\t// (text/event-stream, application/jsonl, application/x-ndjson); invalid\n\t// regexes fail Validate().\n\tStreamingContentTypes []string `yaml:\"streaming-content-types,omitempty\"`\n\t// Whether to generate nullable type for nullable fields\n\tNullableType bool `yaml:\"nullable-type,omitempty\"`\n\n\t// DisableTypeAliasesForType allows defining which OpenAPI `type`s will explicitly not use type aliases\n\t// Currently supports:\n\t//   \"array\"\n\tDisableTypeAliasesForType []string `yaml:\"disable-type-aliases-for-type\"`\n\n\t// SkipResponseBodyGetters decides whether to generate getter methods for response bodies.\n\tSkipResponseBodyGetters bool `yaml:\"skip-response-body-getters,omitempty\"`\n\n\t// NameNormalizer is the method used to normalize Go names and types, for instance converting the text `MyApi` to `MyAPI`. Corresponds with the constants defined for `codegen.NameNormalizerFunction`\n\tNameNormalizer string `yaml:\"name-normalizer,omitempty\"`\n\n\t// Overlay defines configuration for the OpenAPI Overlay (https://github.com/OAI/Overlay-Specification) to manipulate the OpenAPI specification before generation. This allows modifying the specification without needing to apply changes directly to it, making it easier to keep it up-to-date.\n\tOverlay OutputOptionsOverlay `yaml:\"overlay\"`\n\n\t// StructTags configures which struct tags are generated on struct fields and how their\n\t// values are rendered. Each entry is a tag name plus a Go text/template evaluated\n\t// against the field (see StructTagInfo for the available variables). Entries are\n\t// merged by name on top of the defaults, so a `json` entry replaces the default json\n\t// template while new names add tags. Tags render in alphabetical order; a template\n\t// that renders to the empty string suppresses that tag on that field.\n\tStructTags StructTagsConfig `yaml:\"struct-tags,omitempty\"`\n\n\t// ClientResponseBytesFunction decides whether to enable the generation of a `Bytes()` method on response objects for `ClientWithResponses`\n\tClientResponseBytesFunction bool `yaml:\"client-response-bytes-function,omitempty\"`\n\n\t// SkipClientResponseContentType disables the generation of a `ContentType()` method on response objects for `ClientWithResponses`, which is otherwise generated by default.\n\tSkipClientResponseContentType bool `yaml:\"skip-client-response-content-type,omitempty\"`\n\n\t// PreferSkipOptionalPointer allows defining at a global level whether to omit the pointer for a type to indicate that the field/type is optional.\n\t// This is the same as adding `x-go-type-skip-optional-pointer` to each field (manually, or using an OpenAPI Overlay)\n\tPreferSkipOptionalPointer bool `yaml:\"prefer-skip-optional-pointer,omitempty\"`\n\n\t// PreferSkipOptionalPointerWithOmitzero allows generating the `omitzero` JSON tag types that would have had an optional pointer.\n\t// This is the same as adding `x-omitzero` to each field (manually, or using an OpenAPI Overlay).\n\t// A field can set `x-omitzero: false` to disable the `omitzero` JSON tag.\n\t// NOTE that this must be used alongside `prefer-skip-optional-pointer`, otherwise makes no difference.\n\tPreferSkipOptionalPointerWithOmitzero bool `yaml:\"prefer-skip-optional-pointer-with-omitzero,omitempty\"`\n\n\t// PreferSkipOptionalPointerOnContainerTypes allows disabling the generation of an \"optional pointer\" for an optional field that is a container type (such as a slice or a map), which ends up requiring an additional, unnecessary, `... != nil` check\n\tPreferSkipOptionalPointerOnContainerTypes bool `yaml:\"prefer-skip-optional-pointer-on-container-types,omitempty\"`\n\n\t// ResolveTypeNameCollisions, when set to true, automatically renames\n\t// types that collide across different OpenAPI component sections\n\t// (schemas, parameters, requestBodies, responses, headers) by appending\n\t// a suffix based on the component section (e.g., \"Parameter\", \"Response\",\n\t// \"RequestBody\"). It also detects collisions between component types and\n\t// client response wrapper types (e.g., issue #1474). Without this, the\n\t// codegen will error on duplicate type names, requiring manual resolution\n\t// via x-go-name.\n\tResolveTypeNameCollisions bool `yaml:\"resolve-type-name-collisions,omitempty\"`\n\n\t// GenerateTypesForAnonymousSchemas, when true, causes oapi-codegen to\n\t// emit a named Go type for every inline schema that would otherwise\n\t// generate as an anonymous `struct { ... }`. The type's name is derived\n\t// from the schema path (e.g. `GetRolesIdResponseBody_Data`). Default\n\t// false. Equivalent to adding `x-go-type-name` to every inline schema;\n\t// when both are present at the same site, `x-go-type-name` wins.\n\t//\n\t// The hoisted named types are declared by the same emission path that\n\t// `generate.models` controls. In a single-config setup, this flag is\n\t// only effective when `generate.models: true` is also set in the same\n\t// config — otherwise the generated client/server code will reference\n\t// type names that no emission path declares, and `go build` will fail.\n\t//\n\t// In a multi-config setup where one config emits `models` and a\n\t// sibling config emits a client or server framework into the same\n\t// Go package, the flag must be set consistently across all configs.\n\t// Mixing the flag (set in one config, omitted in the other) causes\n\t// references and declarations to disagree on whether to use the\n\t// hoisted name or the inline struct. The sibling config that does\n\t// not emit `models` will produce a warning at codegen time noting\n\t// that it does not declare the hoisted names; you can ignore the\n\t// warning when the sibling models config will declare them.\n\t//\n\t// See https://github.com/oapi-codegen/oapi-codegen/issues/1139\n\tGenerateTypesForAnonymousSchemas bool `yaml:\"generate-types-for-anonymous-schemas,omitempty\"`\n\n\t// TypeMapping allows customizing OpenAPI type/format to Go type mappings.\n\t// User-specified mappings are merged on top of the defaults.\n\tTypeMapping *TypeMapping `yaml:\"type-mapping,omitempty\"`\n\n\t// ContentTypes maps a short name to a list of regex patterns matched\n\t// against request/response media types. When a media type matches a\n\t// pattern, the short name is used as the tag in generated type names\n\t// (e.g. mapping `V1: ['^application/vnd\\.mycompany\\.v1\\+json$']` produces\n\t// `FindPetsV1RequestBody` instead of the default name derived from the\n\t// media type), and models are generated for that media type even when it\n\t// isn't one of the built-in supported types. Wire-level handling\n\t// (marshaling, binding) is still derived from the media type itself, so\n\t// renaming e.g. `application/x-www-form-urlencoded` keeps form encoding.\n\t//\n\t// Typed fields on client response structs are only generated for media\n\t// types the client knows how to deserialize (JSON-like, YAML and XML).\n\t// Mapping any other media type (e.g. `CSV: ['^text/csv$']`) generates\n\t// models and named request bodies, but client responses for it expose\n\t// only the raw body.\n\t//\n\t// User entries are merged on top of the built-in defaults by key\n\t// replacement (pattern lists are not merged):\n\t//\n\t//   JSON:      ['^application/json$']\n\t//   Formdata:  ['^application/x-www-form-urlencoded$']\n\t//   Multipart: ['^multipart/']\n\t//   Text:      ['^text/plain$']\n\t//\n\t// An empty pattern list disables a key, so renaming a built-in means\n\t// adding the new key and emptying the old one, e.g.\n\t// `Form: ['^application/x-www-form-urlencoded$']` plus `Formdata: []` —\n\t// otherwise the media type matches under both short names, which is a\n\t// generation-time error. Media types that match no pattern keep the\n\t// remaining built-in behavior (vendored `+json` types get a name derived\n\t// from the media type; anything else is passed through untyped).\n\t// NOTE that mapping two media types that appear on the same request or\n\t// response to the same short name produces colliding type names.\n\tContentTypes map[string][]string `yaml:\"content-types,omitempty\"`\n}\n```\nOutputOptions are used to modify the output code in some way.\n\n```go\nfunc (oo OutputOptions) Validate() map[string]string\n```\n\n```go\ntype OutputOptionsOverlay struct {\n\tPath string `yaml:\"path\"`\n\n\t// Strict defines whether the Overlay should be applied in a strict way, highlighting any actions that will not take any effect. This can, however, lead to more work when testing new actions in an Overlay, so can be turned off with this setting.\n\t// Defaults to true.\n\tStrict *bool `yaml:\"strict,omitempty\"`\n}\n```\n\n```go\ntype ParamCodec struct {\n\t// Scalar is the codec of the value, or of an array's elements.\n\tScalar *ScalarCodec\n\t// IsArray reports whether the value is an array of Scalar.\n\tIsArray bool\n\t// Object is the codec of an object value, in place of Scalar.\n\tObject *ObjectCodec\n\t// contains filtered or unexported fields\n}\n```\nParamCodec binds and styles a parameter's value: a scalar, or an array of scalars, in the parameter's location, style and explode.\n\n```go\nfunc (c *ParamCodec) BindList(list, dst string) string\n```\nBindList returns statements that bind each string of list, an expression of type \\[]string, into the elements of dst, an array, and set err when one can't be.\n\n```go\nfunc (c *ParamCodec) BindQuery(values, dst string) string\n```\nBindQuery returns statements that bind values, the values of the query parameter, of which there is at least one, into dst, and set err when they can't be.\n\n```go\nfunc (c *ParamCodec) BindQueryObject(query, dst string) string\n```\nBindQueryObject returns statements that bind the properties of an exploded query object, each a query parameter of its own in query\\_, into dst, set found\\_ when one is present, and set err when one can't be bound. An object whose properties aren't known, or that only has additional properties, can't be told apart from the other query parameters, so is never found, as with the runtime library.\n\n```go\nfunc (c *ParamCodec) BindStyled(src, dst string) string\n```\nBindStyled returns statements that bind src, the value of a path, header or cookie parameter, into dst, and set err when it can't: a scalar is the value without the style's prefix, an array its parts.\n\nThe runtime library read a value with an UnmarshalText method whole, prefix and all, so a \\`label\\` or \\`matrix\\` date, time, UUID or union never bound; the generated code strips the prefix first.\n\n```go\nfunc (c *ParamCodec) ExplodedQueryObject() bool\n```\nExplodedQueryObject reports whether the parameter is an exploded object in a query, whose properties are query parameters of their own: see BindQueryObject.\n\n```go\nfunc (c *ParamCodec) Style(v, out string) string\n```\nStyle returns statements that set out to the styled value v of a path, header or cookie parameter, escaped for its location, and set err when it can't be formatted.\n\n```go\nfunc (c *ParamCodec) StyleQuery(v, fragments string) string\n```\nStyleQuery returns statements that append the styled value v of the query parameter to fragments, a \\[]string of \\`key=value\\` query fragments, and set err when it can't be formatted.\n\nThe runtime library couldn't style a scalar in \\`spaceDelimited\\` or \\`pipeDelimited\\` style; the generated code styles it as \\`form\\`.\n\n```go\ntype ParameterDefinition struct {\n\tParamName string // The original json parameter name, eg param_name\n\tIn        string // Where the parameter is defined - path, header, cookie, query\n\tRequired  bool   // Is this a required parameter?\n\tSpec      *model.Parameter\n\tSchema    Schema\n\n\t// Shared is true for a parameter declared at the path-item level, which\n\t// is inherited by every method on the path. Its helper types are declared\n\t// once for the path item rather than once per operation, so operation type\n\t// collection skips them (issue #2090).\n\tShared bool\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc CombineOperationParameters(globalParams []ParameterDefinition, localParams []ParameterDefinition) ([]ParameterDefinition, error)\n```\nCombineOperationParameters combines the Parameters defined at a global level (Parameters defined for all methods on a given path) with the Parameters defined at a local level (Parameters defined for a specific path), preferring the locally defined parameter over the global one\n\n```go\nfunc DescribeParameters(params model.Parameters, path []string) ([]ParameterDefinition, error)\n```\nDescribeParameters walks the given parameters dictionary, and generates the above descriptors into a flat list. This makes it a lot easier to traverse the data in the template engine.\n\n```go\nfunc FilterParameterDefinitionByType(params []ParameterDefinition, in string) []ParameterDefinition\n```\nFilterParameterDefinitionByType returns the subset of the specified parameters which are of the specified type.\n\n```go\nfunc SortParamsByPath(path string, in []ParameterDefinition) ([]ParameterDefinition, error)\n```\nSortParamsByPath reorders the given parameter definitions to match those in the path URI. If a parameter appears more than once in the path (e.g. Keycloak's /clients/{client-uuid}/roles/{role-name}/composites/clients/{client-uuid}), duplicates are removed and only the first occurrence determines the order.\n\n```go\nfunc (pd ParameterDefinition) Codec() *ParamCodec\n```\nCodec returns the codec that binds and styles the parameter, or nil when the parameter isn't styled: its value is in a content type, such as JSON.\n\n```go\nfunc (pd ParameterDefinition) Explode() bool\n```\n\n```go\nfunc (pd ParameterDefinition) GoName() string\n```\n\n```go\nfunc (pd ParameterDefinition) GoVariableName() string\n```\n\n```go\nfunc (pd ParameterDefinition) HasOptionalPointer() bool\n```\nHasOptionalPointer indicates whether the generated property has an optional pointer associated with it. This takes into account the \\`x-go-type-skip-optional-pointer\\` extension, allowing a parameter definition to control whether the pointer should be skipped.\n\n```go\nfunc (pd ParameterDefinition) IndirectOptional() bool\n```\nDeprecated: Use HasOptionalPointer, as it is clearer what the intent is.\n\n```go\nfunc (pd ParameterDefinition) IsJson() bool\n```\n\n```go\nfunc (pd ParameterDefinition) IsPassThrough() bool\n```\n\n```go\nfunc (pd ParameterDefinition) IsStyled() bool\n```\n\n```go\nfunc (pd ParameterDefinition) JsonTag() string\n```\nJsonTag generates the struct tag annotation for a parameter field on a server RequestObject struct. If Parameter Foo is marshaled to json as \"foo\", this will create the annotation 'json:\"foo\"'. Tags configured via output-options.struct-tags are rendered too. It also includes any additional struct tags from x-oapi-codegen-extra-tags at the parameter or schema level (parameter-level takes precedence).\n\n```go\nfunc (pd ParameterDefinition) PathSegmentStmts() string\n```\nPathSegmentStmts is the Go that splits a mixed path segment, or empty when this parameter occupies its segment alone. The text starts with a newline so it can be appended to the parameter's variable declaration without changing the source generated for whole-segment parameters.\n\n```go\nfunc (pd ParameterDefinition) PathValueExpr() string\n```\nPathValueExpr is the Go expression for this path parameter's raw text.\n\n```go\nfunc (pd ParameterDefinition) RequiresNilCheck() bool\n```\nRequiresNilCheck indicates whether the generated property should have a nil check performed on it before other checks. This should be used in templates when performing \\`nil\\` checks, but NOT when i.e. determining if there should be an optional pointer given to the type - in that case, use \\`HasOptionalPointer\\`\n\n```go\nfunc (pd ParameterDefinition) SanitizedParamName() string\n```\nSanitizedParamName returns the parameter name sanitized to be a valid Go identifier. This is needed for routers like net/http's ServeMux where path wildcards (e.g. {name}) must be valid Go identifiers. For the original OpenAPI parameter name (e.g. for error messages or JSON tags), use ParamName.\n\n```go\nfunc (pd ParameterDefinition) Style() string\n```\n\n```go\nfunc (pd ParameterDefinition) TypeDef() string\n```\nTypeDef is here as an adapter after a large refactoring so that I don't have to update all the templates. It returns the type definition for a parameter, without the leading '\\*' for optional ones.\n\n```go\nfunc (pd ParameterDefinition) ZeroValueIsNil() bool\n```\nZeroValueIsNil is a helper function to determine if the given Go type used for this property has \\`nil\\` as its Go zero value. Slices (OpenAPI \\`array\\`) and maps (OpenAPI \\`object\\` with only \\`additionalProperties\\`, rendered as \\`map\\[K]V\\`) both satisfy this — templates use it to decide whether to emit a nil-check before reading the field.\n\n```go\ntype ParameterDefinitions []ParameterDefinition\n```\n\n```go\nfunc (p ParameterDefinitions) FindByName(name string) *ParameterDefinition\n```\n\n```go\ntype Property struct {\n\tDescription   string\n\tJsonFieldName string\n\tSchema        Schema\n\tRequired      bool\n\tNullable      bool\n\tReadOnly      bool\n\tWriteOnly     bool\n\tNeedsFormTag  bool\n\tExtensions    map[string]any\n\tDeprecated    bool\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (p Property) GoFieldName() string\n```\n\n```go\nfunc (p Property) GoTypeDef() string\n```\n\n```go\nfunc (p Property) HasOptionalPointer() bool\n```\nHasOptionalPointer indicates whether the generated property has an optional pointer associated with it. This takes into account the \\`x-go-type-skip-optional-pointer\\` extension, allowing a parameter definition to control whether the pointer should be skipped.\n\n```go\nfunc (p Property) IsPointer() bool\n```\nIsPointer reports whether the generated Go field for this property is pointer-typed, i.e. GoTypeDef renders with a leading \\`\\*\\`. Templates use it when assigning a value to the field requires taking an address first.\n\n```go\nfunc (p Property) RequiresNilCheck() bool\n```\nRequiresNilCheck indicates whether the generated property should have a nil check performed on it before other checks. This should be used in templates when performing \\`nil\\` checks, but NOT when i.e. determining if there should be an optional pointer given to the type - in that case, use \\`HasOptionalPointer\\`\n\n```go\nfunc (p Property) ZeroValueIsNil() bool\n```\nZeroValueIsNil is a helper function to determine if the given Go type used for this property has \\`nil\\` as its Go zero value. Slices (OpenAPI \\`array\\`) and maps (OpenAPI \\`object\\` with only \\`additionalProperties\\`, rendered as \\`map\\[K]V\\`) both satisfy this — the custom-marshal templates use it to decide whether to emit a nil-check before reading the field.\n\n```go\ntype ReceiverTemplateData struct {\n\tPrefix      string // \"Webhook\" or \"Callback\"\n\tPrefixLower string // lowercase form of Prefix, for prose\n\tOperations  []OperationDefinition\n}\n```\nReceiverTemplateData is the input to the per-framework webhook / callback receiver template. Prefix selects between \"Webhook\" and \"Callback\" (and the lowercase form for prose), so a single template per framework handles both kinds.\n\n```go\nfunc NewReceiverTemplateData(prefix string, ops []OperationDefinition) ReceiverTemplateData\n```\nNewReceiverTemplateData builds the template input for the given prefix (\"Webhook\" or \"Callback\") and operation list.\n\n```go\ntype RefWrapper struct {\n\tRef       string\n\tHasValue  bool\n\tSourceRef any\n}\n```\n\n```go\ntype RequestBodyDefinition struct {\n\t// Is this body required, or optional?\n\tRequired bool\n\n\t// This is the schema describing this body\n\tSchema Schema\n\n\t// When we generate type names, we need a Tag for it, such as JSON, in\n\t// which case we will produce \"JSONBody\".\n\tNameTag string\n\n\t// This is the content type corresponding to the body, eg, application/json\n\tContentType string\n\n\t// Whether this is the default body type. For an operation named OpFoo, we\n\t// will not add suffixes like OpFooJSONBody for this one.\n\tDefault bool\n\n\t// Contains encoding options for formdata\n\tEncoding map[string]RequestBodyEncoding\n\n\t// Deprecated indicates the parent operation is deprecated, so this body\n\t// type alias should be marked deprecated too.\n\tDeprecated bool\n\n\t// DeprecationReason is propagated from the parent operation's x-deprecated-reason.\n\tDeprecationReason string\n}\n```\nRequestBodyDefinition describes a request body\n\n```go\nfunc (r RequestBodyDefinition) CustomType() bool\n```\nCustomType returns whether the body is a custom inline type, or pre-defined. This is poorly named, but it's here for compatibility reasons post-refactoring TODO: clean up the templates code, it can be simpler.\n\n```go\nfunc (r RequestBodyDefinition) GenerateFunctionComment(originalFunctionName string, parent OperationDefinition, functionSuffix string, isFunctionWithResponses bool) string\n```\nGenerateFunctionComment returns a full Godoc-style multi-line comment with: - the Summary, if present, as the first line of the comment - if not present, an indication of the HTTP call this corresponds with - whether this function takes a body and a content type\n\nTakes originalFunctionName (the OperationId or the function name being generated for this Operation), a suffix (if necessary) and whether this is being generated for ClientInterface or ClientWithResponsesInterface\n\n```go\nfunc (r RequestBodyDefinition) HasModel() bool\n```\nHasModel returns true when a Go model type is generated for this body — either a built-in supported media type or one matched by output-options.content-types.\n\n```go\nfunc (r RequestBodyDefinition) IsFixedContentType() bool\n```\nIsFixedContentType returns true if content type has fixed content type, i.e. contains no \"\\*\" symbol\n\n```go\nfunc (r RequestBodyDefinition) IsFormdata() bool\n```\nIsFormdata returns whether this body is form-urlencoded\n\n```go\nfunc (r RequestBodyDefinition) IsJSON() bool\n```\nIsJSON returns whether this is a JSON media type, for instance: - application/json - application/vnd.api+json - application/\\*+json\n\n```go\nfunc (r RequestBodyDefinition) IsMultipart() bool\n```\nIsMultipart returns whether this body is a multipart media type\n\n```go\nfunc (r RequestBodyDefinition) IsSupported() bool\n```\nIsSupported returns true if we support this content type for server. Otherwise io.Reader will be generated. Wire-level support is derived from the media type, not from NameTag, so user-configured short names (output-options.content-types) don't change how a body is bound.\n\n```go\nfunc (r RequestBodyDefinition) IsSupportedByClient() bool\n```\nIsSupportedByClient returns true if we support this content type for client. Otherwise only generic method will ge generated\n\n```go\nfunc (r RequestBodyDefinition) IsText() bool\n```\nIsText returns whether this body is plain text\n\n```go\nfunc (r RequestBodyDefinition) Suffix() string\n```\nWhen we're generating multiple functions which relate to request bodies, this generates the suffix. Such as Operation DoFoo would be suffixed with DoFooWithXMLBody.\n\n```go\nfunc (r RequestBodyDefinition) TypeDef(opID string) *TypeDefinition\n```\nTypeDef returns the Go type definition for a request body\n\n```go\ntype RequestBodyEncoding struct {\n\tContentType string\n\tStyle       string\n\tExplode     *bool\n}\n```\n\n```go\ntype ResolvedName struct {\n\tSchema    *GatheredSchema\n\tGoName    string // The resolved Go type name\n\tCandidate string // The initial candidate name before collision resolution\n\tPinned    bool   // True if name came from x-go-name; must not be renamed\n}\n```\nResolvedName holds the final Go type name assigned to a gathered schema.\n\n```go\ntype ResponseContentDefinition struct {\n\t// This is the schema describing this content\n\tSchema Schema\n\n\t// This is the content type corresponding to the body, eg, application/json\n\tContentType string\n\n\t// When we generate type names, we need a Tag for it, such as JSON, in\n\t// which case we will produce \"Response200JSONContent\".\n\tNameTag string\n\n\t// NeedsBodyWrapper is true when a schema-backed server response cannot use\n\t// its generated Go type directly: as a method receiver, or, for a reusable\n\t// response envelope, as an embedded field.\n\tNeedsBodyWrapper bool\n}\n```\n\n```go\nfunc (r ResponseContentDefinition) CanUseDirectResponseType() bool\n```\nCanUseDirectResponseType reports whether the server response can use its wire type directly instead of exposing a Body field.\n\n```go\nfunc (r ResponseContentDefinition) HasFixedContentType() bool\n```\nHasFixedContentType returns true if content type has fixed content type, i.e. contains no \"\\*\" symbol\n\n```go\nfunc (r ResponseContentDefinition) IsFormdata() bool\n```\nIsFormdata returns whether this content is form-urlencoded\n\n```go\nfunc (r ResponseContentDefinition) IsJSON() bool\n```\nIsJSON returns whether this is a JSON media type, for instance: - application/json - application/vnd.api+json - application/\\*+json\n\n```go\nfunc (r ResponseContentDefinition) IsMultipart() bool\n```\nIsMultipart returns whether this content is a multipart media type\n\n```go\nfunc (r ResponseContentDefinition) IsStreamingContentType() bool\n```\nIsStreamingContentType reports whether this response's media type matches any configured streaming-content-types pattern (defaults merged with OutputOptions.StreamingContentTypes). Templates use this to emit a flush-per-chunk streaming path instead of a buffered io.Copy.\n\n```go\nfunc (r ResponseContentDefinition) IsSupported() bool\n```\nIsSupported returns true if we know how to serialize this content type. Otherwise io.Reader will be generated. Wire-level support is derived from the media type, not from NameTag, so user-configured short names (output-options.content-types) don't change how a response is written.\n\n```go\nfunc (r ResponseContentDefinition) IsText() bool\n```\nIsText returns whether this content is plain text\n\n```go\nfunc (r ResponseContentDefinition) NameTagOrContentType() string\n```\n\n```go\nfunc (r ResponseContentDefinition) TypeDef(opID string, statusCode int) *TypeDefinition\n```\nTypeDef returns the Go type definition for a request body\n\n```go\ntype ResponseDefinition struct {\n\tStatusCode  string\n\tDescription string\n\tContents    []ResponseContentDefinition\n\tHeaders     []ResponseHeaderDefinition\n\tRef         string\n}\n```\n\n```go\nfunc GenerateResponseDefinitions(operationID string, responses map[string]*model.ResponseRef, pathItemRef string) ([]ResponseDefinition, error)\n```\n\n```go\nfunc (r ResponseDefinition) GoName() string\n```\n\n```go\nfunc (r ResponseDefinition) HasFixedStatusCode() bool\n```\n\n```go\nfunc (r ResponseDefinition) IsExternalRef() bool\n```\n\n```go\nfunc (r ResponseDefinition) IsRef() bool\n```\n\n```go\ntype ResponseHeaderDefinition struct {\n\tName   string\n\tGoName string\n\tSchema Schema\n\t// Style and Explode mirror the serialization controls on the OpenAPI header\n\t// object. A response header is always serialized as if it were `in: header`,\n\t// so these default to \"simple\" / false when the spec omits them.\n\tStyle             string\n\tExplode           bool\n\tRequired          bool\n\tNullable          bool\n\tDeprecated        bool\n\tDeprecationReason string\n}\n```\n\n```go\nfunc (h ResponseHeaderDefinition) Codec() *ParamCodec\n```\nCodec returns the codec that binds and styles the response header.\n\n```go\nfunc (h ResponseHeaderDefinition) DeprecationComment() string\n```\nDeprecationComment returns a Go-style deprecation comment if the header is deprecated, otherwise returns an empty string.\n\n```go\nfunc (h ResponseHeaderDefinition) GoTypeDef() string\n```\nGoTypeDef returns the Go type string for this header, applying pointer or nullable wrapping based on the Required/Nullable fields and global config.\n\n```go\nfunc (h ResponseHeaderDefinition) IsNullable() bool\n```\nIsNullable returns true if the header type uses nullable.Nullable\\[T] rather than a pointer for optionality.\n\n```go\nfunc (h ResponseHeaderDefinition) IsOptional() bool\n```\nIsOptional returns true if this header's Go type is indirect (pointer or nullable wrapper), meaning the template should guard before calling w.Header().Set(). This must stay in sync with GoTypeDef().\n\n```go\ntype ResponseTypeDefinition struct {\n\tTypeDefinition\n\t// The content type name where this is used, eg, application/json\n\tContentTypeName string\n\n\t// The type name of a response model.\n\tResponseName string\n\n\tAdditionalTypeDefinitions []TypeDefinition\n}\n```\nResponseTypeDefinition is an extension of TypeDefinition, specifically for response unmarshaling in ClientWithResponses.\n\n```go\ntype ScalarCodec struct {\n\t// contains filtered or unexported fields\n}\n```\nScalarCodec binds and formats one scalar value of a parameter.\n\n```go\nfunc (c *ScalarCodec) Bind(src, dst string, asText bool) string\n```\nBind returns statements that parse the string src into dst, an addressable variable of the codec's type, and set err when it can't. asText selects how a type with an UnmarshalText method is read: with it, as the whole value of a path, header or cookie parameter is, or as an object, as a query value or an array element is, which uses Bind if there is one and reads time.Time as RFC 3339 or a date.\n\n```go\nfunc (c *ScalarCodec) Format(v, out, escape string) string\n```\nFormat returns statements that set out to v, an expression of the codec's type, as text escaped by escape (a function name, or \"\" for none), and set err when it can't be formatted.\n\n```go\ntype Schema struct {\n\tGoType  string // The Go type needed to represent the schema\n\tRefType string // If the type has a type name, this is set\n\n\tArrayType *Schema // The schema of array element\n\n\tEnumValues map[string]string // Enum values\n\n\tProperties               []Property       // For an object, the fields with names\n\tHasAdditionalProperties  bool             // Whether we support additional properties\n\tAdditionalPropertiesType *Schema          // And if we do, their type\n\tAdditionalTypes          []TypeDefinition // We may need to generate auxiliary helper types, stored here\n\n\tSkipOptionalPointer bool // Some types don't need a * in front when they're optional\n\n\tDescription string // The description of the element\n\n\tUnionElements []UnionElement // Possible elements of oneOf/anyOf union\n\n\t// UnionTextKinds lists the JSON types (\"boolean\", \"integer\", \"number\",\n\t// \"string\") of a union whose branches are all scalars, so that it can be\n\t// bound from a parameter's text; nil for any other union.\n\tUnionTextKinds []string\n\n\t// UnionVariantProperties lists, sorted, the JSON property names that the\n\t// union's branches declare. From* and Merge* drop these keys from the\n\t// union's additionalProperties, where UnmarshalJSON also puts them.\n\tUnionVariantProperties []string\n\n\t// UnionOwnedKeys is set for a union that combines several oneOfs or\n\t// anyOfs (see unionComponent): the JSON keys\n\t// each variant's own union owns, which From* replaces, keeping the other\n\t// unions' data, where for a single union it replaces all of it.\n\tUnionOwnedKeys map[UnionElement][]string\n\n\t// UnionRefComponents lists, for such a union, the unions that are a $ref\n\t// to a union type, which get As* and From* of their own.\n\tUnionRefComponents []UnionRefComponent\n\n\t// UnionAllowedKeys maps each variant with `additionalProperties: false`\n\t// to the JSON keys its As* allows: the variant's own, and those anything\n\t// else in the union's object declares (see closeUnionVariants). As* returns an error for any other key.\n\tUnionAllowedKeys map[UnionElement][]string\n\n\tDiscriminator *Discriminator // Describes which value is stored in a union\n\n\t// If this is set, the schema will declare a type via alias, eg,\n\t// `type Foo = bool`. If this is not set, we will define this type via\n\t// type definition `type Foo bool`\n\t//\n\t// Can be overriden by the OutputOptions#DisableTypeAliasesForType field\n\tDefineViaAlias bool\n\n\t// The original OpenAPIv3 Schema.\n\tOAPISchema *model.Schema\n\t// contains filtered or unexported fields\n}\n```\nSchema describes an OpenAPI schema, with lots of helper fields to use in the templating engine.\n\n```go\nfunc GenerateGoSchema(sref *model.SchemaRef, path []string) (Schema, error)\n```\nGenerateGoSchema converts an OpenAPI schema into a Go type definition.\n\nIt starts a fresh generation context, so a call made from outside the package behaves exactly as it always has. Within the package, prefer generateGoSchema so that the recursion state described by genContext survives the descent.\n\n```go\nfunc (s Schema) AdoptedProperties() []Property\n```\nAdoptedProperties returns the properties of a union that its From\\* and Merge\\* helpers fill from the variant: those that MarshalJSON always writes, so that a zero value would overwrite the variant's. The rest are written only when set, and otherwise the union data's value is written as it is.\n\n```go\nfunc (s Schema) ClosedUnionVariant(e UnionElement) bool\n```\nClosedUnionVariant reports whether a variant's As\\* allows only some keys (see UnionAllowedKeys).\n\n```go\nfunc (s Schema) DiscriminatorCases() []DiscriminatorCase\n```\nDiscriminatorCases returns the ValueByDiscriminator() switch arms for the union, sorted by discriminator value for deterministic output. Each mapping value is the Go type of a union element (the union generators write both from the same elementSchema.GoType), so it resolves to that element's Method(). A mapping value not found among the union elements is skipped: it has no As\\* helper to dispatch to, so no case is emitted and it falls through to the switch default.\n\n```go\nfunc (s Schema) DiscriminatorStampFor(element UnionElement) *DiscriminatorStamp\n```\nDiscriminatorStampFor resolves the discriminator stamp for the given union element, or nil when nothing should be stamped: there is no discriminator, the mapping doesn't cover every element, or several mapping values share one element type, making the value ambiguous (the 1:1 gate keeps parity with issue #2071).\n\n```go\nfunc (s Schema) GetAdditionalTypeDefs() []TypeDefinition\n```\n\n```go\nfunc (s Schema) HasCustomMarshalJSON() bool\n```\nHasCustomMarshalJSON reports whether a named type declared over this schema position (the server response envelope, or a request-body wrapper) needs a delegating MarshalJSON/UnmarshalJSON pair.\n\nThe templates declare such a type either as an alias (\\`type X = Y\\`) or as a defined type (\\`type X Y\\`), keyed on whether the schema carries a RefType that lives in this package. An alias \\*is\\* Y, so Y's methods are already reachable and delegating would redeclare them. A defined type has an empty method set, so any marshalling Y generated is silently lost — that is the data loss behind [https://github.com/oapi-codegen/oapi-codegen/issues/2549](https://github.com/oapi-codegen/oapi-codegen/issues/2549) — and we emit a delegator.\n\n```go\nfunc (s Schema) HasCustomMarshalJSONForRequestBody() bool\n```\nHasCustomMarshalJSONForRequestBody reports whether a named request body wrapper needs to delegate JSON marshaling to its underlying type.\n\nThe request-body template only asks when it declares the wrapper as a defined type (\\`type XJSONRequestBody XJSONBody\\`), and a defined type has an empty method set, so the answer is simply whether the underlying type has generated marshalling. That includes an inline body with properties and additionalProperties, which HasCustomMarshalJSON's alias shortcut would miss: the body is a local RefType, yet the wrapper is not an alias of it.\n\n```go\nfunc (s Schema) InUnionComponent(e UnionElement) bool\n```\nInUnionComponent reports whether a variant belongs to one of several unions the schema combines (see UnionOwnedKeys).\n\n```go\nfunc (s Schema) IsExternalRef() bool\n```\n\n```go\nfunc (s Schema) IsPrimitive() bool\n```\nIsPrimitive returns true if the schema represents a primitive OpenAPI type (string, integer, number, or boolean) as opposed to an object, array, or composed type.\n\n```go\nfunc (s Schema) IsRef() bool\n```\n\n```go\nfunc (s Schema) TypeDecl() string\n```\n\n```go\nfunc (s Schema) UnionAllowedKeysFor(e UnionElement) []string\n```\nUnionAllowedKeysFor returns the JSON keys a variant's As\\* allows (see UnionAllowedKeys).\n\n```go\nfunc (s Schema) UnionOwnedKeysFor(e UnionElement) []string\n```\nUnionOwnedKeysFor returns the JSON keys a variant's own union owns (see UnionOwnedKeys).\n\n```go\nfunc (s Schema) UnionTextAccepts(kind string) bool\n```\nUnionTextAccepts reports whether a scalar union has a branch of the given JSON type; see UnionTextKinds.\n\n```go\nfunc (s Schema) UnionTextNonStringKinds() string\n```\nUnionTextNonStringKinds names the JSON types other than string that a scalar union accepts, for its UnmarshalText doc comment: \"boolean or integer\"; see UnionTextKinds.\n\n```go\ntype SchemaContext int\n```\nSchemaContext identifies where in the OpenAPI document a schema was found.\n\n```go\nconst (\n\tContextComponentSchema SchemaContext = iota\n\tContextComponentParameter\n\tContextComponentRequestBody\n\tContextComponentResponse\n\tContextComponentHeader\n\tContextOperationParameter\n\tContextOperationRequestBody\n\tContextOperationResponse\n\tContextClientResponseWrapper\n)\n```\n\n```go\nfunc (sc SchemaContext) String() string\n```\nString returns a human-readable name for the context.\n\n```go\nfunc (sc SchemaContext) Suffix() string\n```\nSuffix returns the suffix to use for collision resolution.\n\n```go\ntype SchemaDescriptor struct {\n\tFields                   []FieldDescriptor\n\tHasAdditionalProperties  bool\n\tAdditionalPropertiesType string\n}\n```\nSchemaDescriptor describes a Schema, a type definition.\n\n```go\ntype SchemaPath []string\n```\nSchemaPath represents the document location of a schema, e.g. \\[\"components\", \"schemas\", \"Pet\", \"properties\", \"name\"].\n\n```go\nfunc (sp SchemaPath) String() string\n```\nString returns the path joined with \"/\".\n\n```go\ntype SecurityRequirementDefinition []SecuritySchemeScopes\n```\nSecurityRequirementDefinition is one way to satisfy an operation's security: every scheme it lists, each with the scopes it requires. An empty one lets the operation be called anonymously.\n\n```go\ntype SecuritySchemeScopes struct {\n\tScheme string\n\tScopes []string\n}\n```\nSecuritySchemeScopes names a security scheme and the scopes a security requirement needs of it.\n\n```go\ntype SimpleTypeSpec struct {\n\tType   string `yaml:\"type\" json:\"type\"`\n\tImport string `yaml:\"import,omitempty\" json:\"import,omitempty\"`\n}\n```\nSimpleTypeSpec defines the Go type for an OpenAPI type/format combination, along with any import required to use it.\n\n```go\ntype StructTagInfo struct {\n\t// FieldName is the property name from the OpenAPI spec.\n\tFieldName string\n\t// IsOptional is true when the field is not listed as required.\n\tIsOptional bool\n\t// OmitEmpty is true when the field should carry \",omitempty\".\n\tOmitEmpty bool\n\t// OmitZero is true when the field should carry \",omitzero\".\n\tOmitZero bool\n\t// NeedsFormTag is true for fields bound from form-style parameters or\n\t// urlencoded request bodies.\n\tNeedsFormTag bool\n}\n```\nStructTagInfo is the data made available to struct tag templates. The omit flags are fully computed before rendering: OmitEmpty folds in the required/readOnly/writeOnly logic and the x-omitempty extension; OmitZero folds in x-omitzero and prefer-skip-optional-pointer-with-omitzero. Templates therefore only need to decide whether to emit them, not re-derive them.\n\n```go\ntype StructTagTemplate struct {\n\t// Name is the tag name (e.g. \"json\", \"yaml\", \"db\").\n\tName string `yaml:\"name\"`\n\t// Template is a Go text/template producing the tag value.\n\t// Available fields: .FieldName, .IsOptional, .OmitEmpty, .OmitZero,\n\t// .NeedsFormTag.\n\tTemplate string `yaml:\"template\"`\n}\n```\nStructTagTemplate defines a single struct tag as a name plus a Go text/template rendered against StructTagInfo. A template that renders to the empty string suppresses the tag on that field.\n\n```go\ntype StructTagsConfig struct {\n\t// Tags lists the tags to generate. Entries are merged by name on top\n\t// of the defaults: a matching name replaces the default template, a\n\t// new name adds a tag. Output ordering is always alphabetical by name.\n\tTags []StructTagTemplate `yaml:\"tags,omitempty\"`\n}\n```\nStructTagsConfig configures struct tag generation for generated fields.\n\n```go\nfunc (c StructTagsConfig) Merge(other StructTagsConfig) StructTagsConfig\n```\nMerge merges user config on top of this config by tag name: matching names override the default template, new names are appended.\n\n```go\ntype TypeDefinition struct {\n\t// The name of the type, eg, type \u003c...\u003e Person\n\tTypeName string\n\n\t// The name of the corresponding JSON description, as it will sometimes\n\t// differ due to invalid characters.\n\tJsonName string\n\n\t// This is the Schema wrapper is used to populate the type description\n\tSchema Schema\n\n\t// ForceEnumPrefix, when true, forces the enum-value constants generated\n\t// from this TypeDefinition to be prefixed with the type name, regardless\n\t// of whether GenerateEnums detects a cross-enum conflict. Used for\n\t// synthesised enum types (e.g. server-URL variable enums) whose\n\t// generated identifiers must remain stable to avoid colliding with\n\t// other constants emitted alongside them.\n\tForceEnumPrefix bool\n\n\t// Deprecated marks this type as deprecated, independent of the underlying\n\t// schema's own deprecated flag. Used when the type is generated for a\n\t// deprecated operation (e.g. request/response body aliases).\n\tDeprecated bool\n\n\t// DeprecationReason is the human-readable reason for deprecation, used\n\t// when Deprecated is true. If empty, a generic message is emitted.\n\tDeprecationReason string\n\n\t// Comment, when set, is the full doc comment (including the leading \"//\")\n\t// emitted above the type in the operation parameter template, replacing the\n\t// default \"\u003cname\u003e defines parameters for \u003cop\u003e.\" line. Used to explain\n\t// non-obvious generated names, e.g. the per-path hash prefix on a shared\n\t// parameter disambiguated across paths (issue #2090).\n\tComment string\n}\n```\nTypeDefinition describes a Go type definition in generated code.\n\nLet's use this example schema: components:\n\n\tschemas:\n\t  Person:\n\t    type: object\n\t    properties:\n\t    name:\n\t      type: string\n\n```go\nfunc GenerateParamsTypes(op OperationDefinition) []TypeDefinition\n```\nGenerateParamsTypes defines the schema for a parameters definition object which encapsulates all the query, header and cookie parameters for an operation.\n\n```go\nfunc GenerateTypeDefsForOperation(op OperationDefinition) []TypeDefinition\n```\n\n```go\nfunc GenerateTypesForParameters(t *template.Template, params map[string]*model.ParameterRef) ([]TypeDefinition, error)\n```\nGenerateTypesForParameters generates type definitions for any custom types defined in the components/parameters section of the Swagger spec.\n\n```go\nfunc GenerateTypesForRequestBodies(t *template.Template, bodies map[string]*model.RequestBodyRef) ([]TypeDefinition, error)\n```\nGenerateTypesForRequestBodies generates type definitions for any custom types defined in the components/requestBodies section of the Swagger spec.\n\n```go\nfunc GenerateTypesForResponses(t *template.Template, responses model.ResponseBodies) ([]TypeDefinition, error)\n```\nGenerateTypesForResponses generates type definitions for any custom types defined in the components/responses section of the Swagger spec.\n\n```go\nfunc GenerateTypesForSchemas(t *template.Template, schemas map[string]*model.SchemaRef, excludeSchemas []string) ([]TypeDefinition, error)\n```\nGenerateTypesForSchemas generates type definitions for any custom types defined in the components/schemas section of the Swagger spec.\n\n```go\nfunc (t TypeDefinition) DeprecationComment() string\n```\nDeprecationComment returns a Go-style deprecation comment if the type is deprecated, otherwise returns an empty string.\n\n```go\nfunc (t TypeDefinition) DocComment() string\n```\nDocComment returns the full Go doc comment for the type, including the deprecation notice as a separate paragraph when the type is deprecated.\n\n```go\nfunc (t *TypeDefinition) IsAlias() bool\n```\n\n```go\ntype TypeMapping struct {\n\tInteger FormatMapping `yaml:\"integer,omitempty\" json:\"integer\"`\n\tNumber  FormatMapping `yaml:\"number,omitempty\" json:\"number\"`\n\tBoolean FormatMapping `yaml:\"boolean,omitempty\" json:\"boolean\"`\n\tString  FormatMapping `yaml:\"string,omitempty\" json:\"string\"`\n}\n```\nTypeMapping defines the mapping from OpenAPI types to Go types.\n\n```go\nfunc (base TypeMapping) Merge(user TypeMapping) TypeMapping\n```\nMerge returns a new TypeMapping with user overrides applied on top of base.\n\n```go\ntype UnionElement string\n```\nUnionElement describe union element, based on prefix externalRef\\\\d+ and real ref name from external schema.\n\n```go\nfunc (u UnionElement) Method() string\n```\nMethod generate union method name for template functions \\`As/From/Merge\\`.\n\n```go\nfunc (u UnionElement) String() string\n```\nString returns externalRef\\\\d+ and real ref name from external schema, like externalRef0.SomeType.\n\n```go\ntype UnionRefComponent struct {\n\t// Type is the union's Go type.\n\tType UnionElement\n\t// OwnedKeys are the JSON keys only this union's variants declare.\n\tOwnedKeys []string\n\t// OtherKeys are the JSON keys only the rest of the object declares, the\n\t// other unions' variants and the object's own properties, which As*\n\t// leaves out of this union.\n\tOtherKeys []string\n}\n```\nUnionRefComponent is a union type that a union combining several includes through a $ref (see Schema.UnionRefComponents).\n\n","path":"github.com/ifc7/oapi-codegen/pkg/codegen","name":"codegen","synopsis":"","isRedistributable":true}
