支持openapi文档的解析 #20

Merged
zhangdeman merged 4 commits from feature/support_parser into master 2025-04-11 22:10:02 +08:00
Showing only changes of commit 4b9d44296d - Show all commits

View File

@ -129,7 +129,7 @@ func (hod *handleOpenapiDoc) apiPathConfigToProjectConfig(uri string, method str
importUriConfig.ParamList = append(importUriConfig.ParamList, &apiDocDefine.ApiParamItem{
Title: itemParam.Name,
Name: itemParam.Name,
Location: hod.openapiDocLocation2GatewayLocation(itemParam.In),
Location: hod.openapiDocLocationFormat(itemParam.In),
ParamType: hod.openapiDocType2GoType(fmt.Sprintf("%v", itemParam.Schema.Type), itemParam.Schema.Format),
IsRequired: itemParam.Required,
DefaultValue: "∂",
@ -597,12 +597,12 @@ func (hod *handleOpenapiDoc) getResComponentsConfig(ref string) (*apiDocDefine.S
return nil, errors.New("components not found : " + refKey)
}
// openapiDocLocation2GatewayLocation 文档数据位置转为网关的数据位置
// openapiDocLocationFormat 文档数据位置转为网关的数据位置
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 21:06 2025/2/26
func (hod *handleOpenapiDoc) openapiDocLocation2GatewayLocation(openapiDocLocation string) string {
func (hod *handleOpenapiDoc) openapiDocLocationFormat(openapiDocLocation string) string {
openapiDocLocation = strings.ToUpper(openapiDocLocation)
for _, itemLocation := range consts.RequestDataLocationList {
if strings.ToUpper(itemLocation.Value.String()) == openapiDocLocation {