Documentation ¶
Overview ¶
Package openapi 对 openapi 的再处理
Index ¶
- Constants
- func NewArraySchemaRef(ref *openapi3.SchemaRef) *openapi3.SchemaRef
- func NewAttrSchemaRef(ref *openapi3.SchemaRef, title, desc string, xml *openapi3.XML, nullable bool) *openapi3.SchemaRef
- func NewDocSchemaRef(ref *openapi3.SchemaRef, title, desc string) *openapi3.SchemaRef
- func NewNullableSchemaRef(ref *openapi3.SchemaRef) *openapi3.SchemaRef
- func NewSchemaRef(ref string, s *openapi3.Schema) *openapi3.SchemaRef
- func RefEqual(r1, r2 string) bool
- type OpenAPI
- func (doc *OpenAPI) AddAPI(path string, o *openapi3.Operation, method string)
- func (doc *OpenAPI) AddSchema(schema *openapi3.SchemaRef)
- func (doc *OpenAPI) Doc() *openapi3.T
- func (doc *OpenAPI) GetSchema(ref string) (*openapi3.SchemaRef, bool)
- func (doc *OpenAPI) Merge(d *openapi3.T)
- func (doc *OpenAPI) SaveAs(path string) error
Constants ¶
View Source
const ComponentSchemaPrefix = "#/components/schemas/"
Variables ¶
This section is empty.
Functions ¶
func NewArraySchemaRef ¶
NewArraySchemaRef 将 ref 包装成数组
func NewAttrSchemaRef ¶
func NewDocSchemaRef ¶
NewDocSchemaRef 将 ref 附带上文档信息
这会以 AllOf 的形式形成一个新 openapi3.SchemaRef 对象,原有的 ref 不会被破坏。
func NewNullableSchemaRef ¶
NewNullableSchemaRef 将 ref 包装为一个允许为空的对象
func NewSchemaRef ¶
NewSchemaRef 声明 openapi3.SchemaRef
在 ref 不为空且没有 ComponentSchemaPrefix 作为前缀时会自动添加前缀,其它情况下则不改变 ref 的值。
Types ¶
type OpenAPI ¶
type OpenAPI struct {
// contains filtered or unexported fields
}
OpenAPI 协程安全的 OpenAPI 对象
func (*OpenAPI) AddSchema ¶
AddSchema 尝试添加一个 Schema 至 Components 中
NOTE: 仅在 schema.Ref 不为空 或是 schema.Value 不为空时才会保存,且会对不规则的 schema.Ref 进行修正。
Click to show internal directories.
Click to hide internal directories.