完善schema对象定义
This commit is contained in:
parent
e71ff46d96
commit
00939d3835
@ -124,6 +124,23 @@ type Schema struct {
|
|||||||
//
|
//
|
||||||
// Date : 17:05 2024/7/19
|
// Date : 17:05 2024/7/19
|
||||||
type Property struct {
|
type Property struct {
|
||||||
|
Type string `json:"type"` // 数据类型, swagger本身的定义
|
||||||
|
Format string `json:"format"` // 对应编程语言中的数据类型描述
|
||||||
|
Default any `json:"default"` // 默认值 : 不同于 JSON Schema,这个值必须符合定义与相同级别的 Schema 对象 中定义的类型,比如 type 是 string,那么 default 可以是 "foo" 但不能是 1。
|
||||||
|
Description string `json:"description"` // 数据描述, CommonMark syntax可以被用来呈现富文本格式.
|
||||||
|
AllOf []*PropertyXOf `json:"allOf"` // type 是一个对象, allOf 指向对象描述
|
||||||
|
OneOf []*PropertyXOf `json:"oneOf"` // type 是一个对象, allOf 指向对象描述
|
||||||
|
AnyOf []*PropertyXOf `json:"anyOf"` // type 是一个对象, allOf 指向对象描述
|
||||||
|
Items *PropertyXOf `json:"items"` // items 必须存在如果 type 的值是 array。
|
||||||
|
}
|
||||||
|
|
||||||
|
// PropertyXOf ...
|
||||||
|
//
|
||||||
|
// Author : go_developer@163.com<白茶清欢>
|
||||||
|
//
|
||||||
|
// Date : 17:13 2024/7/19
|
||||||
|
type PropertyXOf struct {
|
||||||
|
Ref string `json:"$ref"` // 引用的结构描述
|
||||||
}
|
}
|
||||||
|
|
||||||
// SchemaDiscriminator 当一个 request bodies 或 response payloads 可以是多种 schemas 时,可以使用一个 discriminator 对象来帮助序列化、反序列化和校验
|
// SchemaDiscriminator 当一个 request bodies 或 response payloads 可以是多种 schemas 时,可以使用一个 discriminator 对象来帮助序列化、反序列化和校验
|
||||||
|
Loading…
x
Reference in New Issue
Block a user