调整path数据结构定义
This commit is contained in:
parent
c7765d57c1
commit
93316f739f
@ -13,11 +13,27 @@ package define
|
|||||||
//
|
//
|
||||||
// Date : 12:16 2024/7/19
|
// Date : 12:16 2024/7/19
|
||||||
type OpenapiDoc struct {
|
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" required:"true"` // 必选。此字段提供 API 相关的元数据。相关工具可能需要这个字段。
|
Info *Info `json:"info" required:"true"` // 必选。此字段提供 API 相关的元数据。相关工具可能需要这个字段。
|
||||||
Servers []*ServerItem `json:"servers"` // 服务环境
|
Servers []*ServerItem `json:"servers"` // 服务环境
|
||||||
Tags []TagItem `json:"tags"` // 全部标签列表
|
Tags []TagItem `json:"tags"` // 全部标签列表
|
||||||
Paths map[string]map[string]*PathItemConfig `json:"paths"` // 接口路径 -> 接口请求方法 -> 具体配置
|
Paths map[string]*PathConfig `json:"paths"` // 接口路径 -> 接口请求方法 -> 具体配置
|
||||||
|
}
|
||||||
|
|
||||||
|
// PathConfig ...
|
||||||
|
//
|
||||||
|
// Author : go_developer@163.com<白茶清欢>
|
||||||
|
//
|
||||||
|
// Date : 18:06 2024/7/19
|
||||||
|
type PathConfig struct {
|
||||||
|
Get *PathItemOperationConfig `json:"get"` // 定义适用于此路径的 GET 操作。
|
||||||
|
Put *PathItemOperationConfig `json:"put"` // 定义适用于此路径的 PUT 操作。
|
||||||
|
Post *PathItemOperationConfig `json:"post"` // 定义适用于此路径的 POST 操作。
|
||||||
|
Delete *PathItemOperationConfig `json:"delete"` // DELETE
|
||||||
|
Options *PathItemOperationConfig `json:"options"` // 定义适用于此路径的 OPTIONS 操作。
|
||||||
|
Head *PathItemOperationConfig `json:"head"` // 定义适用于此路径的 HEAD 操作。
|
||||||
|
Patch *PathItemOperationConfig `json:"patch"` // 定义适用于此路径的 PATCH 操作。
|
||||||
|
Trace *PathItemOperationConfig `json:"trace"` // 定义适用于此路径的 TRACE 操作。
|
||||||
}
|
}
|
||||||
|
|
||||||
// PathItemConfig 接口的具体配置
|
// PathItemConfig 接口的具体配置
|
||||||
@ -29,20 +45,13 @@ type OpenapiDoc struct {
|
|||||||
//
|
//
|
||||||
// Date : 12:22 2024/7/19
|
// Date : 12:22 2024/7/19
|
||||||
type PathItemConfig struct {
|
type PathItemConfig struct {
|
||||||
Ref string `json:"$ref"` // 指定对此路径的外部定义的引用,引用的格式必须符合 Path Item 对象 的格式,如果引用的外部定义和此对象内的其他定义有冲突,该如何处理冲突尚未被定义。
|
Ref string `json:"$ref"` // 指定对此路径的外部定义的引用,引用的格式必须符合 Path Item 对象 的格式,如果引用的外部定义和此对象内的其他定义有冲突,该如何处理冲突尚未被定义。
|
||||||
Summary string `json:"summary"` // 一个可选的简要总结字符串,用来描述此路径内包含的所有操作。
|
Summary string `json:"summary"` // 一个可选的简要总结字符串,用来描述此路径内包含的所有操作。
|
||||||
Deprecated bool `json:"deprecated"` // 是否已弃用
|
Deprecated bool `json:"deprecated"` // 是否已弃用
|
||||||
Description string `json:"description"` // 一个可选的详细说明字符串,用于描述此路径包含的所有操作。 CommonMark syntax 可以被用来呈现富文本格式.
|
Description string `json:"description"` // 一个可选的详细说明字符串,用于描述此路径包含的所有操作。 CommonMark syntax 可以被用来呈现富文本格式.
|
||||||
Tags []string `json:"tags"` // 接口标签列表
|
Tags []string `json:"tags"` // 接口标签列表
|
||||||
Get *PathItemOperationConfig `json:"get"` // 定义适用于此路径的 GET 操作。
|
|
||||||
Put *PathItemOperationConfig `json:"put"` // 定义适用于此路径的 PUT 操作。
|
Parameters []*PathConfigParameter `json:"parameters"` // 参数列表, 对于所有请求生效
|
||||||
Post *PathItemOperationConfig `json:"post"` // 定义适用于此路径的 POST 操作。
|
|
||||||
Delete *PathItemOperationConfig `json:"delete"` // DELETE
|
|
||||||
Options *PathItemOperationConfig `json:"options"` // 定义适用于此路径的 OPTIONS 操作。
|
|
||||||
Head *PathItemOperationConfig `json:"head"` // 定义适用于此路径的 HEAD 操作。
|
|
||||||
Patch *PathItemOperationConfig `json:"patch"` // 定义适用于此路径的 PATCH 操作。
|
|
||||||
Trace *PathItemOperationConfig `json:"trace"` // 定义适用于此路径的 TRACE 操作。
|
|
||||||
Parameters []*PathConfigParameter `json:"parameters"` // 参数列表, 对于所有请求生效
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PathItemOperationConfig 描述对路径的某个操作。
|
// PathItemOperationConfig 描述对路径的某个操作。
|
||||||
|
Loading…
x
Reference in New Issue
Block a user