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

Fix Count and Range Constraints #1823

Merged
merged 2 commits into from
May 27, 2021
Merged

Conversation

chrisguitarguy
Copy link
Collaborator

Fixes #1822
Fixes #1821

This is pretty much identical to previous PR I sent to fix the Count constraint #1781

It's possible to set a count constraint with a min but no max, which
would generate an OpenAPI Schema like...

    "property": {
        "type": "array",
        "minItems": 1,
        "maxItems": 0
    }

With this change the schema will only set `minItems` in that example.
Previously it was possible to set only one of the min or max values and
get a schema like:

    "property": {
      "type": "integer",
      "minimum": 1,
      "maximum": 0
    }

Also possible that `Range` would be used with {min,max}PropertyPath and
you'd get a schema with both minimum and max set to zero.

With the checks in place, that's no longer the case.
@GuilhemN GuilhemN merged commit 7f3926c into nelmio:master May 27, 2021
@GuilhemN
Copy link
Collaborator

Oh this needed an update indeed. Thank you @chrisguitarguy!

@chrisguitarguy chrisguitarguy deleted the fix_constraints branch May 27, 2021 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants