parser

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 30, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 根配置
	TagOpenAPI           = "@openapi"
	TagSelf              = "@self"
	TagJsonSchemaDialect = "@jsonschemadialect"

	// 基本信息
	TagTitle          = "@title"
	TagVersion        = "@version"
	TagSummary        = "@summary"
	TagDescription    = "@description"
	TagTermsOfService = "@termsofservice"

	// 联系人
	TagContactName  = "@contact.name"
	TagContactURL   = "@contact.url"
	TagContactEmail = "@contact.email"

	// 许可证
	TagLicenseName       = "@license.name"
	TagLicenseIdentifier = "@license.identifier"
	TagLicenseURL        = "@license.url"

	// 服务器
	TagServer = "@server"

	// 外部文档
	TagExternalDocs = "@externaldocs"

	// 标签
	TagTagName     = "@tag.name"
	TagTagSummary  = "@tag.summary"
	TagTagDesc     = "@tag.desc"
	TagTagParent   = "@tag.parent"
	TagTagKind     = "@tag.kind"
	TagTagDocsURL  = "@tag.docs.url"
	TagTagDocsDesc = "@tag.docs.desc"

	// 安全方案
	TagSecurityScheme = "@securityscheme"
	TagSecurityScope  = "@securityscope"
	TagSecurity       = "@security"
)
View Source
const (
	// 路由配置
	TagRouter     = "@router"
	TagId         = "@id"
	TagIgnore     = "@ignore"
	TagDeprecated = "@deprecated"

	// 请求控制
	TagParam  = "@param"
	TagAccept = "@accept"

	// 响应定义
	TagSuccess = "@success"
	TagFailure = "@failure"
	TagProduce = "@produce"
	TagHeader  = "@header"

	// 标签
	TagTags = "@tags"
)

Variables

This section is empty.

Functions

func Parse

func Parse(dirs []string) (*model.T, error)

Types

type Processor

type Processor struct {
	// 保存加载的所有包信息
	// Key: 包路径 (PkgPath), e.g., "github.com/myproject/models"
	// Value: 包对象
	PackagesMap map[string]*packages.Package

	// 你的 OpenAPI 结果
	OpenAPI *model.T

	// 缓存已生成的 Schema,防止重复和循环引用
	// Key: 全限定类型名 (e.g., "github.com/myproject/models.User")
	GeneratedSchemas map[string]string
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL