Change of 'default' not detected
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.
@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?
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)
- Adding a default value: Old clients may interpret a missing field with their own "default" value and now receive a new default = BREAKING
- Removing a default value: Old clients still interpret a missing value the same way as before = COMPATIBLE
- Changing a default value: Old clients still use the old default, which is now wrong = BREAKING
Request (Forward compatibility required)
- Adding a default value: Nothing was defined before about what happens on the server if the field is missing. Now it's more concrete = COMPATIBLE
- Removing a default value: Old clients may not send a value and expect it to be the old default on the server = BREAKING
- Changing a default value: Old clients expect the old default value to be stored when they don't send the field = BREAKING