{"modulePath":"github.com/romulets/oapi-codegen","version":"v1.11.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\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 TemplateFunctions = template.FuncMap{\n\t\"genParamArgs\":               genParamArgs,\n\t\"genParamTypes\":              genParamTypes,\n\t\"genParamNames\":              genParamNames,\n\t\"genParamFmtString\":          ReplacePathParamsWithStr,\n\t\"swaggerUriToEchoUri\":        SwaggerUriToEchoUri,\n\t\"swaggerUriToChiUri\":         SwaggerUriToChiUri,\n\t\"swaggerUriToGinUri\":         SwaggerUriToGinUri,\n\t\"swaggerUriToGorillaUri\":     SwaggerUriToGorillaUri,\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\"getResponseTypeDefinitions\": getResponseTypeDefinitions,\n\t\"toStringArray\":              toStringArray,\n\t\"lower\":                      strings.ToLower,\n\t\"title\":                      titleCaser.String,\n\t\"stripNewLines\":              stripNewLines,\n\t\"sanitizeGoIdentity\":         SanitizeGoIdentity,\n\t\"toGoComment\":                StringWithTypeNameToGoComment,\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 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 GenStructFromAllOf(allOf []*openapi3.SchemaRef, path []string) (string, error)\n```\nGenStructFromAllOf generates an object that is the union of the objects in the input array. In the case of Ref objects, we use an embedded struct, otherwise, we inline the fields.\n\n```go\nfunc GenStructFromSchema(schema Schema) string\n```\n\n```go\nfunc Generate(spec *openapi3.T, 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 *openapi3.RequestBodyRef) ([]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\n```go\nfunc GenerateChiServer(t *template.Template, operations []OperationDefinition) (string, error)\n```\nGenerateChiServer This function generates all the go code for the ServerInterface as well as all the wrapper functions around our handlers.\n\n```go\nfunc GenerateClient(t *template.Template, ops []OperationDefinition) (string, error)\n```\nGenerateClient uses the template engine to generate the function which registers our wrappers as Echo path handlers.\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 unmarshalling.\n\n```go\nfunc GenerateConstants(t *template.Template, ops []OperationDefinition) (string, error)\n```\nGenerateConstants generates operation ids, context keys, paths, etc. to be exported as constants\n\n```go\nfunc GenerateEchoServer(t *template.Template, operations []OperationDefinition) (string, error)\n```\nGenerateEchoServer This function generates all the go code for the ServerInterface as well as all the wrapper functions around our handlers.\n\n```go\nfunc GenerateEnums(t *template.Template, types []TypeDefinition) (string, error)\n```\n\n```go\nfunc GenerateGinServer(t *template.Template, operations []OperationDefinition) (string, error)\n```\nGenerateGinServer generates all the go code for the ServerInterface as well as all the wrapper functions around our handlers.\n\n```go\nfunc GenerateGorillaServer(t *template.Template, operations []OperationDefinition) (string, error)\n```\nGenerateGorillaServer generates all the go code for the ServerInterface as well as all the wrapper functions around our handlers.\n\n```go\nfunc GenerateImports(t *template.Template, externalImports []string, packageName string) (string, error)\n```\nGenerateImports generates our import statements and package definition.\n\n```go\nfunc GenerateInlinedSpec(t *template.Template, importMapping importMap, swagger *openapi3.T) (string, error)\n```\nGenerateInlinedSpec generates a gzipped, base64 encoded JSON representation of the swagger definition, which we embed inside the generated code.\n\n```go\nfunc GenerateStrictResponses(t *template.Template, responses []ResponseDefinition) (string, error)\n```\n\n```go\nfunc GenerateStrictServer(t *template.Template, operations []OperationDefinition, opts Configuration) (string, error)\n```\n\n```go\nfunc GenerateTemplates(templates []string, t *template.Template, ops interface{}) (string, error)\n```\nGenerateTemplates used to generate templates\n\n```go\nfunc GenerateTypeDefinitions(t *template.Template, swagger *openapi3.T, ops []OperationDefinition, excludeSchemas []string) (string, error)\n```\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 GetParametersImports(params map[string]*openapi3.ParameterRef) (map[string]goImport, error)\n```\n\n```go\nfunc GetRequestBodiesImports(bodies map[string]*openapi3.RequestBodyRef) (map[string]goImport, error)\n```\n\n```go\nfunc GetResponsesImports(responses map[string]*openapi3.ResponseRef) (map[string]goImport, error)\n```\n\n```go\nfunc GetSchemaImports(schemas map[string]*openapi3.SchemaRef, excludeSchemas []string) (map[string]goImport, error)\n```\n\n```go\nfunc GetTypeDefinitionsImports(swagger *openapi3.T, excludeSchemas []string) (map[string]goImport, error)\n```\n\n```go\nfunc GoSchemaImports(schemas ...*openapi3.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 indentifier.\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 MergeImports(dst, src map[string]goImport)\n```\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 *openapi3.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 PropertiesEqual(a, b Property) bool\n```\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 ReplacePathParamsWithStr(uri string) string\n```\nReplacePathParamsWithStr replaces path parameters of the form {param} with %s\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 SanitizeGoIdentity(str string) string\n```\nSanitizeGoIdentity deletes and replaces the illegal runes in the given string to use the string as a valid identity.\n\n```go\nfunc SchemaHasAdditionalProperties(schema *openapi3.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 SortedContentKeys(dict openapi3.Content) []string\n```\nSortedContentKeys returns Content dictionary keys in sorted order\n\n```go\nfunc SortedHeadersKeys(dict openapi3.Headers) []string\n```\n\n```go\nfunc SortedOperationsKeys(dict map[string]*openapi3.Operation) []string\n```\nSortedOperationsKeys returns Operation dictionary keys in sorted order\n\n```go\nfunc SortedParameterKeys(dict map[string]*openapi3.ParameterRef) []string\n```\nSortedParameterKeys returns sorted keys for a ParameterRef dict\n\n```go\nfunc SortedPathsKeys(dict openapi3.Paths) []string\n```\nSortedPathsKeys is the same as above, except it sorts the keys for a Paths dictionary.\n\n```go\nfunc SortedRequestBodyKeys(dict map[string]*openapi3.RequestBodyRef) []string\n```\n\n```go\nfunc SortedResponsesKeys(dict openapi3.Responses) []string\n```\nSortedResponsesKeys returns Responses dictionary keys in sorted order\n\n```go\nfunc SortedSchemaKeys(dict map[string]*openapi3.SchemaRef) []string\n```\nSortedSchemaKeys returns the keys of the given SchemaRef dictionary in sorted order, since Golang scrambles dictionary keys\n\n```go\nfunc SortedSecurityRequirementKeys(sr openapi3.SecurityRequirement) []string\n```\n\n```go\nfunc SortedStringKeys(dict map[string]string) []string\n```\nSortedStringKeys returns string map keys in sorted order\n\n```go\nfunc StringInArray(str string, array []string) bool\n```\nStringInArray checks whether the specified string is present in an array of strings\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 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 SwaggerUriToChiUri(uri string) string\n```\nSwaggerUriToChiUri converts a swagger style path URI with parameters to a Chi compatible path URI. We need to replace all Swagger parameters with \"{param}\". 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 SwaggerUriToEchoUri(uri string) string\n```\nSwaggerUriToEchoUri converts a OpenAPI style path URI with parameters to an Echo compatible path URI. We need to replace all of OpenAPI parameters with \":param\". 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 SwaggerUriToFiberUri(uri string) string\n```\nSwaggerUriToFiberUri converts a OpenAPI style path URI with parameters to a Fiber compatible path URI. We need to replace all of OpenAPI parameters with \":param\". 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 SwaggerUriToGinUri(uri string) string\n```\nSwaggerUriToGinUri converts a swagger style path URI with parameters to a Gin compatible path URI. We need to replace all Swagger parameters with \":param\". 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 SwaggerUriToGorillaUri(uri string) string\n```\nSwaggerUriToGorillaUri converts a swagger style path URI with parameters to a Gorilla compatible path URI. We need to replace all Swagger parameters with \":param\". 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 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## Types\n\n```go\ntype AdditionalImport struct {\n\tAlias   string `yaml:\"alias,omitempty\"`\n\tPackage string `yaml:\"package\"`\n}\n```\n\n```go\ntype CompatibilityOptions struct {\n\t// In the past, we merged schemas for `allOf` by inlining each schema\n\t// within the schema list. This approach, though, is incorrect because\n\t// `allOf` merges at the schema definition level, not at the resulting model\n\t// level. So, new behavior merges OpenAPI specs but generates different code\n\t// than we have in the past. Set OldMergeSchemas to true for the old behavior.\n\t// Please see https://github.com/deepmap/oapi-codegen/issues/531\n\tOldMergeSchemas bool `yaml:\"old-merge-schemas,omitempty\"`\n\t// Enum values can generate conflicting typenames, so we've updated the\n\t// code for enum generation to avoid these conflicts, but it will result\n\t// in some enum types being renamed in existing code. Set OldEnumConflicts to true\n\t// to revert to old behavior. Please see:\n\t// Please see https://github.com/deepmap/oapi-codegen/issues/549\n\tOldEnumConflicts bool `yaml:\"old-enum-conflicts,omitempty\"`\n\t// It was a mistake to generate a go type definition for every $ref in\n\t// the OpenAPI schema. New behavior uses type aliases where possible, but\n\t// this can generate code which breaks existing builds. Set OldAliasing to true\n\t// for old behavior.\n\t// Please see https://github.com/deepmap/oapi-codegen/issues/549\n\tOldAliasing bool `yaml:\"old-aliasing,omitempty\"`\n\t// When an object contains no members, and only an additionalProperties specification,\n\t// it is flattened to a map. Set\n\tDisableFlattenAdditionalProperties bool `yaml:\"disable-flatten-additional-properties,omitempty\"`\n\t// When an object property is both required and readOnly the go model is generated\n\t// as a pointer. Set DisableRequiredReadOnlyAsPointer to true to mark them as non pointer.\n\t// Please see https://github.com/deepmap/oapi-codegen/issues/604\n\tDisableRequiredReadOnlyAsPointer bool `yaml:\"disable-required-readonly-as-pointer,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// Our generated code for Chi has historically inverted the order in which Chi middleware is\n\t// applied such that the last invoked middleware ends up executing first in the Chi chain\n\t// This resolves the behavior such that middlewares are chained in the order they are invoked.\n\t// Please see https://github.com/deepmap/oapi-codegen/issues/786\n\tApplyChiMiddlewareFirstToLast bool `yaml:\"apply-chi-middleware-first-to-last,omitempty\"`\n\t// Our generated code for gorilla/mux has historically inverted the order in which gorilla/mux middleware is\n\t// applied such that the last invoked middleware ends up executing first in the middlewares chain\n\t// This resolves the behavior such that middlewares are chained in the order they are invoked.\n\t// Please see https://github.com/deepmap/oapi-codegen/issues/841\n\tApplyGorillaMiddlewareFirstToLast bool `yaml:\"apply-gorilla-middleware-first-to-last,omitempty\"`\n}\n```\nCompatibilityOptions specifies backward compatibility settings for the code generator.\n\n```go\ntype Configuration struct {\n\tPackageName       string               `yaml:\"package\"` // PackageName to generate\n\tGenerate          GenerateOptions      `yaml:\"generate,omitempty\"`\n\tCompatibility     CompatibilityOptions `yaml:\"compatibility,omitempty\"`\n\tOutputOptions     OutputOptions        `yaml:\"output-options,omitempty\"`\n\tImportMapping     map[string]string    `yaml:\"import-mapping,omitempty\"` // ImportMapping specifies the golang package path for each external reference\n\tAdditionalImports []AdditionalImport   `yaml:\"additional-imports,omitempty\"`\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\ntype Constants struct {\n\t// SecuritySchemeProviderNames holds all provider names for security schemes.\n\tSecuritySchemeProviderNames []string\n\t// EnumDefinitions holds type and value information for all enums\n\tEnumDefinitions []EnumDefinition\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```\n\n```go\nfunc (d *Discriminator) JSONTag() string\n```\n\n```go\nfunc (d *Discriminator) PropertyName() string\n```\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// `compatibility.always-prefix-enum-values` option.\n\tPrefixTypeName bool\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 GenerateOptions struct {\n\tChiServer     bool `yaml:\"chi-server,omitempty\"`     // ChiServer specifies whether to generate chi server boilerplate\n\tEchoServer    bool `yaml:\"echo-server,omitempty\"`    // EchoServer specifies whether to generate echo server boilerplate\n\tGinServer     bool `yaml:\"gin-server,omitempty\"`     // GinServer specifies whether to generate gin server boilerplate\n\tGorillaServer bool `yaml:\"gorilla-server,omitempty\"` // GorillaServer specifies whether to generate Gorilla server boilerplate\n\tStrict        bool `yaml:\"strict-server,omitempty\"`  // Strict specifies whether to generate strict server wrapper\n\tClient        bool `yaml:\"client,omitempty\"`         // Client specifies whether to generate client boilerplate\n\tModels        bool `yaml:\"models,omitempty\"`         // Models specifies whether to generate type definitions\n\tEmbeddedSpec  bool `yaml:\"embedded-spec,omitempty\"`  // Whether to embed the swagger spec in the generated code\n}\n```\nGenerateOptions specifies which supported output formats to generate.\n\n```go\ntype OperationDefinition struct {\n\tOperationId string // The operation_id description from Swagger, used to generate function names\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\tSecurityDefinitions []SecurityDefinition  // These are the security providers\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\tSpec                *openapi3.Operation\n}\n```\nOperationDefinition describes an Operation\n\n```go\nfunc OperationDefinitions(swagger *openapi3.T) ([]OperationDefinition, error)\n```\nOperationDefinitions returns all operations for a swagger definition.\n\n```go\nfunc (o *OperationDefinition) AllParams() []ParameterDefinition\n```\nAllParams returns all parameters\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) 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) SummaryAsComment() string\n```\nSummaryAsComment returns the Operations summary as a multi line comment\n\n```go\ntype OutputOptions struct {\n\tSkipFmt       bool              `yaml:\"skip-fmt,omitempty\"`       // Whether to skip go imports on the generated code\n\tSkipPrune     bool              `yaml:\"skip-prune,omitempty\"`     // Whether to skip pruning unused components on the generated code\n\tIncludeTags   []string          `yaml:\"include-tags,omitempty\"`   // Only include operations that have one of these tags. Ignored when empty.\n\tExcludeTags   []string          `yaml:\"exclude-tags,omitempty\"`   // Exclude operations that have one of these tags. Ignored when empty.\n\tUserTemplates map[string]string `yaml:\"user-templates,omitempty\"` // Override built-in templates from user-provided files\n\n\tExcludeSchemas     []string `yaml:\"exclude-schemas,omitempty\"`      // Exclude from generation schemas with given names. Ignored when empty.\n\tResponseTypeSuffix string   `yaml:\"response-type-suffix,omitempty\"` // The suffix used for responses types\n\tClientTypeName     string   `yaml:\"client-type-name,omitempty\"`     // Override the default generated client type with the value\n}\n```\nOutputOptions are used to modify the output code in some way.\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      *openapi3.Parameter\n\tSchema    Schema\n}\n```\n\n```go\nfunc DescribeParameters(params openapi3.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.\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) IndirectOptional() bool\n```\n\n```go\nfunc (pd *ParameterDefinition) IsJson() bool\n```\n\n```go\nfunc (pd ParameterDefinition) IsMultiValue() bool\n```\n\n```go\nfunc (pd *ParameterDefinition) IsPassThrough() bool\n```\n\n```go\nfunc (pd ParameterDefinition) IsSingleValue() bool\n```\n\n```go\nfunc (pd *ParameterDefinition) IsStyled() bool\n```\n\n```go\nfunc (pd *ParameterDefinition) JsonTag() string\n```\nJsonTag generates the JSON annotation to map GoType to json type name. If Parameter Foo is marshaled to json as \"foo\", this will create the annotation 'json:\"foo\"'\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\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]interface{}\n}\n```\n\n```go\nfunc (p Property) GoFieldName() string\n```\n\n```go\nfunc (p Property) GoTypeDef() string\n```\n\n```go\ntype RefWrapper struct {\n\tRef       string\n\tHasValue  bool\n\tSourceRef interface{}\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```\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) IsFixedContentType() bool\n```\nIsFixedContentType returns true if content type has fixed content type, i.e. contains no \"\\*\" symbol\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\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) 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 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```\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) IsSupported() bool\n```\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 openapi3.Responses) ([]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) IsRef() bool\n```\n\n```go\ntype ResponseHeaderDefinition struct {\n\tName   string\n\tGoName string\n\tSchema Schema\n}\n```\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```\nResponseTypeDefinition is an extension of TypeDefinition, specifically for response unmarshalling in ClientWithResponses.\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\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\tDefineViaAlias bool\n\n\t// The original OpenAPIv3 Schema.\n\tOAPISchema *openapi3.Schema\n}\n```\nSchema describes an OpenAPI schema, with lots of helper fields to use in the templating engine.\n\n```go\nfunc GenerateGoSchema(sref *openapi3.SchemaRef, path []string) (Schema, error)\n```\n\n```go\nfunc MergeSchemas(allOf []*openapi3.SchemaRef, path []string) (Schema, error)\n```\nMergeSchemas merges all the fields in the schemas supplied into one giant schema. The idea is that we merge all fields together into one schema.\n\n```go\nfunc (s *Schema) AddProperty(p Property) error\n```\nAddProperty adds a new property to the current Schema, and returns an error if it collides. Two identical fields will not collide, but two properties by the same name, but different definition, will collide. It's safe to merge the fields of two schemas with overalapping properties if those properties are identical.\n\n```go\nfunc (s Schema) GetAdditionalTypeDefs() []TypeDefinition\n```\n\n```go\nfunc (s Schema) IsRef() bool\n```\n\n```go\nfunc (s Schema) TypeDecl() string\n```\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 SecurityDefinition struct {\n\tProviderName string\n\tScopes       []string\n}\n```\n\n```go\nfunc DescribeSecurityDefinition(securityRequirements openapi3.SecurityRequirements) []SecurityDefinition\n```\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```\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]*openapi3.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]*openapi3.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 openapi3.Responses) ([]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]*openapi3.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) IsAlias() bool\n```\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","path":"github.com/romulets/oapi-codegen/pkg/codegen","name":"codegen","synopsis":"","isRedistributable":true}
