{"modulePath":"github.com/oapi-codegen/oapi-codegen-exp/experimental","version":"v0.0.0-20260413235603-d24950bd28cc","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package codegen\n\nPackage codegen generates Go code from parsed OpenAPI specs.\n\nPackage codegen provides extension handling for OpenAPI x- properties.\n\n## Constants\n\n```go\nconst (\n\tServerTypeStdHTTP = \"std-http\"\n\tServerTypeChi     = \"chi\"\n\tServerTypeEcho    = \"echo\"\n\tServerTypeEchoV4  = \"echo/v4\"\n\tServerTypeGin     = \"gin\"\n\tServerTypeGorilla = \"gorilla\"\n\tServerTypeFiber   = \"fiber\"\n\tServerTypeIris    = \"iris\"\n)\n```\nServerType constants for supported server frameworks.\n\n```go\nconst (\n\t// ExtTypeOverride specifies an external type to use instead of generating one.\n\t// Format: \"TypeName\" or \"TypeName;import/path\" or \"TypeName;alias import/path\"\n\tExtTypeOverride = \"x-oapi-codegen-type-override\"\n\n\t// ExtNameOverride overrides the generated field name.\n\tExtNameOverride = \"x-oapi-codegen-name-override\"\n\n\t// ExtTypeNameOverride overrides the generated type name.\n\tExtTypeNameOverride = \"x-oapi-codegen-type-name-override\"\n\n\t// ExtSkipOptionalPointer skips pointer wrapping for optional fields.\n\tExtSkipOptionalPointer = \"x-oapi-codegen-skip-optional-pointer\"\n\n\t// ExtJSONIgnore excludes the field from JSON marshaling (json:\"-\").\n\tExtJSONIgnore = \"x-oapi-codegen-json-ignore\"\n\n\t// ExtOmitEmpty explicitly controls the omitempty JSON tag.\n\tExtOmitEmpty = \"x-oapi-codegen-omitempty\"\n\n\t// ExtOmitZero adds omitzero to the JSON tag (Go 1.24+ encoding/json/v2).\n\tExtOmitZero = \"x-oapi-codegen-omitzero\"\n\n\t// ExtEnumVarNames overrides the generated enum constant names.\n\tExtEnumVarNames = \"x-oapi-codegen-enum-varnames\"\n\n\t// ExtDeprecatedReason provides a deprecation reason for documentation.\n\tExtDeprecatedReason = \"x-oapi-codegen-deprecated-reason\"\n\n\t// ExtOrder controls field ordering in generated structs.\n\tExtOrder = \"x-oapi-codegen-order\"\n)\n```\nExtension names - new naming convention with x-oapi-codegen- prefix\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: \"Email\", Template: \"email.tmpl\"},\n\t\t\t\"date\":      {Type: \"Date\", Template: \"date.tmpl\"},\n\t\t\t\"date-time\": {Type: \"time.Time\", Import: \"time\"},\n\t\t\t\"json\":      {Type: \"json.RawMessage\", Import: \"encoding/json\"},\n\t\t\t\"uuid\":      {Type: \"UUID\", Template: \"uuid.tmpl\"},\n\t\t\t\"binary\":    {Type: \"File\", Template: \"file.tmpl\"},\n\t\t},\n\t},\n}\n```\nDefaultTypeMapping provides the default OpenAPI type/format to Go type mappings.\n\n## Functions\n\n```go\nfunc ComputeBindFunc(style string, explode bool) string\n```\nComputeBindFunc returns the bind function name for a parameter.\n\n```go\nfunc ComputeBodyNameTag(contentType string) string\n```\nComputeBodyNameTag returns the name tag for a content type.\n\n```go\nfunc ComputeSchemaNames(schemas []*SchemaDescriptor, converter *NameConverter, contentTypeNamer *ContentTypeShortNamer)\n```\nComputeSchemaNames assigns StableName and ShortName to each schema descriptor. StableName is deterministic from the path; ShortName is a friendly alias. If a schema has a TypeNameOverride extension, that takes precedence over computed names.\n\n```go\nfunc ComputeStyleFunc(style string, explode bool) string\n```\nComputeStyleFunc returns the style function name for a parameter.\n\n```go\nfunc DefaultContentTypeShortNames() map[string][]string\n```\nDefaultContentTypeShortNames returns the default content type to short name mappings. The defaults match the patterns in DefaultContentTypes().\n\n```go\nfunc DefaultContentTypes() []string\n```\nDefaultContentTypes returns the default list of content type patterns. These match common JSON and YAML media types.\n\n```go\nfunc DefaultParamExplode(location string) bool\n```\nDefaultParamExplode returns the default explode value for a parameter location.\n\n```go\nfunc DefaultParamStyle(location string) string\n```\nDefaultParamStyle returns the default style for a parameter location.\n\n```go\nfunc FormatTagsMap(tags map[string]string) string\n```\nFormatTagsMap formats a tag map into a struct tag string. Tags are sorted alphabetically by name for deterministic output.\n\n```go\nfunc Generate(doc libopenapi.Document, specData []byte, cfg Configuration) (string, error)\n```\nGenerate produces Go code from the parsed OpenAPI document. specData is the raw spec bytes used to embed the spec in the generated code.\n\n```go\nfunc GenerateAdditionalPropertiesCode(typeName string, fields []StructField, addPropsType string) (string, error)\n```\nGenerateAdditionalPropertiesCode generates Get/Set + MarshalJSON/UnmarshalJSON for structs with additionalProperties.\n\n```go\nfunc GenerateApplyDefaultsCode(typeName string, fields []StructField) (string, bool, error)\n```\nGenerateApplyDefaultsCode generates the ApplyDefaults method for a struct. Returns the generated code and whether the reflect package is needed.\n\n```go\nfunc GenerateEnumFromInfo(info *EnumInfo) string\n```\nGenerateEnumFromInfo generates an enum type with const values using pre-computed EnumInfo. The EnumInfo contains sanitized names and the prefix decision from collision detection.\n\n```go\nfunc GenerateStruct(name string, fields []StructField, doc string, tagGen *StructTagGenerator) string\n```\nGenerateStruct generates a struct type definition.\n\n```go\nfunc GenerateStructWithAdditionalProps(name string, fields []StructField, addPropsType string, doc string, tagGen *StructTagGenerator) string\n```\nGenerateStructWithAdditionalProps generates a struct with AdditionalProperties field and custom marshal/unmarshal methods.\n\n```go\nfunc GenerateTypeAlias(name, targetType, doc string) string\n```\nGenerateTypeAlias generates a type alias definition.\n\n```go\nfunc GenerateUnionCode(cfg UnionTypeConfig) (string, error)\n```\nGenerateUnionCode generates all code for a union type using the union template.\n\n```go\nfunc IsGoKeyword(s string) bool\n```\nIsGoKeyword returns true if s is a Go keyword.\n\n```go\nfunc IsMediaTypeJSON(contentType string) bool\n```\nIsMediaTypeJSON returns true if the content type is a JSON media type.\n\n```go\nfunc LowercaseFirstCharacter(s string) string\n```\nLowercaseFirstCharacter lowercases only the first character of a string. Example: \"UserName\" -\u003e \"userName\"\n\n```go\nfunc MediaTypeToCamelCase(mediaType string) string\n```\nMediaTypeToCamelCase converts a media type to a CamelCase identifier.\n\n```go\nfunc ToCamelCase(s string) string\n```\nToCamelCase converts a string to CamelCase (PascalCase). It treats hyphens, underscores, spaces, and other non-alphanumeric characters as word separators. Example: \"user-name\" -\u003e \"UserName\", \"user\\_id\" -\u003e \"UserId\"\n\n```go\nfunc ToGoIdentifier(s string) string\n```\nToGoIdentifier converts a string to a valid Go identifier. It converts to CamelCase, handles leading digits, and avoids Go keywords.\n\n```go\nfunc UppercaseFirstCharacter(s string) string\n```\nUppercaseFirstCharacter uppercases only the first character of a string. Example: \"userName\" -\u003e \"UserName\"\n\n```go\nfunc ValidateParamStyle(style, location string) error\n```\nValidateParamStyle validates that a style is supported for a location. Returns an error if the combination is invalid.\n\n## Types\n\n```go\ntype AllOfMergeError struct {\n\tSchemaName   string\n\tPropertyName string\n\tType1        string\n\tType2        string\n}\n```\nAllOfMergeError represents a conflict when merging allOf schemas.\n\n```go\nfunc (e AllOfMergeError) Error() string\n```\n\n```go\ntype ClientGenerator struct {\n\t// contains filtered or unexported fields\n}\n```\nClientGenerator generates client code from operation descriptors.\n\n```go\nfunc NewClientGenerator(schemaIndex map[string]*SchemaDescriptor, generateSimple bool, modelsPackage *ModelsPackage, rp RuntimePrefixes, typeMapping TypeMapping) (*ClientGenerator, error)\n```\nNewClientGenerator creates a new client generator. modelsPackage can be nil if models are in the same package. rp holds the package prefixes for runtime sub-packages; all empty when embedded.\n\n```go\nfunc (g *ClientGenerator) GenerateBase() (string, error)\n```\nGenerateBase generates the base client types and helpers.\n\n```go\nfunc (g *ClientGenerator) GenerateClient(ops []*OperationDescriptor) (string, error)\n```\nGenerateClient generates the complete client code.\n\n```go\nfunc (g *ClientGenerator) GenerateInterface(data SenderTemplateData) (string, error)\n```\nGenerateInterface generates the ClientInterface.\n\n```go\nfunc (g *ClientGenerator) GenerateMethods(data SenderTemplateData) (string, error)\n```\nGenerateMethods generates the Client methods.\n\n```go\nfunc (g *ClientGenerator) GenerateParamTypes(ops []*OperationDescriptor) (string, error)\n```\nGenerateParamTypes generates the parameter struct types.\n\n```go\nfunc (g *ClientGenerator) GenerateRequestBodyTypes(ops []*OperationDescriptor) string\n```\nGenerateRequestBodyTypes generates type aliases for request bodies.\n\n```go\nfunc (g *ClientGenerator) GenerateRequestBuilders(data SenderTemplateData) (string, error)\n```\nGenerateRequestBuilders generates the request builder functions.\n\n```go\nfunc (g *ClientGenerator) GenerateSimple(data SenderTemplateData) (string, error)\n```\nGenerateSimple generates the SimpleClient with typed responses.\n\n```go\ntype CodeBuilder struct {\n\t// contains filtered or unexported fields\n}\n```\nCodeBuilder helps construct Go code fragments.\n\n```go\nfunc NewCodeBuilder() *CodeBuilder\n```\nNewCodeBuilder creates a new code builder.\n\n```go\nfunc (b *CodeBuilder) BlankLine()\n```\nBlankLine writes an empty line.\n\n```go\nfunc (b *CodeBuilder) Dedent()\n```\nDedent decreases indentation.\n\n```go\nfunc (b *CodeBuilder) Indent()\n```\nIndent increases indentation.\n\n```go\nfunc (b *CodeBuilder) Line(format string, args ...any)\n```\nLine writes a line with current indentation.\n\n```go\nfunc (b *CodeBuilder) Raw(s string)\n```\nRaw writes raw text without indentation or newline.\n\n```go\nfunc (b *CodeBuilder) String() string\n```\nString returns the built code.\n\n```go\ntype CodegenContext struct {\n\t// contains filtered or unexported fields\n}\n```\nCodegenContext is a centralized tracker for imports needed during code generation. Code at any depth can call its registration methods; the final output assembly queries it to collect all required imports.\n\n```go\nfunc NewCodegenContext() *CodegenContext\n```\nNewCodegenContext creates a new CodegenContext.\n\n```go\nfunc (c *CodegenContext) AddImport(path string)\n```\nAddImport records an import path needed by the generated code.\n\n```go\nfunc (c *CodegenContext) AddImportAlias(path, alias string)\n```\nAddImportAlias records an import path with an alias.\n\n```go\nfunc (c *CodegenContext) AddImports(imports map[string]string)\n```\nAddImports adds multiple imports from a map\\[path]alias.\n\n```go\nfunc (c *CodegenContext) AddJSONImport()\n```\nAddJSONImport adds encoding/json import.\n\n```go\nfunc (c *CodegenContext) AddJSONImports()\n```\nAddJSONImports adds encoding/json and fmt imports.\n\n```go\nfunc (c *CodegenContext) AddTemplateImports(imports []templates.Import)\n```\nAddTemplateImports adds all imports declared by the given template import slices.\n\n```go\nfunc (c *CodegenContext) HasRuntimePackage() bool\n```\nHasRuntimePackage returns true when an external runtime package is configured.\n\n```go\nfunc (c *CodegenContext) Imports() map[string]string\n```\nImports returns the collected imports as a map\\[path]alias.\n\n```go\nfunc (c *CodegenContext) RuntimeHelpersPrefix() string\n```\nRuntimeHelpersPrefix returns the helpers sub-package prefix (e.g., \"helpers.\").\n\n```go\nfunc (c *CodegenContext) RuntimeParamsPrefix() string\n```\nRuntimeParamsPrefix returns the params sub-package prefix (e.g., \"params.\").\n\n```go\nfunc (c *CodegenContext) RuntimeTypesPrefix() string\n```\nRuntimeTypesPrefix returns the types sub-package prefix (e.g., \"types.\").\n\n```go\nfunc (c *CodegenContext) SetRuntimePrefixes(params, types, helpers string)\n```\nSetRuntimePrefixes sets the package prefixes for the three runtime sub-packages. When non-empty, generated code references runtime helpers via these prefixes (e.g., \"params.\", \"types.\", \"helpers.\") instead of embedding them.\n\n```go\ntype Configuration struct {\n\t// PackageName which will be used in all generated files\n\tPackageName string `yaml:\"package\"`\n\t// Output specifies the output file path\n\tOutput string `yaml:\"output\"`\n\t// Generation controls which parts of the code are generated\n\tGeneration GenerationOptions `yaml:\"generation,omitempty\"`\n\t// OutputOptions controls filtering of operations and schemas\n\tOutputOptions OutputOptions `yaml:\"output-options,omitempty\"`\n\t// TypeMapping allows customizing OpenAPI type/format to Go type mappings\n\tTypeMapping TypeMapping `yaml:\"type-mapping,omitempty\"`\n\t// NameMangling configures how OpenAPI names are converted to Go identifiers\n\tNameMangling NameMangling `yaml:\"name-mangling,omitempty\"`\n\t// NameSubstitutions allows direct overrides of generated names\n\tNameSubstitutions NameSubstitutions `yaml:\"name-substitutions,omitempty\"`\n\t// ImportMapping maps external spec file paths to Go package import paths.\n\t// The value is either a bare import path or \"alias importpath\".\n\t// Examples:\n\t//   \"../common/api.yaml\": \"github.com/org/project/common\"         # alias auto-generated via hash\n\t//   \"../common/api.yaml\": \"common github.com/org/project/common\"  # explicit alias \"common\"\n\t// Use \"-\" as the value to indicate types should be in the current package.\n\tImportMapping map[string]string `yaml:\"import-mapping,omitempty\"`\n\t// ContentTypes is a list of regexp patterns for media types to generate models for.\n\t// Only request/response bodies with matching content types will have types generated.\n\t// Defaults to common JSON and YAML types if not specified.\n\tContentTypes []string `yaml:\"content-types,omitempty\"`\n\t// ContentTypeShortNames maps short names to lists of content type regex patterns.\n\t// Example: {\"JSON\": [\"^application/json$\", \"^application/.*\\\\+json$\"]}\n\t// These are used when generating response/request type names like \"FindPetsJSONResponse\".\n\tContentTypeShortNames map[string][]string `yaml:\"content-type-short-names,omitempty\"`\n\t// StructTags configures how struct tags are generated for fields.\n\t// By default, only json tags are generated.\n\tStructTags StructTagsConfig `yaml:\"struct-tags,omitempty\"`\n}\n```\n\n```go\nfunc (c *Configuration) ApplyDefaults()\n```\nApplyDefaults merges user configuration on top of default values.\n\n```go\ntype ContentTypeMatcher struct {\n\t// contains filtered or unexported fields\n}\n```\nContentTypeMatcher checks if content types match configured patterns.\n\n```go\nfunc NewContentTypeMatcher(patterns []string) *ContentTypeMatcher\n```\nNewContentTypeMatcher creates a matcher from a list of regexp patterns. Invalid patterns are silently ignored.\n\n```go\nfunc (m *ContentTypeMatcher) Matches(contentType string) bool\n```\nMatches returns true if the content type matches any of the configured patterns.\n\n```go\ntype ContentTypeShortNamer struct {\n\t// contains filtered or unexported fields\n}\n```\nContentTypeShortNamer resolves content types to short names for use in type names.\n\n```go\nfunc NewContentTypeShortNamer(mappings map[string][]string) *ContentTypeShortNamer\n```\nNewContentTypeShortNamer creates a short namer from configuration. The mappings map short names (e.g., \"JSON\") to lists of regexp patterns.\n\n```go\nfunc (n *ContentTypeShortNamer) ShortName(contentType string) string\n```\nShortName returns the short name for a content type, or a fallback derived from the content type.\n\n```go\ntype DiscriminatorInfo struct {\n\t// PropertyName is the JSON property used as the discriminator (e.g., \"petType\").\n\tPropertyName string\n\n\t// Mapping maps discriminator values to $ref paths.\n\t// For explicit mappings, keys are the values from the spec's discriminator.mapping.\n\t// For implicit mappings, keys are inferred from $ref schema names.\n\tMapping map[string]string\n\n\t// IsExplicit is true when the spec includes a discriminator.mapping section.\n\tIsExplicit bool\n}\n```\nDiscriminatorInfo holds discriminator metadata extracted from the OpenAPI spec.\n\n```go\ntype EnumInfo struct {\n\t// TypeName is the Go type name for the enum (e.g., \"Color\", \"Status\").\n\tTypeName string\n\t// BaseType is the Go base type (e.g., \"string\", \"int\").\n\tBaseType string\n\t// Values are the raw enum values from the spec.\n\tValues []string\n\t// CustomNames are user-provided constant names from x-oapi-codegen-enum-var-names.\n\t// May be nil or shorter than Values.\n\tCustomNames []string\n\t// Doc is the enum's documentation string.\n\tDoc string\n\t// SchemaPath is the key used to look up this EnumInfo (schema path string).\n\tSchemaPath string\n\n\t// PrefixTypeName indicates whether constant names should be prefixed with the type name.\n\t// Set by resolveEnumCollisions when collisions are detected.\n\tPrefixTypeName bool\n\t// SanitizedNames are the computed constant name suffixes (without type prefix).\n\t// Populated by computeEnumConstantNames.\n\tSanitizedNames []string\n}\n```\nEnumInfo holds all the information needed to generate an enum's constant block. It is populated during the pre-pass phase of code generation.\n\n```go\ntype Extensions struct {\n\tTypeOverride        *TypeOverride // External type to use\n\tNameOverride        string        // Override field name\n\tTypeNameOverride    string        // Override generated type name\n\tSkipOptionalPointer *bool         // Skip pointer for optional fields\n\tJSONIgnore          *bool         // Exclude from JSON\n\tOmitEmpty           *bool         // Control omitempty\n\tOmitZero            *bool         // Control omitzero\n\tEnumVarNames        []string      // Override enum constant names\n\tDeprecatedReason    string        // Deprecation reason\n\tOrder               *int          // Field ordering\n}\n```\nExtensions holds parsed extension values for a schema or property.\n\n```go\nfunc ParseExtensions(extensions *orderedmap.Map[string, *yaml.Node], path string) (*Extensions, error)\n```\nParseExtensions extracts extension values from a schema's extensions map. It supports both new (x-oapi-codegen-\\*) and legacy (x-go-\\*) extension names, logging deprecation warnings for legacy names.\n\n```go\ntype ExternalImport struct {\n\tAlias string // Short alias for use in generated code (e.g., \"ext_a1b2c3\")\n\tPath  string // Full import path (e.g., \"github.com/org/project/common\")\n}\n```\nExternalImport represents an external package import with its alias.\n\n```go\ntype FormatMapping struct {\n\tDefault SimpleTypeSpec            `yaml:\"default\"`\n\tFormats map[string]SimpleTypeSpec `yaml:\"formats,omitempty\"`\n}\n```\nFormatMapping defines the default Go type and format-specific overrides.\n\n```go\ntype GenerationOptions struct {\n\t// Server specifies which server framework to generate code for.\n\t// Supported values: \"std-http\"\n\t// Empty string (default) means no server code is generated.\n\tServer string `yaml:\"server,omitempty\"`\n\n\t// Client enables generation of the HTTP client.\n\t// When true, generates a base Client that returns *http.Response.\n\tClient bool `yaml:\"client,omitempty\"`\n\n\t// SimpleClient enables generation of the SimpleClient wrapper.\n\t// SimpleClient wraps the base Client with typed responses for\n\t// operations that have unambiguous response types.\n\t// Requires Client to also be enabled.\n\tSimpleClient bool `yaml:\"simple-client,omitempty\"`\n\n\t// WebhookInitiator enables generation of webhook initiator code (sends webhook requests).\n\t// Generates a framework-agnostic client that takes the full target URL per-call.\n\tWebhookInitiator bool `yaml:\"webhook-initiator,omitempty\"`\n\n\t// WebhookReceiver enables generation of webhook receiver code (receives webhook requests).\n\t// Generates framework-specific handler functions. Requires Server to be set.\n\tWebhookReceiver bool `yaml:\"webhook-receiver,omitempty\"`\n\n\t// CallbackInitiator enables generation of callback initiator code (sends callback requests).\n\t// Generates a framework-agnostic client that takes the full target URL per-call.\n\tCallbackInitiator bool `yaml:\"callback-initiator,omitempty\"`\n\n\t// CallbackReceiver enables generation of callback receiver code (receives callback requests).\n\t// Generates framework-specific handler functions. Requires Server to be set.\n\tCallbackReceiver bool `yaml:\"callback-receiver,omitempty\"`\n\n\t// ModelsPackage specifies an external package containing the model types.\n\t// When set, models are NOT generated locally - instead, generated code\n\t// imports and references types from this package.\n\t// Example: {path: \"github.com/org/project/models\"}\n\tModelsPackage *ModelsPackage `yaml:\"models-package,omitempty\"`\n\n\t// RuntimePackage specifies an external package containing runtime helpers\n\t// (Date, Nullable, param style/bind functions, marshalForm, etc.).\n\t// When set, these helpers are NOT embedded in the generated output —\n\t// instead, generated code imports and references them from this package.\n\t// Generate the runtime package with --generate-runtime or GenerateRuntime().\n\tRuntimePackage *RuntimePackageConfig `yaml:\"runtime-package,omitempty\"`\n}\n```\nGenerationOptions controls which parts of the code are generated.\n\n```go\ntype ImportResolver struct {\n\t// contains filtered or unexported fields\n}\n```\nImportResolver resolves external references to Go package imports.\n\n```go\nfunc NewImportResolver(importMapping map[string]string) (*ImportResolver, error)\n```\nNewImportResolver creates an ImportResolver from the configuration's import mapping. Each mapping value is either a bare import path (alias is auto-generated via hash) or \"alias importpath\" (explicit alias). The special value \"-\" means current package.\n\n```go\nfunc (r *ImportResolver) AllImports() []ExternalImport\n```\nAllImports returns all external imports sorted by alias.\n\n```go\nfunc (r *ImportResolver) Resolve(specPath string) *ExternalImport\n```\nResolve looks up an external spec file path and returns its import info. Returns nil if the path is not in the mapping.\n\n```go\ntype InitiatorGenerator struct {\n\t// contains filtered or unexported fields\n}\n```\nInitiatorGenerator generates initiator (sender) code from operation descriptors. It is parameterized by prefix to support both webhooks and callbacks.\n\n```go\nfunc NewInitiatorGenerator(prefix string, schemaIndex map[string]*SchemaDescriptor, generateSimple bool, modelsPackage *ModelsPackage, rp RuntimePrefixes, typeMapping TypeMapping) (*InitiatorGenerator, error)\n```\nNewInitiatorGenerator creates a new initiator generator. rp holds the package prefixes for runtime sub-packages; all empty when embedded.\n\n```go\nfunc (g *InitiatorGenerator) GenerateBase(ops []*OperationDescriptor) (string, error)\n```\nGenerateBase generates the base initiator types and helpers.\n\n```go\nfunc (g *InitiatorGenerator) GenerateInitiator(ops []*OperationDescriptor) (string, error)\n```\nGenerateInitiator generates the complete initiator code.\n\n```go\nfunc (g *InitiatorGenerator) GenerateInterface(data SenderTemplateData) (string, error)\n```\nGenerateInterface generates the InitiatorInterface.\n\n```go\nfunc (g *InitiatorGenerator) GenerateMethods(data SenderTemplateData) (string, error)\n```\nGenerateMethods generates the Initiator methods.\n\n```go\nfunc (g *InitiatorGenerator) GenerateParamTypes(ops []*OperationDescriptor) (string, error)\n```\nGenerateParamTypes generates the parameter struct types.\n\n```go\nfunc (g *InitiatorGenerator) GenerateRequestBodyTypes(ops []*OperationDescriptor) string\n```\nGenerateRequestBodyTypes generates type aliases for request bodies.\n\n```go\nfunc (g *InitiatorGenerator) GenerateRequestBuilders(data SenderTemplateData) (string, error)\n```\nGenerateRequestBuilders generates the request builder functions.\n\n```go\nfunc (g *InitiatorGenerator) GenerateSimple(data SenderTemplateData) (string, error)\n```\nGenerateSimple generates the SimpleInitiator with typed responses.\n\n```go\ntype ModelsPackage struct {\n\t// Path is the import path for the models package (e.g., \"github.com/org/project/models\")\n\tPath string `yaml:\"path\"`\n\t// Alias is an optional import alias. If empty, the last segment of the path is used.\n\tAlias string `yaml:\"alias,omitempty\"`\n}\n```\nModelsPackage specifies an external package containing the model types.\n\n```go\nfunc (m *ModelsPackage) Name() string\n```\nName returns the package name/alias to use for qualifying types. Returns the Alias if set, otherwise derives from the Path.\n\n```go\nfunc (m *ModelsPackage) Prefix() string\n```\nPrefix returns the package prefix for qualifying types (e.g., \"models.\"). Returns empty string if models are in the same package.\n\n```go\ntype NameConverter struct {\n\t// contains filtered or unexported fields\n}\n```\nNameConverter handles converting OpenAPI names to Go identifiers.\n\n```go\nfunc NewNameConverter(mangling NameMangling, substitutions NameSubstitutions) *NameConverter\n```\nNewNameConverter creates a NameConverter with the given configuration.\n\n```go\nfunc (c *NameConverter) ToEnumValueName(value string, baseType string) string\n```\nToEnumValueName converts a raw enum value to a valid Go identifier. For integer enums (baseType is int, int32, int64, etc.), numeric values get the configured NumericPrefix, negative values get \"Minus\" prefix. For string enums, the value is processed through the full NameConverter pipeline.\n\n```go\nfunc (c *NameConverter) ToPropertyName(name string) string\n```\nToPropertyName converts an OpenAPI property name to a Go field name.\n\n```go\nfunc (c *NameConverter) ToTypeName(name string) string\n```\nToTypeName converts an OpenAPI schema name to a Go type name.\n\n```go\nfunc (c *NameConverter) ToTypeNamePart(name string) string\n```\nToTypeNamePart converts a name to a type name component that will be joined with others. Unlike ToTypeName, it doesn't add a numeric prefix since the result won't be the start of an identifier.\n\n```go\nfunc (c *NameConverter) ToVariableName(name string) string\n```\nToVariableName converts an OpenAPI name to a Go variable name (unexported).\n\n```go\ntype NameMangling struct {\n\t// CharacterSubstitutions maps characters to their word replacements.\n\t// Used when these characters appear at the start of a name.\n\t// Example: '$' -\u003e \"DollarSign\", '-' -\u003e \"Minus\"\n\tCharacterSubstitutions map[string]string `yaml:\"character-substitutions,omitempty\"`\n\n\t// WordSeparators is a string of characters that mark word boundaries.\n\t// When encountered, the next letter is capitalized.\n\t// Example: \"-_. \" means \"foo-bar\" becomes \"FooBar\"\n\tWordSeparators string `yaml:\"word-separators,omitempty\"`\n\n\t// NumericPrefix is prepended when a name starts with a digit.\n\t// Example: \"N\" means \"123foo\" becomes \"N123foo\"\n\tNumericPrefix string `yaml:\"numeric-prefix,omitempty\"`\n\n\t// KeywordPrefix is prepended when a name conflicts with a Go keyword.\n\t// Example: \"_\" means \"type\" becomes \"_type\"\n\tKeywordPrefix string `yaml:\"keyword-prefix,omitempty\"`\n\n\t// Initialisms is a list of words that should be all-uppercase.\n\t// Example: [\"ID\", \"HTTP\", \"URL\"] means \"userId\" becomes \"UserID\"\n\tInitialisms []string `yaml:\"initialisms,omitempty\"`\n}\n```\nNameMangling configures how OpenAPI names are converted to valid Go identifiers.\n\n```go\nfunc DefaultNameMangling() NameMangling\n```\nDefaultNameMangling returns sensible defaults for name mangling.\n\n```go\nfunc (n NameMangling) Merge(user NameMangling) NameMangling\n```\nMerge returns a new NameMangling with user values overlaid on defaults. Non-zero user values override defaults.\n\n```go\ntype NameSubstitutions struct {\n\t// TypeNames maps generated type names to user-preferred names.\n\t// Example: {\"MyGeneratedType\": \"MyPreferredName\"}\n\tTypeNames map[string]string `yaml:\"type-names,omitempty\"`\n\n\t// PropertyNames maps generated property/field names to user-preferred names.\n\t// Example: {\"GeneratedField\": \"PreferredField\"}\n\tPropertyNames map[string]string `yaml:\"property-names,omitempty\"`\n}\n```\nNameSubstitutions holds direct name overrides for generated identifiers.\n\n```go\ntype OperationDescriptor struct {\n\tOperationID   string // Normalized operation ID for function names\n\tGoOperationID string // Go-safe identifier (handles leading digits, keywords)\n\tMethod        string // HTTP method: GET, POST, PUT, DELETE, etc.\n\tPath          string // Original path: /users/{id}\n\tSummary       string // For generating comments\n\tDescription   string // Longer description\n\n\t// Source indicates where this operation was defined (path, webhook, or callback)\n\tSource       OperationSource\n\tWebhookName  string // Webhook name (for Source=webhook)\n\tCallbackName string // Callback key (for Source=callback)\n\tParentOpID   string // Parent operation ID (for Source=callback)\n\n\tPathParams   []*ParameterDescriptor\n\tQueryParams  []*ParameterDescriptor\n\tHeaderParams []*ParameterDescriptor\n\tCookieParams []*ParameterDescriptor\n\n\tBodies    []*RequestBodyDescriptor\n\tResponses []*ResponseDescriptor\n\n\tSecurity []SecurityRequirement\n\n\t// Precomputed for templates\n\tHasBody        bool   // Has at least one request body\n\tHasParams      bool   // Has non-path params (needs Params struct)\n\tParamsTypeName string // \"{OperationID}Params\"\n\n\t// Reference to the underlying spec\n\tSpec *v3.Operation\n}\n```\nOperationDescriptor describes a single API operation from an OpenAPI spec.\n\n```go\nfunc FilterOperations(ops []*OperationDescriptor, opts OutputOptions) []*OperationDescriptor\n```\nFilterOperations applies all operation filters (tags, operation IDs) from OutputOptions.\n\n```go\nfunc FilterOperationsByOperationID(ops []*OperationDescriptor, opts OutputOptions) []*OperationDescriptor\n```\nFilterOperationsByOperationID filters operations based on include/exclude operation ID lists. Exclude is applied first, then include.\n\n```go\nfunc FilterOperationsByTag(ops []*OperationDescriptor, opts OutputOptions) []*OperationDescriptor\n```\nFilterOperationsByTag filters operations based on include/exclude tag lists. Exclude is applied first, then include.\n\n```go\nfunc GatherCallbackOperations(doc *v3.Document, ctx *CodegenContext, contentTypeMatcher *ContentTypeMatcher, typeMapping TypeMapping) ([]*OperationDescriptor, error)\n```\nGatherCallbackOperations traverses an OpenAPI document and collects operations from callbacks.\n\n```go\nfunc GatherOperations(doc *v3.Document, ctx *CodegenContext, contentTypeMatcher *ContentTypeMatcher, typeMapping TypeMapping) ([]*OperationDescriptor, error)\n```\nGatherOperations traverses an OpenAPI document and collects all operations. contentTypeMatcher determines which content types get typed request body methods. typeMapping is used to resolve parameter schema types consistently with the type generator.\n\n```go\nfunc GatherWebhookOperations(doc *v3.Document, ctx *CodegenContext, contentTypeMatcher *ContentTypeMatcher, typeMapping TypeMapping) ([]*OperationDescriptor, error)\n```\nGatherWebhookOperations traverses an OpenAPI document and collects operations from webhooks.\n\n```go\nfunc (o *OperationDescriptor) AllParams() []*ParameterDescriptor\n```\nAllParams returns all parameters including path params.\n\n```go\nfunc (o *OperationDescriptor) DefaultBody() *RequestBodyDescriptor\n```\nDefaultBody returns the default request body (typically application/json), or nil.\n\n```go\nfunc (o *OperationDescriptor) DefaultTypedBody() *RequestBodyDescriptor\n```\nDefaultTypedBody returns the first request body with GenerateTyped=true, preferring the default body. Returns nil if no typed body exists.\n\n```go\nfunc (o *OperationDescriptor) HasTypedBody() bool\n```\nHasTypedBody returns true if at least one request body has GenerateTyped=true.\n\n```go\nfunc (o *OperationDescriptor) Params() []*ParameterDescriptor\n```\nParams returns all non-path parameters (query, header, cookie). These are bundled into a Params struct.\n\n```go\nfunc (o *OperationDescriptor) SummaryAsComment() string\n```\nSummaryAsComment returns the summary formatted as a Go comment.\n\n```go\ntype OperationSource string\n```\nOperationSource indicates where an operation was defined in the spec.\n\n```go\nconst (\n\tOperationSourcePath     OperationSource = \"path\"\n\tOperationSourceWebhook  OperationSource = \"webhook\"\n\tOperationSourceCallback OperationSource = \"callback\"\n)\n```\n\n```go\ntype Output struct {\n\t// contains filtered or unexported fields\n}\n```\nOutput collects generated Go code and formats it.\n\n```go\nfunc NewOutput(packageName string) *Output\n```\nNewOutput creates a new output collector.\n\n```go\nfunc (o *Output) AddImport(path, alias string)\n```\nAddImport adds an import path with optional alias.\n\n```go\nfunc (o *Output) AddImports(imports map[string]string)\n```\nAddImports adds multiple imports from a map.\n\n```go\nfunc (o *Output) AddType(code string)\n```\nAddType adds a type definition to the output.\n\n```go\nfunc (o *Output) Format() (string, error)\n```\nFormat returns the formatted Go source code with imports organized.\n\n```go\nfunc (o *Output) String() string\n```\nString generates the complete Go source file.\n\n```go\ntype OutputOptions struct {\n\t// IncludeTags only includes operations tagged with one of these tags. Ignored when empty.\n\tIncludeTags []string `yaml:\"include-tags,omitempty\"`\n\t// ExcludeTags excludes operations tagged with one of these tags. Ignored when empty.\n\tExcludeTags []string `yaml:\"exclude-tags,omitempty\"`\n\t// IncludeOperationIDs only includes operations with one of these operation IDs. Ignored when empty.\n\tIncludeOperationIDs []string `yaml:\"include-operation-ids,omitempty\"`\n\t// ExcludeOperationIDs excludes operations with one of these operation IDs. Ignored when empty.\n\tExcludeOperationIDs []string `yaml:\"exclude-operation-ids,omitempty\"`\n\t// ExcludeSchemas excludes schemas with the given names from generation. Ignored when empty.\n\tExcludeSchemas []string `yaml:\"exclude-schemas,omitempty\"`\n\t// PruneUnreferencedSchemas removes component schemas that are not $ref'd by any other\n\t// gathered schema. When combined with tag/operation filtering, this effectively removes\n\t// schemas that are only used by excluded operations.\n\tPruneUnreferencedSchemas bool `yaml:\"prune-unreferenced-schemas,omitempty\"`\n\t// AlwaysPrefixEnumValues forces all enum constants to be prefixed with the type name,\n\t// regardless of whether cross-enum collisions are detected.\n\t// When false (default), enum constants are only prefixed when needed to avoid collisions.\n\tAlwaysPrefixEnumValues bool `yaml:\"always-prefix-enum-values,omitempty\"`\n}\n```\nOutputOptions controls filtering of which operations and schemas are included in generation.\n\n```go\ntype ParameterDescriptor struct {\n\tName     string // Original name from spec (e.g., \"user_id\")\n\tGoName   string // Go-safe name for struct fields (e.g., \"UserId\")\n\tLocation string // \"path\", \"query\", \"header\", \"cookie\"\n\tRequired bool\n\n\t// Serialization style\n\tStyle   string // \"simple\", \"form\", \"label\", \"matrix\", etc.\n\tExplode bool\n\n\t// Type information\n\tSchema   *SchemaDescriptor\n\tTypeDecl string // Go type declaration (e.g., \"string\", \"[]int\", \"*MyType\")\n\n\t// Precomputed function names for templates\n\tStyleFunc string // \"StyleSimpleParam\", \"StyleFormExplodeParam\", etc.\n\tBindFunc  string // \"BindSimpleParam\", \"BindFormExplodeParam\", etc.\n\n\t// Encoding modes\n\tIsStyled      bool // Uses style/explode serialization (most common)\n\tIsPassThrough bool // No styling, just pass the string through\n\tIsJSON        bool // Parameter uses JSON content encoding\n\n\tSpec *v3.Parameter\n}\n```\nParameterDescriptor describes a parameter in any location.\n\n```go\nfunc (p *ParameterDescriptor) GoVariableName() string\n```\nGoVariableName returns a Go-safe variable name for this parameter. Used for local variables in generated code.\n\n```go\nfunc (p *ParameterDescriptor) HasOptionalPointer() bool\n```\nHasOptionalPointer returns true if this parameter should be a pointer (optional parameters that aren't required).\n\n```go\ntype ReceiverGenerator struct {\n\t// contains filtered or unexported fields\n}\n```\nReceiverGenerator generates receiver code from operation descriptors. It is parameterized by prefix to support both webhooks and callbacks.\n\n```go\nfunc NewReceiverGenerator(prefix string, serverType string, rp RuntimePrefixes) (*ReceiverGenerator, error)\n```\nNewReceiverGenerator creates a new receiver generator for the specified server type. rp holds the package prefixes for runtime sub-packages; all empty when embedded.\n\n```go\nfunc (g *ReceiverGenerator) GenerateErrors() (string, error)\n```\nGenerateErrors generates error types (shared with server).\n\n```go\nfunc (g *ReceiverGenerator) GenerateParamTypes(ops []*OperationDescriptor) (string, error)\n```\nGenerateParamTypes generates the parameter struct types.\n\n```go\nfunc (g *ReceiverGenerator) GenerateReceiver(ops []*OperationDescriptor) (string, error)\n```\nGenerateReceiver generates the receiver interface and handler functions.\n\n```go\ntype ReceiverTemplateData struct {\n\tPrefix      string                 // \"Webhook\" or \"Callback\"\n\tPrefixLower string                 // \"webhook\" or \"callback\"\n\tOperations  []*OperationDescriptor // Operations to generate for\n}\n```\nReceiverTemplateData is passed to receiver templates.\n\n```go\ntype RequestBodyDescriptor struct {\n\tContentType string // \"application/json\", \"multipart/form-data\", etc.\n\tRequired    bool\n\tSchema      *SchemaDescriptor\n\n\t// Precomputed for templates\n\tNameTag       string // \"JSON\", \"Formdata\", \"Multipart\", \"Text\", etc.\n\tGoTypeName    string // \"{OperationID}JSONBody\", etc.\n\tFuncSuffix    string // \"\", \"WithJSONBody\", \"WithFormBody\" (empty for default)\n\tIsDefault     bool   // Is this the default body type?\n\tIsFormEncoded bool   // Is this application/x-www-form-urlencoded?\n\tGenerateTyped bool   // Generate typed methods for this body (based on content-types config)\n\n\t// Encoding options for form data\n\tEncoding map[string]RequestBodyEncoding\n}\n```\nRequestBodyDescriptor describes a request body for a specific content type.\n\n```go\ntype RequestBodyEncoding struct {\n\tContentType string\n\tStyle       string\n\tExplode     *bool\n}\n```\nRequestBodyEncoding describes encoding options for a form field.\n\n```go\ntype ResponseContentDescriptor struct {\n\tContentType string\n\tSchema      *SchemaDescriptor\n\tNameTag     string // \"JSON\", \"XML\", etc.\n\tIsJSON      bool\n}\n```\nResponseContentDescriptor describes response content for a content type.\n\n```go\ntype ResponseDescriptor struct {\n\tStatusCode  string // \"200\", \"404\", \"default\", \"2XX\"\n\tDescription string\n\tContents    []*ResponseContentDescriptor\n\tHeaders     []*ResponseHeaderDescriptor\n\tRef         string // If this is a reference to a named response\n}\n```\nResponseDescriptor describes a response for a status code.\n\n```go\nfunc (r *ResponseDescriptor) GoName() string\n```\nGoName returns a Go-safe name for this response (e.g., \"200\" -\u003e \"200\", \"default\" -\u003e \"Default\").\n\n```go\nfunc (r *ResponseDescriptor) HasFixedStatusCode() bool\n```\nHasFixedStatusCode returns true if the status code is a specific number (not \"default\" or \"2XX\").\n\n```go\ntype ResponseHeaderDescriptor struct {\n\tName     string\n\tGoName   string\n\tRequired bool\n\tSchema   *SchemaDescriptor\n}\n```\nResponseHeaderDescriptor describes a response header.\n\n```go\ntype RuntimeOutput struct {\n\tParams  string // params sub-package (style/bind functions, helpers)\n\tTypes   string // types sub-package (Date, Email, UUID, File, Nullable)\n\tHelpers string // helpers sub-package (MarshalForm)\n}\n```\nRuntimeOutput holds the generated Go source code for each runtime sub-package.\n\n```go\nfunc GenerateRuntime(baseImportPath string) (*RuntimeOutput, error)\n```\nGenerateRuntime produces standalone Go source files for each of the three runtime sub-packages. baseImportPath is the base import path for the runtime module (e.g., \"github.com/org/project/runtime\"). The params sub-package imports the types sub-package for Date references.\n\n```go\ntype RuntimePackageConfig struct {\n\t// Path is the base import path for the runtime package\n\t// (e.g., \"github.com/org/project/runtime\").\n\t// Sub-packages are at Path/types, Path/params, and Path/helpers.\n\tPath string `yaml:\"path\"`\n}\n```\nRuntimePackageConfig specifies an external package containing runtime helpers (Date, Nullable, param style/bind functions, MarshalForm, etc.). The runtime is split into three sub-packages: types, params, and helpers.\n\n```go\nfunc (r *RuntimePackageConfig) HelpersImport() string\n```\nHelpersImport returns the import path for the helpers sub-package.\n\n```go\nfunc (r *RuntimePackageConfig) ParamsImport() string\n```\nParamsImport returns the import path for the params sub-package.\n\n```go\nfunc (r *RuntimePackageConfig) TypesImport() string\n```\nTypesImport returns the import path for the types sub-package.\n\n```go\ntype RuntimePrefixes struct {\n\tParams  string // \"params.\" or \"\"\n\tTypes   string // \"types.\" or \"\"\n\tHelpers string // \"helpers.\" or \"\"\n}\n```\nRuntimePrefixes holds the package-qualifier prefixes for the three runtime sub-packages. When embedded (no runtime), all fields are empty strings.\n\n```go\nfunc (rp RuntimePrefixes) FuncMap() template.FuncMap\n```\nFuncMap returns a template.FuncMap that exposes runtime prefix accessors to templates.\n\n```go\ntype SchemaContext int\n```\nSchemaContext identifies what kind of schema this is based on its location.\n\n```go\nconst (\n\tContextUnknown SchemaContext = iota\n\tContextComponentSchema\n\tContextParameter\n\tContextRequestBody\n\tContextResponse\n\tContextHeader\n\tContextCallback\n\tContextWebhook\n\tContextProperty\n\tContextItems\n\tContextAllOf\n\tContextAnyOf\n\tContextOneOf\n\tContextAdditionalProperties\n)\n```\n\n```go\ntype SchemaDescriptor struct {\n\t// Path is where this schema appears in the document\n\tPath SchemaPath\n\n\t// Ref is the $ref string if this is a reference (e.g., \"#/components/schemas/Pet\")\n\t// Empty if this is an inline schema definition\n\tRef string\n\n\t// Schema is the underlying schema from libopenapi\n\t// nil for unresolved external references\n\tSchema *base.Schema\n\n\t// Parent points to the containing schema (nil for top-level schemas)\n\tParent *SchemaDescriptor\n\n\t// StableName is the deterministic Go type name derived from the full path.\n\t// This name is stable across spec changes and should be used for type definitions.\n\t// Example: #/components/schemas/Cat -\u003e CatSchemaComponent\n\tStableName string\n\n\t// ShortName is a friendly alias that may change due to deduplication.\n\t// Generated as a type alias pointing to StableName.\n\tShortName string\n\n\t// OperationID is the operationId from the path operation, if this schema\n\t// comes from a path's request body or response. Used for friendlier naming.\n\tOperationID string\n\n\t// ContentType is the media type (e.g., \"application/json\") if this schema\n\t// comes from a request body or response content. Used for naming.\n\tContentType string\n\n\t// Extensions holds parsed x- extension values for this schema.\n\t// These control code generation behavior (type overrides, field names, etc.)\n\tExtensions *Extensions\n\n\t// Discriminator holds discriminator info if this schema has oneOf/anyOf\n\t// with a discriminator. nil when no discriminator is present.\n\tDiscriminator *DiscriminatorInfo\n\n\t// Recursive structure:\n\tProperties      map[string]*SchemaDescriptor\n\tItems           *SchemaDescriptor\n\tAllOf           []*SchemaDescriptor\n\tAnyOf           []*SchemaDescriptor\n\tOneOf           []*SchemaDescriptor\n\tAdditionalProps *SchemaDescriptor\n}\n```\nSchemaDescriptor represents a schema found during the first pass through the spec.\n\n```go\nfunc FilterSchemasByName(schemas []*SchemaDescriptor, excludeNames []string) []*SchemaDescriptor\n```\nFilterSchemasByName removes schemas whose component name is in the exclude list. Only filters top-level component schemas (path: components/schemas/\\\u003cname\u003e).\n\n```go\nfunc GatherSchemas(doc *v3.Document, contentTypeMatcher *ContentTypeMatcher, outputOpts OutputOptions) ([]*SchemaDescriptor, error)\n```\nGatherSchemas traverses an OpenAPI document and collects all schemas into a list. When outputOpts contains operation filters (include/exclude tags or operation IDs), schemas from excluded operations are not gathered.\n\n```go\nfunc PruneUnreferencedSchemas(schemas []*SchemaDescriptor) []*SchemaDescriptor\n```\nPruneUnreferencedSchemas removes component schemas that are not $ref'd by any other gathered schema. This walks the entire schema descriptor tree, collects all $ref paths, and removes component schemas whose path doesn't appear in that set. Non-component schemas (inline path schemas, etc.) are always kept.\n\n```go\nfunc (d *SchemaDescriptor) IsComponentSchema() bool\n```\nIsComponentSchema returns true if this schema is defined in #/components/schemas\n\n```go\nfunc (d *SchemaDescriptor) IsExternalReference() bool\n```\nIsExternalReference returns true if this is a reference to an external file. External refs have the format: file.yaml#/path/to/schema\n\n```go\nfunc (d *SchemaDescriptor) IsReference() bool\n```\nIsReference returns true if this schema is a $ref to another schema\n\n```go\nfunc (d *SchemaDescriptor) IsTopLevelComponentSchema() bool\n```\nIsTopLevelComponentSchema returns true if this schema is a direct child of #/components/schemas (i.e., #/components/schemas/Foo, not #/components/schemas/Foo/properties/bar).\n\n```go\nfunc (d *SchemaDescriptor) ParseExternalRef() (filePath, internalPath string)\n```\nParseExternalRef splits an external reference into its file path and internal path. For \"common/api.yaml#/components/schemas/Pet\", returns (\"common/api.yaml\", \"#/components/schemas/Pet\"). Returns empty strings if not an external ref.\n\n```go\ntype SchemaKind int\n```\nSchemaKind represents the kind of schema for code generation.\n\n```go\nconst (\n\tKindStruct SchemaKind = iota\n\tKindMap\n\tKindAlias\n\tKindEnum\n\tKindAllOf\n\tKindAnyOf\n\tKindOneOf\n\tKindReference\n)\n```\n\n```go\nfunc GetSchemaKind(desc *SchemaDescriptor) SchemaKind\n```\nGetSchemaKind determines what kind of Go type to generate for a schema.\n\n```go\ntype SchemaPath []string\n```\nSchemaPath represents the location of a schema in the OpenAPI document. Used for deriving type names and disambiguating collisions. Example: \\[\"components\", \"schemas\", \"Pet\", \"properties\", \"address\"]\n\n```go\nfunc (p SchemaPath) Append(elements ...string) SchemaPath\n```\nAppend returns a new SchemaPath with the given elements appended. This creates a fresh slice to avoid aliasing issues with append.\n\n```go\nfunc (p SchemaPath) ContainsProperties() bool\n```\nContainsProperties returns true if this path contains \"properties\" anywhere. This indicates it's an inline property schema rather than a component schema.\n\n```go\nfunc (p SchemaPath) String() string\n```\nString returns the path as a JSON pointer-style string.\n\n```go\ntype SecurityRequirement struct {\n\tName   string   // Security scheme name\n\tScopes []string // Required scopes (for OAuth2)\n}\n```\nSecurityRequirement describes a security requirement for an operation.\n\n```go\ntype SenderTemplateData struct {\n\tIsClient    bool                   // true for client, false for initiator\n\tPrefix      string                 // \"\" for client, \"Webhook\"/\"Callback\" for initiator\n\tPrefixLower string                 // \"\" for client, \"webhook\"/\"callback\" for initiator\n\tTypeName    string                 // \"Client\" or \"WebhookInitiator\"\n\tReceiver    string                 // \"c\" or \"p\"\n\tOptionType  string                 // \"ClientOption\" or \"WebhookInitiatorOption\"\n\tErrorType   string                 // \"ClientHttpError\" or \"WebhookHttpError\"\n\tSimpleType  string                 // \"SimpleClient\" or \"SimpleWebhookInitiator\"\n\tOperations  []*OperationDescriptor // Operations to generate for\n}\n```\nSenderTemplateData is the unified template data for client and initiator templates. Templates use {{if .IsClient}} to branch on the few points where they diverge.\n\n```go\ntype ServerGenerator struct {\n\t// contains filtered or unexported fields\n}\n```\nServerGenerator generates server code from operation descriptors.\n\n```go\nfunc NewServerGenerator(serverType string, rp RuntimePrefixes) (*ServerGenerator, error)\n```\nNewServerGenerator creates a new server generator for the specified server type. rp holds the package prefixes for runtime sub-packages; all empty when embedded.\n\n```go\nfunc (g *ServerGenerator) GenerateErrors() (string, error)\n```\nGenerateErrors generates the error types.\n\n```go\nfunc (g *ServerGenerator) GenerateHandler(ops []*OperationDescriptor) (string, error)\n```\nGenerateHandler generates the HTTP handler and routing code.\n\n```go\nfunc (g *ServerGenerator) GenerateInterface(ops []*OperationDescriptor) (string, error)\n```\nGenerateInterface generates the ServerInterface.\n\n```go\nfunc (g *ServerGenerator) GenerateParamTypes(ops []*OperationDescriptor) (string, error)\n```\nGenerateParamTypes generates the parameter struct types.\n\n```go\nfunc (g *ServerGenerator) GenerateServer(ops []*OperationDescriptor) (string, error)\n```\nGenerateServer generates all server code components. Returns empty string if no server type was configured.\n\n```go\nfunc (g *ServerGenerator) GenerateWrapper(ops []*OperationDescriptor) (string, error)\n```\nGenerateWrapper generates the ServerInterfaceWrapper.\n\n```go\ntype SimpleTypeSpec struct {\n\tType     string `yaml:\"type\"`\n\tImport   string `yaml:\"import,omitempty\"`\n\tTemplate string `yaml:\"template,omitempty\"`\n}\n```\nSimpleTypeSpec is used to define the Go typename of a simple type like an int or a string, along with the import required to use it.\n\n```go\ntype StructField struct {\n\tName            string // Go field name\n\tType            string // Go type expression\n\tJSONName        string // Original JSON property name\n\tRequired        bool   // Is this field required in the schema\n\tNullable        bool   // Is this field nullable (type includes \"null\")\n\tPointer         bool   // Should this be a pointer type\n\tOmitEmpty       bool   // Include omitempty in json tag\n\tOmitZero        bool   // Include omitzero in json tag (Go 1.24+)\n\tJSONIgnore      bool   // Use json:\"-\" tag to exclude from marshaling\n\tDoc             string // Field documentation\n\tDefault         string // Go literal for default value (empty if no default)\n\tIsStruct        bool   // True if this field is a struct type (for recursive ApplyDefaults)\n\tIsExternal      bool   // True if this field references an external type (ApplyDefaults via reflection)\n\tIsNullableAlias bool   // True if type is a type alias to Nullable[T] (don't wrap or pointer)\n\tOrder           *int   // Optional field ordering (lower values come first)\n}\n```\nStructField represents a field in a generated Go struct.\n\n```go\ntype StructTagGenerator struct {\n\t// contains filtered or unexported fields\n}\n```\nStructTagGenerator generates struct tags from templates.\n\n```go\nfunc NewStructTagGenerator(config StructTagsConfig) *StructTagGenerator\n```\nNewStructTagGenerator creates a generator from the configuration. Invalid templates are silently skipped.\n\n```go\nfunc (g *StructTagGenerator) GenerateTags(info StructTagInfo) string\n```\nGenerateTags generates the complete struct tag string for a field. Returns a string like \\`json:\"name,omitempty\" yaml:\"name,omitempty\"\\`.\n\n```go\nfunc (g *StructTagGenerator) GenerateTagsMap(info StructTagInfo) map[string]string\n```\nGenerateTagsMap generates tags as a map for cases where we need to add extra tags. Returns a map of tag name -\u003e tag value (without quotes).\n\n```go\ntype StructTagInfo struct {\n\t// FieldName is the JSON/YAML field name (from the OpenAPI property name)\n\tFieldName string\n\t// IsOptional is true if the field is optional (not required)\n\tIsOptional bool\n}\n```\nStructTagInfo contains the data available to struct tag templates. Extension-driven concerns (omitzero, json-ignore, omitempty overrides) are applied as post-processing in generateFieldTag, not exposed here.\n\n```go\ntype StructTagTemplate struct {\n\t// Name is the tag name (e.g., \"json\", \"yaml\", \"form\")\n\tName string `yaml:\"name\"`\n\t// Template is a Go text/template that produces the tag value.\n\t// Available fields: .FieldName, .IsOptional\n\t// Example: `{{ .FieldName }}{{if .IsOptional}},omitempty{{end}}`\n\tTemplate string `yaml:\"template\"`\n}\n```\nStructTagTemplate defines a single struct tag with a name and template.\n\n```go\ntype StructTagsConfig struct {\n\t// Tags is the list of tags to generate for struct fields.\n\t// Order is preserved in the generated output.\n\tTags []StructTagTemplate `yaml:\"tags,omitempty\"`\n}\n```\nStructTagsConfig configures struct tag generation.\n\n```go\nfunc DefaultStructTagsConfig() StructTagsConfig\n```\nDefaultStructTagsConfig returns the default struct tag configuration. By default, json and form tags are generated. Extension-driven concerns (omitzero, json-ignore, omitempty overrides) are handled by post-processing in generateFieldTag, not in the templates.\n\n```go\nfunc (c StructTagsConfig) Merge(other StructTagsConfig) StructTagsConfig\n```\nMerge merges user config on top of this config by name. User entries override matching defaults; new entries are appended.\n\n```go\ntype TypeGenerator struct {\n\t// contains filtered or unexported fields\n}\n```\nTypeGenerator converts OpenAPI schemas to Go type expressions. It tracks required imports and handles recursive type references.\n\n```go\nfunc NewTypeGenerator(typeMapping TypeMapping, converter *NameConverter, importResolver *ImportResolver, tagGenerator *StructTagGenerator, ctx *CodegenContext) *TypeGenerator\n```\nNewTypeGenerator creates a TypeGenerator with the given configuration.\n\n```go\nfunc (g *TypeGenerator) AddImport(path string)\n```\nAddImport records an import path needed by the generated code.\n\n```go\nfunc (g *TypeGenerator) AddImportAlias(path, alias string)\n```\nAddImportAlias records an import path with an alias.\n\n```go\nfunc (g *TypeGenerator) AddJSONImport()\n```\nAddJSONImport adds encoding/json import (used by marshal/unmarshal code).\n\n```go\nfunc (g *TypeGenerator) AddJSONImports()\n```\nAddJSONImports adds encoding/json and fmt imports (used by oneOf marshal/unmarshal code).\n\n```go\nfunc (g *TypeGenerator) AdditionalPropertiesType(desc *SchemaDescriptor) string\n```\nAdditionalPropertiesType returns the Go type for the additionalProperties.\n\n```go\nfunc (g *TypeGenerator) GenerateStructFields(desc *SchemaDescriptor) []StructField\n```\nGenerateStructFields creates the list of struct fields for an object schema.\n\n```go\nfunc (g *TypeGenerator) GoTypeExpr(desc *SchemaDescriptor) string\n```\nGoTypeExpr returns the Go type expression for a schema descriptor. This handles references by looking up the target schema's name, and inline schemas by generating the appropriate Go type.\n\n```go\nfunc (g *TypeGenerator) HasAdditionalProperties(desc *SchemaDescriptor) bool\n```\nHasAdditionalProperties returns true if the schema has explicit additionalProperties.\n\n```go\nfunc (g *TypeGenerator) Imports() map[string]string\n```\nImports returns the collected imports as a map\\[path]alias.\n\n```go\nfunc (g *TypeGenerator) IndexSchemas(schemas []*SchemaDescriptor)\n```\nIndexSchemas builds a lookup table from JSON pointer to schema descriptor. This is called before generation to enable $ref resolution.\n\n```go\nfunc (g *TypeGenerator) TagGenerator() *StructTagGenerator\n```\nTagGenerator returns the struct tag generator.\n\n```go\ntype TypeMapping struct {\n\tInteger FormatMapping `yaml:\"integer,omitempty\"`\n\tNumber  FormatMapping `yaml:\"number,omitempty\"`\n\tBoolean FormatMapping `yaml:\"boolean,omitempty\"`\n\tString  FormatMapping `yaml:\"string,omitempty\"`\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 TypeOverride struct {\n\tTypeName    string // The Go type name (e.g., \"uuid.UUID\")\n\tImportPath  string // Import path (e.g., \"github.com/google/uuid\")\n\tImportAlias string // Optional import alias (e.g., \"foo\" for `import foo \"...\"`)\n}\n```\nTypeOverride represents an external type override with optional import.\n\n```go\ntype UnionMember struct {\n\tTypeName            string   // Go type name (e.g., \"Cat\")\n\tMethodName          string   // Suffix for As/From/Merge methods (e.g., \"Cat\")\n\tIndex               int      // Position in anyOf/oneOf array\n\tHasApplyDefaults    bool     // Whether this type has an ApplyDefaults method\n\tDiscriminatorValues []string // Discriminator mapping keys for this variant (empty if unmapped)\n}\n```\nUnionMember represents a member of a union type (anyOf/oneOf).\n\n```go\ntype UnionTypeConfig struct {\n\tTypeName      string\n\tMembers       []UnionMember\n\tIsOneOf       bool\n\tDoc           string\n\tFixedFields   []StructField\n\tDiscriminator *DiscriminatorInfo\n\tTagGen        *StructTagGenerator\n\tHelperPrefix  string         // e.g., \"oapiCodegenHelpersPkg.\" or \"\" for embedded\n\tConverter     *NameConverter // for converting JSON property names to Go field names\n}\n```\nUnionTypeConfig holds all information needed to generate a union type.\n\n","path":"github.com/oapi-codegen/oapi-codegen-exp/experimental/codegen/internal","name":"codegen","synopsis":"Package codegen generates Go code from parsed OpenAPI specs.","isRedistributable":true}
