转到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;