Versions in this module Expand all Collapse all v0 v0.1.0 May 25, 2022 Changes in this version + const ANY + const ARRAY + const BOOLEAN + const FUNC + const INTEGER + const INTERFACE + const NIL + const NULL + const NUMBER + const OBJECT + const STRING + func CheckSchemaType(typeName string) error + func IsGolangPrimitiveType(typeName string) bool + func IsNumericType(typeName string) bool + func IsPrimitiveType(typeName string) bool + func IsSimplePrimitiveType(typeName string) bool + func SetExcludedDirsAndFiles(excludes string) func(*Parser) + func TransToValidSchemeType(typeName string) string + type ApiDocSpec struct + BaseURL string + Description string + Groups []*ApiGroupSpec + Service string + Title string + TotalCount int + UngroupedApis []*ApiSpec + Version string + type ApiGroupSpec struct + Apis []*ApiSpec + Description string + Group string + Order int + Title string + type ApiParameterSpec struct + DataType string + Description string + Example string + Name string + Required bool + Validate string + func (p ApiParameterSpec) ParameterTypes() string + type ApiRequestSpec struct + Accept string + Parameters map[string]*ApiParameterSpec + Schema *TypeSchema + func (s *ApiRequestSpec) Body() string + type ApiResponseSpec struct + Description string + Format string + IsMock bool + Schema *TypeSchema + StatusCode int + func (s *ApiResponseSpec) Body() string + func (s *ApiResponseSpec) PureBody() string + type ApiSpec struct + Accept string + Api string + Author string + Deprecated bool + Description string + Format string + Group string + HTTPMethod string + Order int + Requests ApiRequestSpec + Responses []*ApiResponseSpec + Title string + Version string + func (a *ApiSpec) FullURL() string + type AstFileInfo struct + File *ast.File + PackagePath string + Path string + type Operation struct + func NewOperation(parser *Parser, options ...func(*Operation)) *Operation + func (operation *Operation) ParseComment(comment string, astFile *ast.File) error + func (operation *Operation) ParseDescriptionComment(lineRemainder string) + func (operation *Operation) ParseParametersComment(parameterType, commentLine string, astFile *ast.File) error + func (operation *Operation) ParseRequestComment(commentLine string, astFile *ast.File) error + func (operation *Operation) ParseResponseComment(commentLine string, astFile *ast.File) error + func (operation *Operation) ParseRouterComment(commentLine string) error + type PackageDefinitions struct + Files map[string]*ast.File + Name string + TypeDefinitions map[string]*TypeSpecDef + type PackagesDefinitions struct + func NewPackagesDefinitions() *PackagesDefinitions + func (pkgDefs *PackagesDefinitions) CollectAstFile(packageDir, path string, astFile *ast.File) error + func (pkgDefs *PackagesDefinitions) FindTypeSpec(typeName string, file *ast.File, parseDependency bool) *TypeSpecDef + func (pkgDefs *PackagesDefinitions) ParseTypes() error + type Parser struct + func New() *Parser + func (p *Parser) GetApiDoc() *ApiDocSpec + func (p *Parser) Parse(searchDirs []string) error + func (p *Parser) ParseDefinition(typeSpecDef *TypeSpecDef, parentSchema *TypeSchema) (*TypeSchema, error) + func (p *Parser) Skip(path string, f os.FileInfo) error + type TypeSchema struct + ArraySchema *TypeSchema + Comment string + FullName string + FullPath string + Name string + Parent *TypeSchema + PkgPath string + Properties map[string]*TypeSchema + TagValue string + Type string + func (s *TypeSchema) JSON(withComment bool) string + func (s *TypeSchema) Write(format string, withComment bool) (body string) + func (s *TypeSchema) XML(withComment bool) string + func (v *TypeSchema) ExampleValue() string + func (v *TypeSchema) GetTag(name string) (value string, has bool) + func (v *TypeSchema) IsRequired() (required bool) + func (v *TypeSchema) JSONKey() (key string, isOmitempty bool) + func (v *TypeSchema) ParameterTags() map[string]string + func (v *TypeSchema) ValidateTag() (validate string) + func (v *TypeSchema) XMLAttrs() map[string]string + func (v *TypeSchema) XMLName() string + func (v *TypeSchema) XMLTag() (xmlTag string, hasTag, isAttr, isOmitempty, isInner bool) + type TypeSpecDef struct + File *ast.File + PkgPath string + TypeSpec *ast.TypeSpec + func (t *TypeSpecDef) FullName() string + func (t *TypeSpecDef) FullPath() string + func (t *TypeSpecDef) Name() string