Skip to content

Check the change of "required" for properties in Response schema #26

@guillaume-pansier

Description

@guillaume-pansier

Hello,

I would like to have the RequiredStatusChange fail for requests and responses, as for now there is no errors for the following contract change:

"MyEntityName": {
      "required": [
        "myProperty1",
-       "myProperty2"
      ],

I checked the implementation, and it bypasses the check for responses:

 if (oldParameter.IsRequired() == newParameter.IsRequired() || context.Direction == DataDirection.Response)
                return;

The description of the rule, "Checks whether an existing property's required status is changed from the previous specification.", doesn't mention anything about this bypass. Furthermore, I believe changing the "required" status in a response is a breaking change as well.

I'll see if I can investigate and push a PR later on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions