Skip to content

Change of 'default' not detected #484

Closed

Description

@michael-schnell

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.

Activity

  1. joschi commented on Mar 4, 2023

    @joschi
    Contributor

    @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?

  2. michael-schnell commented on Mar 4, 2023

    @michael-schnell
    Author

    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
  3. DrSatyr commented on Jan 30, 2025

    @DrSatyr
    Collaborator

    So "default" changes detection is fixed in the scope of #717, marked as duplicate and closed.

    But PR #718 assumes these changes as compatible. So will add this issue to the Discussion to consider @michael-schnell previous comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions