Versions in this module Expand all Collapse all v2 v2.4.4 Dec 21, 2024 v2.4.3 Dec 20, 2024 Changes in this version + var NameNormalizers = NameNormalizerMap + var TemplateFunctions = template.FuncMap + func DeprecationComment(reason string) string + func EscapePathElements(path string) string + func GenFieldsFromProperties(props []Property) []string + func GenStructFromAllOf(allOf []*openapi3.SchemaRef, path []string) (string, error) + func GenStructFromSchema(schema Schema) string + func Generate(spec *openapi3.T, opts Configuration) (string, error) + func GenerateAdditionalPropertyBoilerplate(t *template.Template, typeDefs []TypeDefinition) (string, error) + func GenerateBodyDefinitions(operationID string, bodyOrRef *openapi3.RequestBodyRef) ([]RequestBodyDefinition, []TypeDefinition, error) + func GenerateChiServer(t *template.Template, operations []OperationDefinition) (string, error) + func GenerateClient(t *template.Template, ops []OperationDefinition) (string, error) + func GenerateClientWithResponses(t *template.Template, ops []OperationDefinition) (string, error) + func GenerateConstants(t *template.Template, ops []OperationDefinition) (string, error) + func GenerateEchoServer(t *template.Template, operations []OperationDefinition) (string, error) + func GenerateEnums(t *template.Template, types []TypeDefinition) (string, error) + func GenerateFiberServer(t *template.Template, operations []OperationDefinition) (string, error) + func GenerateGinServer(t *template.Template, operations []OperationDefinition) (string, error) + func GenerateGorillaServer(t *template.Template, operations []OperationDefinition) (string, error) + func GenerateImports(t *template.Template, externalImports []string, packageName string, ...) (string, error) + func GenerateInlinedSpec(t *template.Template, importMapping importMap, swagger *openapi3.T) (string, error) + func GenerateIrisServer(t *template.Template, operations []OperationDefinition) (string, error) + func GenerateStdHTTPServer(t *template.Template, operations []OperationDefinition) (string, error) + func GenerateStrictResponses(t *template.Template, responses []ResponseDefinition) (string, error) + func GenerateStrictServer(t *template.Template, operations []OperationDefinition, opts Configuration) (string, error) + func GenerateTemplates(templates []string, t *template.Template, ops interface{}) (string, error) + func GenerateTypeDefinitions(t *template.Template, swagger *openapi3.T, ops []OperationDefinition, ...) (string, error) + func GenerateTypes(t *template.Template, types []TypeDefinition) (string, error) + func GenerateTypesForOperations(t *template.Template, ops []OperationDefinition) (string, error) + func GenerateUnionAndAdditionalProopertiesBoilerplate(t *template.Template, typeDefs []TypeDefinition) (string, error) + func GenerateUnionBoilerplate(t *template.Template, typeDefs []TypeDefinition) (string, error) + func GetParametersImports(params map[string]*openapi3.ParameterRef) (map[string]goImport, error) + func GetRequestBodiesImports(bodies map[string]*openapi3.RequestBodyRef) (map[string]goImport, error) + func GetResponsesImports(responses map[string]*openapi3.ResponseRef) (map[string]goImport, error) + func GetSchemaImports(schemas map[string]*openapi3.SchemaRef, excludeSchemas []string) (map[string]goImport, error) + func GetTypeDefinitionsImports(swagger *openapi3.T, excludeSchemas []string) (map[string]goImport, error) + func GetUserTemplateText(inputData string) (template string, err error) + func GoSchemaImports(schemas ...*openapi3.SchemaRef) (map[string]goImport, error) + func IsGoIdentity(str string) bool + func IsGoKeyword(str string) bool + func IsGoTypeReference(ref string) bool + func IsPredeclaredGoIdentifier(str string) bool + func IsValidGoIdentity(str string) bool + func IsWholeDocumentReference(ref string) bool + func LoadTemplates(src embed.FS, t *template.Template) error + func LowercaseFirstCharacter(str string) string + func LowercaseFirstCharacters(str string) string + func MergeImports(dst, src map[string]goImport) + func OperationImports(ops []OperationDefinition) (map[string]goImport, error) + func OperationSchemaImports(s *Schema) (map[string]goImport, error) + func OrderedParamsFromUri(uri string) []string + func ParseGoImportExtension(v *openapi3.SchemaRef) (*goImport, error) + func PathToTypeName(path []string) string + func PropertiesEqual(a, b Property) bool + func RefPathToGoType(refPath string) (string, error) + func RefPathToObjName(refPath string) string + func ReplacePathParamsWithStr(uri string) string + func SanitizeCode(goCode string) string + func SanitizeEnumNames(enumNames, enumValues []string) map[string]string + func SanitizeGoIdentity(str string) string + func SchemaHasAdditionalProperties(schema *openapi3.Schema) bool + func SchemaNameToTypeName(name string) string + func SetGlobalStateSpec(spec *openapi3.T) + func SortedMapKeys[T any](m map[string]T) []string + func SortedSchemaKeys(dict map[string]*openapi3.SchemaRef) []string + func StringInArray(str string, array []string) bool + func StringToGoComment(in string) string + func StringWithTypeNameToGoComment(in, typeName string) string + func SwaggerUriToChiUri(uri string) string + func SwaggerUriToEchoUri(uri string) string + func SwaggerUriToFiberUri(uri string) string + func SwaggerUriToGinUri(uri string) string + func SwaggerUriToGorillaUri(uri string) string + func SwaggerUriToIrisUri(uri string) string + func SwaggerUriToStdHttpUri(uri string) string + func ToCamelCase(str string) string + func ToCamelCaseWithDigits(s string) string + func ToCamelCaseWithInitialism(str string) string + func ToCamelCaseWithInitialisms(s string) string + func TypeDefinitionsEquivalent(t1, t2 TypeDefinition) bool + func UppercaseFirstCharacter(str string) string + func UppercaseFirstCharacterWithPkgName(str string) string + type AdditionalImport struct + Alias string + Package string + type CompatibilityOptions struct + AllowUnexportedStructFieldNames bool + AlwaysPrefixEnumValues bool + ApplyChiMiddlewareFirstToLast bool + ApplyGorillaMiddlewareFirstToLast bool + CircularReferenceLimit int + DisableFlattenAdditionalProperties bool + DisableRequiredReadOnlyAsPointer bool + OldAliasing bool + OldEnumConflicts bool + OldMergeSchemas bool + func (co CompatibilityOptions) Validate() map[string]string + type Configuration struct + AdditionalImports []AdditionalImport + Compatibility CompatibilityOptions + Generate GenerateOptions + ImportMapping map[string]string + NoVCSVersionOverride *string + OutputOptions OutputOptions + PackageName string + func (o Configuration) UpdateDefaults() Configuration + func (o Configuration) Validate() error + type Constants struct + EnumDefinitions []EnumDefinition + SecuritySchemeProviderNames []string + type Discriminator struct + Mapping map[string]string + Property string + func (d *Discriminator) JSONTag() string + func (d *Discriminator) PropertyName() string + type EnumDefinition struct + PrefixTypeName bool + Schema Schema + TypeName string + ValueWrapper string + func (e *EnumDefinition) GetValues() map[string]string + type FieldDescriptor struct + GoName string + GoType string + IsRef bool + JsonName string + Required bool + type GenerateOptions struct + ChiServer bool + Client bool + EchoServer bool + EmbeddedSpec bool + FiberServer bool + GinServer bool + GorillaServer bool + IrisServer bool + Models bool + StdHTTPServer bool + Strict bool + func (oo GenerateOptions) Validate() map[string]string + type NameNormalizer func(string) string + type NameNormalizerFunction string + const NameNormalizerFunctionToCamelCase + const NameNormalizerFunctionToCamelCaseWithDigits + const NameNormalizerFunctionToCamelCaseWithInitialisms + const NameNormalizerFunctionUnset + type NameNormalizerMap map[NameNormalizerFunction]NameNormalizer + func (m NameNormalizerMap) Options() []string + type OperationDefinition struct + Bodies []RequestBodyDefinition + BodyRequired bool + CookieParams []ParameterDefinition + HeaderParams []ParameterDefinition + Method string + OperationId string + Path string + PathParams []ParameterDefinition + QueryParams []ParameterDefinition + Responses []ResponseDefinition + SecurityDefinitions []SecurityDefinition + Spec *openapi3.Operation + Summary string + TypeDefinitions []TypeDefinition + func OperationDefinitions(swagger *openapi3.T, initialismOverrides bool) ([]OperationDefinition, error) + func (o *OperationDefinition) AllParams() []ParameterDefinition + func (o *OperationDefinition) GetResponseTypeDefinitions() ([]ResponseTypeDefinition, error) + func (o *OperationDefinition) HasBody() bool + func (o *OperationDefinition) Params() []ParameterDefinition + func (o *OperationDefinition) RequiresParamObject() bool + func (o *OperationDefinition) SummaryAsComment() string + func (o OperationDefinition) HasMaskedRequestContentTypes() bool + type OutputOptions struct + AdditionalInitialisms []string + ClientResponseBytesFunction bool + ClientTypeName string + DisableTypeAliasesForType []string + EnableYamlTags bool + ExcludeOperationIDs []string + ExcludeSchemas []string + ExcludeTags []string + IncludeOperationIDs []string + IncludeTags []string + InitialismOverrides bool + NameNormalizer string + NullableType bool + Overlay OutputOptionsOverlay + ResponseTypeSuffix string + SkipFmt bool + SkipPrune bool + UserTemplates map[string]string + func (oo OutputOptions) Validate() map[string]string + type OutputOptionsOverlay struct + Path string + Strict *bool + type ParameterDefinition struct + In string + ParamName string + Required bool + Schema Schema + Spec *openapi3.Parameter + func CombineOperationParameters(globalParams []ParameterDefinition, localParams []ParameterDefinition) ([]ParameterDefinition, error) + func DescribeParameters(params openapi3.Parameters, path []string) ([]ParameterDefinition, error) + func FilterParameterDefinitionByType(params []ParameterDefinition, in string) []ParameterDefinition + func SortParamsByPath(path string, in []ParameterDefinition) ([]ParameterDefinition, error) + func (pd *ParameterDefinition) Explode() bool + func (pd *ParameterDefinition) IsJson() bool + func (pd *ParameterDefinition) IsPassThrough() bool + func (pd *ParameterDefinition) IsStyled() bool + func (pd *ParameterDefinition) JsonTag() string + func (pd *ParameterDefinition) Style() string + func (pd ParameterDefinition) GoName() string + func (pd ParameterDefinition) GoVariableName() string + func (pd ParameterDefinition) IndirectOptional() bool + func (pd ParameterDefinition) TypeDef() string + type ParameterDefinitions []ParameterDefinition + func (p ParameterDefinitions) FindByName(name string) *ParameterDefinition + type Property struct + Deprecated bool + Description string + Extensions map[string]interface{} + JsonFieldName string + NeedsFormTag bool + Nullable bool + ReadOnly bool + Required bool + Schema Schema + WriteOnly bool + func (p Property) GoFieldName() string + func (p Property) GoTypeDef() string + type RefWrapper struct + HasValue bool + Ref string + SourceRef interface{} + type RequestBodyDefinition struct + ContentType string + Default bool + Encoding map[string]RequestBodyEncoding + NameTag string + Required bool + Schema Schema + func (r RequestBodyDefinition) CustomType() bool + func (r RequestBodyDefinition) IsFixedContentType() bool + func (r RequestBodyDefinition) IsJSON() bool + func (r RequestBodyDefinition) IsSupported() bool + func (r RequestBodyDefinition) IsSupportedByClient() bool + func (r RequestBodyDefinition) Suffix() string + func (r RequestBodyDefinition) TypeDef(opID string) *TypeDefinition + type RequestBodyEncoding struct + ContentType string + Explode *bool + Style string + type ResponseContentDefinition struct + ContentType string + NameTag string + Schema Schema + func (r ResponseContentDefinition) HasFixedContentType() bool + func (r ResponseContentDefinition) IsJSON() bool + func (r ResponseContentDefinition) IsSupported() bool + func (r ResponseContentDefinition) NameTagOrContentType() string + func (r ResponseContentDefinition) TypeDef(opID string, statusCode int) *TypeDefinition + type ResponseDefinition struct + Contents []ResponseContentDefinition + Description string + Headers []ResponseHeaderDefinition + Ref string + StatusCode string + func GenerateResponseDefinitions(operationID string, responses map[string]*openapi3.ResponseRef) ([]ResponseDefinition, error) + func (r ResponseDefinition) GoName() string + func (r ResponseDefinition) HasFixedStatusCode() bool + func (r ResponseDefinition) IsExternalRef() bool + func (r ResponseDefinition) IsRef() bool + type ResponseHeaderDefinition struct + GoName string + Name string + Schema Schema + type ResponseTypeDefinition struct + AdditionalTypeDefinitions []TypeDefinition + ContentTypeName string + ResponseName string + type Schema struct + AdditionalPropertiesType *Schema + AdditionalTypes []TypeDefinition + ArrayType *Schema + DefineViaAlias bool + Description string + Discriminator *Discriminator + EnumValues map[string]string + GoType string + HasAdditionalProperties bool + OAPISchema *openapi3.Schema + Properties []Property + RefType string + SkipOptionalPointer bool + UnionElements []UnionElement + func GenerateGoSchema(sref *openapi3.SchemaRef, path []string) (Schema, error) + func MergeSchemas(allOf []*openapi3.SchemaRef, path []string) (Schema, error) + func (s *Schema) AddProperty(p Property) error + func (s Schema) GetAdditionalTypeDefs() []TypeDefinition + func (s Schema) IsExternalRef() bool + func (s Schema) IsRef() bool + func (s Schema) TypeDecl() string + type SchemaDescriptor struct + AdditionalPropertiesType string + Fields []FieldDescriptor + HasAdditionalProperties bool + type SecurityDefinition struct + ProviderName string + Scopes []string + func DescribeSecurityDefinition(securityRequirements openapi3.SecurityRequirements) []SecurityDefinition + type TypeDefinition struct + JsonName string + Schema Schema + TypeName string + func GenerateParamsTypes(op OperationDefinition) []TypeDefinition + func GenerateTypeDefsForOperation(op OperationDefinition) []TypeDefinition + func GenerateTypesForParameters(t *template.Template, params map[string]*openapi3.ParameterRef) ([]TypeDefinition, error) + func GenerateTypesForRequestBodies(t *template.Template, bodies map[string]*openapi3.RequestBodyRef) ([]TypeDefinition, error) + func GenerateTypesForResponses(t *template.Template, responses openapi3.ResponseBodies) ([]TypeDefinition, error) + func GenerateTypesForSchemas(t *template.Template, schemas map[string]*openapi3.SchemaRef, ...) ([]TypeDefinition, error) + func (t *TypeDefinition) IsAlias() bool + type UnionElement string + func (u UnionElement) Method() string + func (u UnionElement) String() string