Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allOf : type of property contained in multiple subschemas is not correctly determined. #392

Open
thake opened this issue Jul 4, 2022 · 4 comments

Comments

@thake
Copy link

thake commented Jul 4, 2022

Given the following schema V1:

Foo:
  allOf:
    - properties:
        propA:
          type: string
    - properties:
        propA:
          example: "YEEHAA"

is changed to the following schema V2:

Foo:  
  properties:
    propA:
      type: string

openapi-diff incorrectly detects the following incompatible change:
Changed property type (object -> string)

It seems to me that the type of a property that is contained in multiple subschemas of an allOf is not correctly determined. Openapi-diff recognized the type of propA in schema V1 as an object, but this is not correct.

@Chexpir
Copy link

Chexpir commented Aug 10, 2022

Here another example, where oas-diff errored with:

[2022-08-03T07:43:21.358Z] - POST   /v1/....
[2022-08-03T07:43:21.358Z]   Request:
[2022-08-03T07:43:21.358Z]         - Changed application/json
[2022-08-03T07:43:21.358Z]           Schema: Broken compatibility
[2022-08-03T07:43:21.358Z]           Changed property type: aPropertyName (string -> string)
Quarkus 2.10.2
        aPropertyName:
          format: date-time
          description: .........
          type: string
          example: 2022-02-22T22:00:47.720Z
        otherPropertyName:
          format: date-time
          type: string
Quarkus 2.11.1
        aPropertyName:
          allOf:
          - $ref: '#/components/schemas/OffsetDateTime'
          - description: ......
            example: **2022-02-22T22:00:47.720Z**
        otherPropertyName:
          $ref: '#/components/schemas/OffsetDateTime'
....
    Instant:
      format: date-time
      type: string
      example: 2022-03-10T16:15:50Z
    OffsetDateTime:
      format: date-time
      type: string
      example: 2022-03-10T12:15:50-04:00

@Pyth0ff
Copy link

Pyth0ff commented Oct 25, 2022

I ran into the same issue that my examples are like that:

...
"timestamp": {
  "type": "string",
  "format": "date-time",
  "example": "2022-04-20T11:28:33.894Z"
},
...

Produces the following exception:

Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Java 8 date/time type `java.time.OffsetDateTime` not supported by default: add Module "com.fasterxml.jackson.datatype:jackson-datatype-jsr310" to enable handling

@joschi
Copy link
Contributor

joschi commented Oct 25, 2022

@Pyth0ff Does it still fail with the latest version?
https://github.com/OpenAPITools/openapi-diff/releases/tag/2.1.0-beta.4

@Pyth0ff
Copy link

Pyth0ff commented Oct 25, 2022

@joschi Thank you for the quick answer and yes the latest beta helps to solve my issue. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants