如何使用$ ref引用定义内的属性

时间:2019-02-14 08:50:52

标签: java swagger openapi swagger-codegen openapi-generator

转到swagger ui编辑器“ https://editor.swagger.io/”,然后将我的yml文件放入swagger:“ 2.0” 然后点击生成服务器,然后点击春季

问题在于生成的模型中有编译错误 EligibleProductOfferingVBOProductOffering.java类中的

yml中的

:$ ref:'#/ definitions / BasicComponents / properties / IDType' 应该在类中获取IDType类型的属性,而不是我获得了BasicComponentspropertiesIDType,该属性不存在。

yml文件中的

definitions部分

definitions:
  eligibleProductOfferingVBOProductOffering:
    properties:
      id:
        type: array
        minItems: 1
        items:
          $ref: '#/definitions/BasicComponents/properties/IDType'
      name:
        type: string
        description: ' The name of the instance of a business object or component.'
  BasicComponents:
    properties:
      IDType:
        type: object
        properties:
          value:
            type: string
            description: The value of the field.
          schemeID:
            type: string
          schemeName:
            type: string
          schemeAgencyName:
            type: string
        required:
          - value
'

Sample of Java class generated: 
public class EligibleProductOfferingVBOProductOffering   {
    private List<BasicComponentspropertiesIDType> id = null;
}

expected: 
private List<BasicComponentsIDType> id = null;

instead of:
private List<BasicComponentspropertiesIDType> id = null;



0 个答案:

没有答案