OpenAPITools / openapi-diff

Utility for comparing two OpenAPI specifications.
Apache License 2.0
810 stars 154 forks source link

Change of 'default' not detected #484

Open michael-schnell opened 1 year ago

michael-schnell commented 1 year ago

Currently adding/changing/removing a 'default' is not detected.

V1

schema:
    type: integer

V2 (with 'default' added)

schema:
    type: integer
    default: -1

Same with changing/removing it.

joschi commented 1 year ago

@michael-schnell Thanks for reporting this!

I think adding a default for a property is a compatible change and removing it is a breaking change.

What do you think?

michael-schnell commented 1 year ago

This is difficult. I guess this depends on where the default is located (request or response) and what kind of change it is.

The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided.

This means that the default only matters when nullable: true.

Response (Backward compatibility required)

Request (Forward compatibility required)