Versions in this module Expand all Collapse all v1 v1.8.1 Aug 21, 2024 Changes in this version + const ANY + const ARRAY + const BOOLEAN + const CamelCase + const ERROR + const FUNC + const INTEGER + const INTERFACE + const IgnoreNameOverridePrefix + const NIL + const NUMBER + const Name + const OBJECT + const PRIMITIVE + const ParseAll + const ParseModels + const ParseNone + const ParseOperations + const PascalCase + const STRING + const SnakeCase + const Version + var ErrFailedConvertPrimitiveType = errors.New("swag property: failed convert primitive type") + var ErrFuncTypeField = errors.New("field type is func") + var ErrRecursiveParseStruct = errors.New("recursively parsing struct") + var ErrSkippedField = errors.New("field is skipped by global overrides") + func BuildCustomSchema(types []string) (*spec.Schema, error) + func CheckSchemaType(typeName string) error + func EvaluateBinary(x, y interface{}, operator token.Token, xtype, ytype ast.Expr) (interface{}, ast.Expr) + func EvaluateDataConversion(x interface{}, typeName string) interface + func EvaluateEscapedChar(text string) rune + func EvaluateEscapedString(text string) string + func EvaluateUnary(x interface{}, operator token.Token, xtype ast.Expr) (interface{}, ast.Expr) + func FieldsByAnySpace(s string, n int) []string + func FieldsFunc(s string, f func(rune2 rune) bool, n int) []string + func IsComplexSchema(schema *spec.Schema) bool + func IsGolangPrimitiveType(typeName string) bool + func IsInterfaceLike(typeName string) bool + func IsNumericType(typeName string) bool + func IsPrimitiveType(typeName string) bool + func IsRefSchema(schema *spec.Schema) bool + func IsSimplePrimitiveType(typeName string) bool + func MergeSchema(dst *spec.Schema, src *spec.Schema) *spec.Schema + func ParseUsingGoList(enabled bool) func(parser *Parser) + func PrimitiveSchema(refType string) *spec.Schema + func ReadDoc(optionalName ...string) (string, error) + func RefSchema(refType string) *spec.Schema + func Register(name string, swagger Swagger) + func SetCodeExampleFilesDirectory(directoryPath string) func(*Operation) + func SetCodeExamplesDirectory(directoryPath string) func(*Parser) + func SetCollectionFormat(collectionFormat string) func(*Parser) + func SetDebugger(logger Debugger) func(parser *Parser) + func SetExcludedDirsAndFiles(excludes string) func(*Parser) + func SetFieldParserFactory(factory FieldParserFactory) func(parser *Parser) + func SetMarkdownFileDirectory(directoryPath string) func(*Parser) + func SetOverrides(overrides map[string]string) func(parser *Parser) + func SetPackagePrefix(packagePrefix string) func(*Parser) + func SetParseDependency(parseDependency int) func(*Parser) + func SetParseExtension(parseExtension string) func(*Parser) + func SetStrict(strict bool) func(*Parser) + func SetTags(include string) func(*Parser) + func TransToValidCollectionFormat(format string) string + func TransToValidSchemeType(typeName string) string + type AstFileInfo struct + File *ast.File + FileSet *token.FileSet + PackagePath string + ParseFlag ParseFlag + Path string + type ConstVariable struct + Comment *ast.CommentGroup + File *ast.File + Name *ast.Ident + Pkg *PackageDefinitions + Type ast.Expr + Value interface{} + type ConstVariableGlobalEvaluator interface + EvaluateConstValue func(pkg *PackageDefinitions, cv *ConstVariable, recursiveStack map[string]struct{}) (interface{}, ast.Expr) + EvaluateConstValueByName func(file *ast.File, pkgPath, constVariableName string, ...) (interface{}, ast.Expr) + FindTypeSpec func(typeName string, file *ast.File) *TypeSpecDef + type Debugger interface + Printf func(format string, v ...interface{}) + type EnumValue struct + Comment string + Value interface{} + type FieldParser interface + ComplementSchema func(schema *spec.Schema) error + CustomSchema func() (*spec.Schema, error) + FieldName func() (string, error) + FormName func() string + HeaderName func() string + IsRequired func() (bool, error) + PathName func() string + ShouldSkip func() bool + type FieldParserFactory func(ps *Parser, field *ast.Field) FieldParser + type Formatter struct + func NewFormatter() *Formatter + func (f *Formatter) Format(fileName string, contents []byte) ([]byte, error) + type Operation struct + RouterProperties []RouteProperties + State string + func NewOperation(parser *Parser, options ...func(*Operation)) *Operation + func (operation *Operation) AddResponse(code int, response *spec.Response) + func (operation *Operation) DefaultResponse() *spec.Response + func (operation *Operation) ParseAcceptComment(commentLine string) error + func (operation *Operation) ParseCodeSample(attribute, _, lineRemainder string) error + func (operation *Operation) ParseComment(comment string, astFile *ast.File) error + func (operation *Operation) ParseDescriptionComment(lineRemainder string) + func (operation *Operation) ParseEmptyResponseComment(commentLine string) error + func (operation *Operation) ParseEmptyResponseOnly(commentLine string) error + func (operation *Operation) ParseMetadata(attribute, lowerAttribute, lineRemainder string) error + func (operation *Operation) ParseParamComment(commentLine string, astFile *ast.File) error + func (operation *Operation) ParseProduceComment(commentLine string) error + func (operation *Operation) ParseResponseComment(commentLine string, astFile *ast.File) error + func (operation *Operation) ParseResponseHeaderComment(commentLine string, _ *ast.File) error + func (operation *Operation) ParseRouterComment(commentLine string, deprecated bool) error + func (operation *Operation) ParseSecurityComment(commentLine string) error + func (operation *Operation) ParseStateComment(lineRemainder string) + func (operation *Operation) ParseTagsComment(commentLine string) + type PackageDefinitions struct + ConstTable map[string]*ConstVariable + Files map[string]*ast.File + Name string + OrderedConst []*ConstVariable + Path string + TypeDefinitions map[string]*TypeSpecDef + func NewPackageDefinitions(name, pkgPath string) *PackageDefinitions + func (pkg *PackageDefinitions) AddConst(astFile *ast.File, valueSpec *ast.ValueSpec) *PackageDefinitions + func (pkg *PackageDefinitions) AddFile(pkgPath string, file *ast.File) *PackageDefinitions + func (pkg *PackageDefinitions) AddTypeSpec(name string, typeSpec *TypeSpecDef) *PackageDefinitions + type PackagesDefinitions struct + func NewPackagesDefinitions() *PackagesDefinitions + func (pkgDefs *PackagesDefinitions) EvaluateConstValue(pkg *PackageDefinitions, cv *ConstVariable, recursiveStack map[string]struct{}) (interface{}, ast.Expr) + func (pkgDefs *PackagesDefinitions) EvaluateConstValueByName(file *ast.File, pkgName, constVariableName string, ...) (interface{}, ast.Expr) + func (pkgDefs *PackagesDefinitions) FindTypeSpec(typeName string, file *ast.File) *TypeSpecDef + func (pkgDefs *PackagesDefinitions) ParseFile(packageDir, path string, src interface{}, flag ParseFlag) error + func (pkgDefs *PackagesDefinitions) ParseTypes() (map[*TypeSpecDef]*Schema, error) + func (pkgDefs *PackagesDefinitions) RangeFiles(handle func(info *AstFileInfo) error) error + type ParseFlag int + type Parser struct + HostState string + Overrides map[string]string + ParseDependency ParseFlag + ParseFuncBody bool + ParseInternal bool + ParseVendor bool + PropNamingStrategy string + RequiredByDefault bool + Strict bool + func New(options ...func(*Parser)) *Parser + func (parser *Parser) GetSchemaTypePath(schema *spec.Schema, depth int) []string + func (parser *Parser) GetSwagger() *spec.Swagger + func (parser *Parser) ParseAPI(searchDir string, mainAPIFile string, parseDepth int) error + func (parser *Parser) ParseAPIMultiSearchDir(searchDirs []string, mainAPIFile string, parseDepth int) error + func (parser *Parser) ParseAcceptComment(commentLine string) error + func (parser *Parser) ParseDefinition(typeSpecDef *TypeSpecDef) (*Schema, error) + func (parser *Parser) ParseGeneralAPIInfo(mainAPIFile string) error + func (parser *Parser) ParseProduceComment(commentLine string) error + func (parser *Parser) ParseRouterAPIInfo(fileInfo *AstFileInfo) error + func (parser *Parser) Skip(path string, f os.FileInfo) error + type RouteProperties struct + Deprecated bool + HTTPMethod string + Path string + type Schema struct + Name string + PkgPath string + type Spec struct + BasePath string + Description string + Host string + InfoInstanceName string + LeftDelim string + RightDelim string + Schemes []string + SwaggerTemplate string + Title string + Version string + func (i *Spec) InstanceName() string + func (i *Spec) ReadDoc() string + type Swagger interface + ReadDoc func() string + func GetSwagger(name string) Swagger + type TypeSpecDef struct + Enums []EnumValue + File *ast.File + NotUnique bool + ParentSpec ast.Decl + PkgPath string + SchemaName string + TypeSpec *ast.TypeSpec + func (t *TypeSpecDef) Alias() string + func (t *TypeSpecDef) FullPath() string + func (t *TypeSpecDef) Name() string + func (t *TypeSpecDef) SetSchemaName() + func (t *TypeSpecDef) TypeName() string