swagger-codegen
swagger-codegen copied to clipboard
[Spring] mustache model-properties only accessable if property is not referenced via $ref in specification file
Description
For e.g. the {{#isReadOnly}} mustache property is not accessible if the property is referenced via $ref in the specification file. Seen in pojo.mustache file for language Spring and it's not the only attribute not accessible (e.g. {{#example}}, {{description}} as well).
Swagger-codegen version
3.0.29
Swagger declaration file content or url
Example with not working reference ($ref) on the property grossAmount of the components -> schemas -> LiabilityInsurance:
...
LiabilityInsurance:
type: object
description: data necessary for calculating a vehicle liability insurance premium
properties:
grossAmount:
$ref: '#/components/schemas/GrossAmount'
variant:
...
GrossAmount:
readOnly: true
description: Gross total after calculation for the respective subdivision.
type: number
format: double
multipleOf: 0.01
example: 99.98
working example without $ref:
...
LiabilityInsurance:
type: object
description: data necessary for calculating a vehicle liability insurance premium
properties:
grossAmount:
readOnly: true
description: Bruttosumme nach Berechnung für die jeweilige Teilsparte.
type: number
format: double
multipleOf: 0.01
example: 99.98
variant:
...
I'm also facing this issue. It looks like a regression as it seems that this was fixed in https://github.com/swagger-api/swagger-codegen/pull/8277 and https://github.com/observepoint/swagger-codegen-generators/pull/2