Versions in this module Expand all Collapse all v1 v1.3.12 Aug 5, 2020 Changes in this version + var TemplateFunctions = template.FuncMap + func GenFieldsFromProperties(props []Property) []string + func GenStructFromAllOf(allOf []*openapi3.SchemaRef, path []string) (string, error) + func GenStructFromSchema(schema Schema) string + func Generate(swagger *openapi3.Swagger, packageName string, opts Options) (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 GenerateEchoServer(t *template.Template, operations []OperationDefinition) (string, error) + func GenerateImports(t *template.Template, imports []string, packageName string) (string, error) + func GenerateInlinedSpec(t *template.Template, swagger *openapi3.Swagger) (string, error) + func GenerateRegistration(t *template.Template, ops []OperationDefinition) (string, error) + func GenerateServerInterface(t *template.Template, ops []OperationDefinition) (string, error) + func GenerateTypeDefinitions(t *template.Template, swagger *openapi3.Swagger, ops []OperationDefinition, ...) (string, error) + func GenerateTypes(t *template.Template, types []TypeDefinition) (string, error) + func GenerateTypesForOperations(t *template.Template, ops []OperationDefinition) (string, error) + func GenerateWrappers(t *template.Template, ops []OperationDefinition) (string, error) + func IsGoIdentity(str string) bool + func IsGoKeyword(str string) bool + func IsPredeclaredGoIdentifier(str string) bool + func IsValidGoIdentity(str string) bool + func LowercaseFirstCharacter(str string) string + func OrderedParamsFromUri(uri string) []string + 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 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 SortedStringKeys(dict map[string]string) []string + func StringInArray(str string, array []string) bool + func StringToGoComment(in string) string + func SwaggerUriToChiUri(uri string) string + func SwaggerUriToEchoUri(uri string) string + func ToCamelCase(str string) string + func UppercaseFirstCharacter(str string) string + type FieldDescriptor struct + GoName string + GoType string + IsRef bool + JsonName string + Required bool + type OperationDefinition struct + Bodies []RequestBodyDefinition + BodyRequired bool + CookieParams []ParameterDefinition + HeaderParams []ParameterDefinition + Method string + OperationId string + Path string + PathParams []ParameterDefinition + QueryParams []ParameterDefinition + SecurityDefinitions []SecurityDefinition + Spec *openapi3.Operation + Summary string + TypeDefinitions []TypeDefinition + func OperationDefinitions(swagger *openapi3.Swagger) ([]OperationDefinition, error) + func (o *OperationDefinition) AllParams() []ParameterDefinition + func (o *OperationDefinition) GetResponseTypeDefinitions() ([]TypeDefinition, error) + func (o *OperationDefinition) HasBody() bool + func (o *OperationDefinition) Params() []ParameterDefinition + func (o *OperationDefinition) RequiresParamObject() bool + func (o *OperationDefinition) SummaryAsComment() string + type Options struct + EmbedSpec bool + ExcludeSchemas []string + ExcludeTags []string + GenerateChiServer bool + GenerateClient bool + GenerateEchoServer bool + GenerateTypes bool + ImportMapping map[string]string + IncludeTags []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 + JsonFieldName string + Nullable bool + Required bool + Schema Schema + 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 + NameTag string + Required bool + Schema Schema + func (r RequestBodyDefinition) CustomType() bool + func (r RequestBodyDefinition) Suffix() string + func (r RequestBodyDefinition) TypeDef() string + type Schema struct + AdditionalPropertiesType *Schema + AdditionalTypes []TypeDefinition + EnumValues map[string]string + GoType string + HasAdditionalProperties bool + Properties []Property + RefType string + SkipOptionalPointer bool + func GenerateGoSchema(sref *openapi3.SchemaRef, path []string) (Schema, error) + func MergeSchemas(allOf []*openapi3.SchemaRef, path []string) (Schema, error) + func (s *Schema) MergeProperty(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 + ResponseName 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)