camaraproject / QualityOnDemand

Repository to describe, develop, document and test the QualityOnDemand API family
https://wiki.camaraproject.org/x/zwOeAQ
Apache License 2.0
37 stars 60 forks source link

Move example outside of allOf in schemas.Duration #282

Closed vlasatno closed 2 months ago

vlasatno commented 2 months ago

Describe the bug The Duration schema has an example that is dashed such that it is an element in an allOf list, whereas it should be a member of the $ref above it.

    Duration:
      type: object
      properties:
        value:
          type: integer
          example: 12
          format: int32
          minimum: 1
        unit:
          allOf:
            - $ref: "#/components/schemas/TimeUnitEnum"
            - example: Minutes

Should become:

    Duration:
      type: object
      properties:
        value:
          type: integer
          example: 12
          format: int32
          minimum: 1
        unit:
          allOf:
            - $ref: "#/components/schemas/TimeUnitEnum"
              example: Minutes

To Reproduce Not applicable.

Expected behavior Not applicable.

Screenshots Not applicable.

Environment: Not applicable.

Additional context Found when generating python-fastapi code with openapi-generator

jlurien commented 2 months ago

The current spec is weird and some generators may have problems with it, but the proposed fix is also wrong.

We should probably change it as

    Duration:
      type: object
      properties:
        value:
          type: integer
          example: 12
          format: int32
          minimum: 1
        unit:
          $ref: "#/components/schemas/TimeUnitEnum"

and remove the example or move it to the TimeUnitEnum schema

jlurien commented 2 months ago

Fixed as part of #283