增加数据结构属性定义
This commit is contained in:
parent
dde8315404
commit
11bf768221
@ -16,10 +16,20 @@ type OpenapiDoc struct {
|
|||||||
Openapi string `json:"openapi" required:"true"` // 必选. 这个字符串必须是开放 API 规范版本号提到的符合语义化版本号规范的版本号。openapi字段应该被工具或者客户端用来解释 OpenAPI 文档.
|
Openapi string `json:"openapi" required:"true"` // 必选. 这个字符串必须是开放 API 规范版本号提到的符合语义化版本号规范的版本号。openapi字段应该被工具或者客户端用来解释 OpenAPI 文档.
|
||||||
Info *Info `json:"info,omitempty" required:"true"` // 必选。此字段提供 API 相关的元数据。相关工具可能需要这个字段。
|
Info *Info `json:"info,omitempty" required:"true"` // 必选。此字段提供 API 相关的元数据。相关工具可能需要这个字段。
|
||||||
Servers []*ServerItem `json:"servers"` // 服务环境
|
Servers []*ServerItem `json:"servers"` // 服务环境
|
||||||
|
Components *Components `json:"components,omitempty"` // 数据结构
|
||||||
Tags []*TagItem `json:"tags"` // 全部标签列表
|
Tags []*TagItem `json:"tags"` // 全部标签列表
|
||||||
Paths map[string]*PathConfig `json:"paths"` // 接口路径 -> 接口请求方法 -> 具体配置
|
Paths map[string]*PathConfig `json:"paths"` // 接口路径 -> 接口请求方法 -> 具体配置
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Components 数据结构定义
|
||||||
|
//
|
||||||
|
// Author : go_developer@163.com<白茶清欢>
|
||||||
|
//
|
||||||
|
// Date : 21:22 2024/7/19
|
||||||
|
type Components struct {
|
||||||
|
Schemas map[string]*Schema `json:"schemas"` // 数据结构定义
|
||||||
|
}
|
||||||
|
|
||||||
// PathConfig ...
|
// PathConfig ...
|
||||||
//
|
//
|
||||||
// Author : go_developer@163.com<白茶清欢>
|
// Author : go_developer@163.com<白茶清欢>
|
||||||
@ -133,6 +143,7 @@ type Property struct {
|
|||||||
OneOf []*PropertyXOf `json:"oneOf,omitempty"` // type 是一个对象, allOf 指向对象描述
|
OneOf []*PropertyXOf `json:"oneOf,omitempty"` // type 是一个对象, allOf 指向对象描述
|
||||||
AnyOf []*PropertyXOf `json:"anyOf,omitempty"` // type 是一个对象, allOf 指向对象描述
|
AnyOf []*PropertyXOf `json:"anyOf,omitempty"` // type 是一个对象, allOf 指向对象描述
|
||||||
Items *PropertyXOf `json:"items,omitempty"` // items 必须存在如果 type 的值是 array。
|
Items *PropertyXOf `json:"items,omitempty"` // items 必须存在如果 type 的值是 array。
|
||||||
|
AdditionalProperties *PropertyXOf `json:"additionalProperties,omitempty"` // additionalProperties 是一个用于描述模型中包含未在属性列表中定义的额外属性的选项。它允许接受任意的一个或多个键值对。它的作用是为了在模型定义中包含未知或动态属性。通常,在设计 API 时,我们无法预先知道 API 用户会传递什么样的额外属性,这时就可以使用 additionalProperties 功能来灵活地处理这些未知属性。
|
||||||
Properties map[string]*Property `json:"properties,omitempty"` // type = object 时, 定义对象属性
|
Properties map[string]*Property `json:"properties,omitempty"` // type = object 时, 定义对象属性
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user