chenshuai2144 / openapi2typescript

一个被大范围使用的小工具
297 stars 133 forks source link

建议类型解析能支持openapi 3.1协议 #121

Open Alioth1017 opened 9 months ago

Alioth1017 commented 9 months ago

目前发现 openapi 3.1 协议下,errorMessage字段类型定义会被解析成any

3.0 json片段

  "components": {
    "schemas": {
      "PageResponseResult": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "description": "是否成功"
          },
          "errorMessage": {
            "type": "string",
            "description": "错误信息",
            "nullable": true
          }
        }
      }
    }
  }

3.1 json片段

  "components": {
    "schemas": {
      "PageResponseResult": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "description": "是否成功"
          },
          "errorMessage": {
            "type": ["string", "null"],
            "description": "错误信息"
          }
        }
      }
    }
  }