swagger-codegen icon indicating copy to clipboard operation
swagger-codegen copied to clipboard

[Spring] mustache model-properties only accessable if property is not referenced via $ref in specification file

Open JohannesProbst opened this issue 5 years ago • 1 comments

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:
           ...

JohannesProbst avatar Oct 18 '21 09:10 JohannesProbst

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

johnathafelix avatar Oct 23 '21 12:10 johnathafelix