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

All defaults from all OneOf schema options get propagated using the DefaultJSONValidator #1888

Open
nielsbox opened this issue Feb 19, 2024 · 0 comments

Comments

@nielsbox
Copy link
Collaborator

nielsbox commented Feb 19, 2024

Description

When using the DefaultJSONValidator which propagates all defaults to the payload does not take account of the OneOf branches.

oneOf:
  - type: object
     properties:
        foo:
            type: string
            default: "bar"
  - type: object
     properties:
        xyz:
           type: string

Expected behaviour

When providing
{
"xyz": "abc"
}
No default should be propagated due to the oneOf nature

Actual behaviour

{
"xyz": "abc",
"foo": "bar"
}

This is invalid within the contract as it can only be oneOf and not both.

Steps to reproduce

Use the Default JSON Validator with the provided schema.

Additional info:

Output of the commands:

  • python --version -> 3.10
  • pip show connexion | grep "^Version\:" -> 3.0.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant