Versions in this module Expand all Collapse all v1 v1.1000.1 Oct 29, 2022 Changes in this version + var TemplateFunctions = template.FuncMap + 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 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 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 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 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 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 ReplacePathParamsWithStr(uri string) string + func SanitizeCode(goCode string) string + func SanitizeEnumNames(enumNames []string) map[string]string + func SanitizeGoIdentity(str string) string + func SchemaHasAdditionalProperties(schema *openapi3.Schema) bool + func SchemaNameToTypeName(name string) string + func SortedContentKeys(dict openapi3.Content) []string + func SortedHeadersKeys(dict openapi3.Headers) []string + func SortedOperationsKeys(dict map[string]*openapi3.Operation) []string + func SortedParameterKeys(dict map[string]*openapi3.ParameterRef) []string + func SortedPathsKeys(dict openapi3.Paths) []string + func SortedRequestBodyKeys(dict map[string]*openapi3.RequestBodyRef) []string + func SortedResponsesKeys(dict openapi3.Responses) []string + func SortedSchemaKeys(dict map[string]*openapi3.SchemaRef) []string + func SortedSecurityRequirementKeys(sr openapi3.SecurityRequirement) []string + func SortedStringKeys(dict map[string]string) []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 ToCamelCase(str string) string + func UppercaseFirstCharacter(str string) string + func UppercaseFirstCharacterWithPkgName(str string) string + type AdditionalImport struct + Alias string + Package string + type CompatibilityOptions struct + AlwaysPrefixEnumValues bool + ApplyChiMiddlewareFirstToLast bool + DisableFlattenAdditionalProperties bool + DisableRequiredReadOnlyAsPointer bool + OldAliasing bool + OldEnumConflicts bool + OldMergeSchemas bool + type Configuration struct + AdditionalImports []AdditionalImport + Compatibility CompatibilityOptions + Generate GenerateOptions + ImportMapping map[string]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 + GinServer bool + GorillaServer bool + Models bool + Strict bool + 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) ([]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 + ClientTypeName string + ExcludeSchemas []string + ExcludeTags []string + IncludeTags []string + ResponseTypeSuffix string + SkipFmt bool + SkipPrune bool + UserTemplates map[string]string + type ParameterDefinition struct + In string + ParamName string + Required bool + Schema Schema + Spec *openapi3.Parameter + 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 + Description string + ExtensionProps *openapi3.ExtensionProps + 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) 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) 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 openapi3.Responses) ([]ResponseDefinition, error) + func (r ResponseDefinition) GoName() string + func (r ResponseDefinition) HasFixedStatusCode() bool + func (r ResponseDefinition) IsRef() bool + type ResponseHeaderDefinition struct + GoName string + Name string + Schema Schema + type ResponseTypeDefinition struct + 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) 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.Responses) ([]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