0

假设我有一个 yml 文件example.yml,如下所示:

ExampleResponse:
    type: "object"
    properties:
      StatusHeader:
        $ref: "#/definitions/StatusHeader"
      ResponseBody:
        $ref: "externaldefs.yaml#/Profile"

现在的模型Profile

Profile:
  type: "object"
  required:
    - "ProfileKey"
    - "ProfileId"   
  properties:
    ProfileKey:
      type: "string"
    ProfileId:
      type: "string"
    PersonalInfo:
      type: "object"
      properties:
        FirstName:
         type: "string"
        LastName:
         type: "string"

我想要做的是,当我使用 生成模型时example.ymlProfile不应再次生成该类,并且 ExampleResponse 类应该得到正确的导入。

一种方法是systemProperties在除. 这适用于小型模式并且不能有效地扩大规模。我正在寻找一种更好的方法来做到这一点。modelssystemPropertiesProfile

该示例取自https://github.com/swagger-api/swagger-ui/issues/4070

4

0 回答 0