Как использовать $ref для ссылки на свойства внутри определения
Перейдите к редактору swagger ui ' https://editor.swagger.io/' и поместите мой yml-файл для swagger: '2.0', затем нажмите Generate Server, затем Spring
проблема в сгенерированных моделях получил ошибку компиляции в классе ElptableProductOfferingVBOProductOffering.java
в yml: $ref: '#/definitions/BasicComponents/properties/IDType', ожидаемый в классе для получения свойства типа IDType, вместо этого я получил BasicComponentspropertiesIDType, который не существует.
раздел определений в файле yml
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;