Versions in this module Expand all Collapse all v0 v0.2.0 Oct 12, 2023 v0.1.0 Oct 12, 2023 Changes in this version + var Debug = os.Getenv("DEBUG") != "" || os.Getenv("SWAGGER_DEBUG") != "" + var DefaultLanguageFunc func() *LanguageOpts + var FuncMapFunc func(*LanguageOpts) template.FuncMap + func AddFile(name, data string) error + func Asset(name string) ([]byte, error) + func AssetNames() []string + func BytesToYAMLv2Doc(data []byte) (interface{}, error) + func DefaultFuncMap(lang *LanguageOpts) template.FuncMap + func DefaultSectionOpts(gen *GenOpts) + func GenerateClient(name string, modelNames, operationIDs []string, opts *GenOpts) error + func GenerateDefinition(modelNames []string, opts *GenOpts) error + func GenerateMarkdown(output string, modelNames, operationIDs []string, opts *GenOpts) error + func GenerateModels(modelNames []string, opts *GenOpts) error + func GenerateServer(name string, modelNames, operationIDs []string, opts *GenOpts) error + func GenerateServerOperation(operationNames []string, opts *GenOpts) error + func GenerateSupport(name string, modelNames, operationIDs []string, opts *GenOpts) error + func MarkdownSectionOpts(gen *GenOpts, output string) + func MustAsset(name string) []byte + func ReadConfig(fpath string) (*viper.Viper, error) + func WithAutoXOrder(specPath string) string + type GenApp struct + APIPackage string + APIPackageAlias string + BasePath string + Consumes GenSerGroups + DefaultConsumes string + DefaultImports map[string]string + DefaultProduces string + ExcludeSpec bool + ExternalDocs *spec.ExternalDocumentation + ExtraSchemes []string + FlatSwaggerJSON string + GenOpts *GenOpts + Host string + ImplementationPackageAlias string + Imports map[string]string + Info *spec.Info + Models []GenDefinition + Name string + OperationGroups GenOperationGroups + Operations GenOperations + Package string + Principal string + PrincipalIsNullable bool + Produces GenSerGroups + ReceiverName string + Schemes []string + SecurityDefinitions GenSecuritySchemes + SecurityRequirements []analysis.SecurityRequirement + ServerPackageAlias string + SwaggerJSON string + Tags []spec.Tag + func (g *GenApp) UseFlags() bool + func (g *GenApp) UseGoStructFlags() bool + func (g *GenApp) UseIntermediateMode() bool + func (g *GenApp) UseModernMode() bool + func (g *GenApp) UsePFlags() bool + type GenCommon struct + Copyright string + TargetImportPath string + type GenDefinition struct + DefaultImports map[string]string + DependsOn []string + External bool + ExtraSchemas GenSchemaList + Imports map[string]string + Package string + func (rt GenDefinition) Zero() string + type GenDefinitions []GenDefinition + func (g GenDefinitions) Len() int + func (g GenDefinitions) Less(i, j int) bool + func (g GenDefinitions) Swap(i, j int) + type GenHeader struct + Child *GenItems + CollectionFormat string + Converter string + Default interface{} + Description string + Formatter string + HasDefault bool + ID string + IndexVar string + Name string + Package string + Parent *GenItems + Path string + ReceiverName string + Title string + ValueExpression string + ZeroValue string + func (h *GenHeader) ItemsDepth() string + func (h GenHeader) ToString() string + func (rt GenHeader) Zero() string + type GenHeaders []GenHeader + func (g GenHeaders) HasSomeDefaults() bool + func (g GenHeaders) Len() int + func (g GenHeaders) Less(i, j int) bool + func (g GenHeaders) Swap(i, j int) + type GenItems struct + Child *GenItems + CollectionFormat string + Converter string + Formatter string + IndexVar string + KeyVar string + Location string + Name string + NeedsIndex bool + Parent *GenItems + Path string + SkipParse bool + ValueExpression string + func (g *GenItems) ItemsDepth() string + func (g GenItems) ToString() string + func (g GenItems) UnderlyingType() string + func (rt GenItems) Zero() string + type GenOperation struct + Authorized bool + BasePath string + Consumes []string + ConsumesMediaTypes []string + DefaultImports map[string]string + DefaultResponse *GenResponse + Description string + Extensions map[string]interface{} + ExternalDocs *spec.ExternalDocumentation + ExtraSchemas GenSchemaList + ExtraSchemeOverrides []string + ExtraSchemes []string + FormParams GenParameters + HasBodyParams bool + HasFileParams bool + HasFormParams bool + HasFormValueParams bool + HasHeaderParams bool + HasPathParams bool + HasQueryParams bool + HasStreamingResponse bool + HeaderParams GenParameters + Imports map[string]string + Method string + Name string + Package string + PackageAlias string + Params GenParameters + Path string + PathParams GenParameters + Principal string + PrincipalIsNullable bool + Produces []string + ProducesMediaTypes []string + QueryParams GenParameters + ReceiverName string + Responses GenStatusCodeResponses + RootPackage string + SchemeOverrides []string + Schemes []string + Security []GenSecurityRequirements + SecurityDefinitions GenSecuritySchemes + SecurityRequirements []analysis.SecurityRequirement + StrictResponders bool + SuccessResponse *GenResponse + SuccessResponses []GenResponse + Summary string + Tags []string + TimeoutName string + UseTags bool + type GenOperationGroup struct + DefaultImports map[string]string + Description string + GenOpts *GenOpts + Imports map[string]string + Name string + Operations GenOperations + PackageAlias string + RootPackage string + Summary string + type GenOperationGroups []GenOperationGroup + func (g GenOperationGroups) Len() int + func (g GenOperationGroups) Less(i, j int) bool + func (g GenOperationGroups) Swap(i, j int) + type GenOperations []GenOperation + func (g GenOperations) Len() int + func (g GenOperations) Less(i, j int) bool + func (g GenOperations) Swap(i, j int) + type GenOpts struct + TemplatePlugin string + func (g *GenOpts) CheckOpts() error + func (g *GenOpts) EnsureDefaults() error + func (g *GenOpts) PrincipalAlias() string + func (g *GenOpts) PrincipalIsNullable() bool + func (g *GenOpts) SpecPath() string + func (g *GenOpts) TargetPath() string + type GenOptsCommon struct + APIPackage string + AcceptDefinitionsOnly bool + AllowEnumCI bool + AllowTemplateOverride bool + CliAppName string + CliPackage string + ClientPackage string + CompatibilityMode string + Copyright string + DefaultConsumes string + DefaultProduces string + DefaultScheme string + DumpData bool + ExcludeSpec bool + ExistingModels string + FlagStrategy string + FlattenOpts *analysis.FlattenOpts + IgnoreOperations bool + ImplementationPackage string + Imports map[string]string + IncludeCLi bool + IncludeHandler bool + IncludeMain bool + IncludeModel bool + IncludeParameters bool + IncludeResponses bool + IncludeSupport bool + IncludeURLBuilder bool + IncludeValidator bool + IsClient bool + LanguageOpts *LanguageOpts + MainPackage string + ModelPackage string + Models []string + Name string + Operations []string + Principal string + PrincipalCustomIface bool + PropertiesSpecOrder bool + RegenerateConfigureAPI bool + Sections SectionOpts + ServerPackage string + SkipTagPackages bool + Spec string + StrictAdditionalProperties bool + StrictResponders bool + StructTags []string + Tags []string + Target string + Template string + TemplateDir string + TypeMapping map[string]string + ValidateSpec bool + WithXML bool + type GenParameter struct + AllowEmptyValue bool + Child *GenItems + CollectionFormat string + Converter string + CustomTag string + Default interface{} + Description string + Extensions map[string]interface{} + Formatter string + HasDefault bool + HasModelBodyItems bool + HasModelBodyMap bool + HasModelBodyParams bool + HasSimpleBodyItems bool + HasSimpleBodyMap bool + HasSimpleBodyParams bool + ID string + IndexVar string + KeyVar string + Location string + ModelsPackage string + Name string + Parent *GenItems + Path string + ReceiverName string + Schema *GenSchema + Title string + ValueExpression string + ZeroValue string + func (g *GenParameter) IsBodyParam() bool + func (g *GenParameter) IsFileParam() bool + func (g *GenParameter) IsFormParam() bool + func (g *GenParameter) IsHeaderParam() bool + func (g *GenParameter) IsPathParam() bool + func (g *GenParameter) IsQueryParam() bool + func (g *GenParameter) ItemsDepth() string + func (g GenParameter) ToString() string + func (g GenParameter) UnderlyingType() string + func (rt GenParameter) Zero() string + type GenParameters []GenParameter + func (g GenParameters) HasSomeDefaults() bool + func (g GenParameters) Len() int + func (g GenParameters) Less(i, j int) bool + func (g GenParameters) Swap(i, j int) + type GenResponse struct + AllowsForStreaming bool + Code int + DefaultImports map[string]string + Description string + Examples GenResponseExamples + Extensions map[string]interface{} + Headers GenHeaders + Imports map[string]string + IsSuccess bool + Method string + ModelsPackage string + Name string + OperationName string + Package string + Path string + ReceiverName string + Schema *GenSchema + StrictResponders bool + type GenResponseExample struct + Example interface{} + MediaType string + type GenResponseExamples []GenResponseExample + func (g GenResponseExamples) Len() int + func (g GenResponseExamples) Less(i, j int) bool + func (g GenResponseExamples) Swap(i, j int) + type GenSchema struct + AdditionalItems *GenSchema + AdditionalProperties *GenSchema + AllOf GenSchemaList + AllowsAdditionalItems bool + CustomTag string + Default interface{} + Description string + Discriminates map[string]string + DiscriminatorField string + DiscriminatorValue string + Example string + ExternalDocs *spec.ExternalDocumentation + ExtraImports map[string]string + HasAdditionalItems bool + HasAdditionalProperties bool + HasBaseType bool + IncludeModel bool + IncludeValidator bool + IndexVar string + IsAdditionalProperties bool + IsBaseType bool + IsExported bool + IsSubType bool + IsVirtual bool + Items *GenSchema + KeyVar string + Location string + Name string + Object *GenSchema + OriginalName string + Parents []string + Path string + Properties GenSchemaList + ReadOnly bool + ReceiverName string + StrictAdditionalProperties bool + StructTags []string + Suffix string + Title string + ValueExpression string + WantsMarshalBinary bool + XMLName string + func (g GenSchema) PrintTags() string + func (g GenSchema) ToString() string + func (g GenSchema) UnderlyingType() string + func (rt GenSchema) Zero() string + type GenSchemaList []GenSchema + func (g GenSchemaList) Len() int + func (g GenSchemaList) Less(i, j int) bool + func (g GenSchemaList) Swap(i, j int) + type GenSecurityRequirement struct + Name string + Scopes []string + type GenSecurityRequirements []GenSecurityRequirement + func (g GenSecurityRequirements) Len() int + func (g GenSecurityRequirements) Less(i, j int) bool + func (g GenSecurityRequirements) Swap(i, j int) + type GenSecurityScheme struct + AppName string + AuthorizationURL string + Description string + Extensions map[string]interface{} + Flow string + ID string + In string + IsAPIKeyAuth bool + IsBasicAuth bool + IsOAuth2 bool + Name string + Principal string + PrincipalIsNullable bool + ReceiverName string + Scopes []string + ScopesDesc []GenSecurityScope + Source string + TokenURL string + Type string + type GenSecuritySchemes []GenSecurityScheme + func (g GenSecuritySchemes) Len() int + func (g GenSecuritySchemes) Less(i, j int) bool + func (g GenSecuritySchemes) Swap(i, j int) + type GenSecurityScope struct + Description string + Name string + type GenSerGroup struct + AllSerializers GenSerializers + type GenSerGroups []GenSerGroup + func (g GenSerGroups) Len() int + func (g GenSerGroups) Less(i, j int) bool + func (g GenSerGroups) Swap(i, j int) + type GenSerializer struct + AppName string + Implementation string + MediaType string + Name string + Parameters []string + ReceiverName string + type GenSerializers []GenSerializer + func (g GenSerializers) Len() int + func (g GenSerializers) Less(i, j int) bool + func (g GenSerializers) Swap(i, j int) + type GenStatusCodeResponses []GenResponse + func (g *GenStatusCodeResponses) UnmarshalJSON(data []byte) error + func (g GenStatusCodeResponses) Len() int + func (g GenStatusCodeResponses) Less(i, j int) bool + func (g GenStatusCodeResponses) MarshalJSON() ([]byte, error) + func (g GenStatusCodeResponses) Swap(i, j int) + type LanguageConfig map[string]LanguageDefinition + type LanguageDefinition struct + Layout SectionOpts + func (d *LanguageDefinition) ConfigureOpts(opts *GenOpts) error + type LanguageOpts struct + ArrayInitializerFunc func(interface{}) (string, error) + BaseImportFunc func(string) string + ImportsFunc func(map[string]string) string + ReservedWords []string + func GoLangOpts() *LanguageOpts + func MarkdownOpts() *LanguageOpts + func (l *LanguageOpts) FormatContent(name string, content []byte) ([]byte, error) + func (l *LanguageOpts) Init() + func (l *LanguageOpts) MangleFileName(name string) string + func (l *LanguageOpts) MangleName(name, suffix string) string + func (l *LanguageOpts) ManglePackageName(name, suffix string) string + func (l *LanguageOpts) ManglePackagePath(name string, suffix string) string + func (l *LanguageOpts) MangleVarName(name string) string + type Repository struct + func NewRepository(funcs template.FuncMap) *Repository + func (t *Repository) AddFile(name, data string) error + func (t *Repository) DumpTemplates() + func (t *Repository) Get(name string) (*template.Template, error) + func (t *Repository) LoadContrib(name string) error + func (t *Repository) LoadDefaults() + func (t *Repository) LoadDir(templatePath string) error + func (t *Repository) LoadPlugin(pluginPath string) error + func (t *Repository) MustGet(name string) *template.Template + func (t *Repository) SetAllowOverride(value bool) + func (t *Repository) ShallowClone() *Repository + type SectionOpts struct + Application []TemplateOpts + Models []TemplateOpts + OperationGroups []TemplateOpts + Operations []TemplateOpts + type TemplateOpts struct + FileName string + Name string + SkipExists bool + SkipFormat bool + Source string + Target string