alibaba / pont

🌉数据服务层解决方案
MIT License
3.04k stars 251 forks source link

不支持生成OAS3的枚举类型 #328

Open yieio opened 2 years ago

yieio commented 2 years ago

What happens(发生了什么)?

RT,OAS3的OpenApi 枚举会生成成 Class类型

Pont 版本1.3.3

接口 json

{
  "openapi": "3.0.1",
  "info": {
    "title": "框架API",
    "version": "v1"
  },
  "paths":  {
  },
  "components": {
    "schemas": {
      "AjaxResultType": {
        "enum": [
          "Success",
          "Info",
          "UnAuth",
          "Forbidden",
          "NoFound",
          "Locked",
          "Error"
        ],
        "type": "string"
      }
    },
    "securitySchemes": {
      "oauth2": {
        "type": "apiKey",
        "description": "请输入带有Bearer的Token,形如 “Bearer {Token}” ",
        "name": "Authorization",
        "in": "header"
      }
    }
  },
  "security": [
    {
      "oauth2": [
        "readAccess",
        "writeAccess"
      ]
    }
  ]
}

生成的baseClass内容:

class AjaxResultType {}

希望能生成

enum AjaxResultType {
   Success,
         Info = "Info",
        UnAuth =  "UnAuth",
        Forbidden =  "Forbidden",
        NoFound =  "NoFound",
        Locked =  "Locked",
        Error =  "Error"
}
ianfuin commented 2 years ago

目前支持 swagger2和swagger3。 https://github.com/alibaba/pont/pull/339 这个mr已支持自定义解析数据源,等待合并后新版发布。