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

oneOf validation of keys using "required" not working since 1.3.0 #769

Closed
1 of 4 tasks
erik-carlson opened this issue May 11, 2022 · 4 comments
Closed
1 of 4 tasks
Assignees
Milestone

Comments

@erik-carlson
Copy link

Describe the bug

Given this schema:

{
  "$schema": "http://json-schema.org/draft-07/schema",
  "type": "object",
  "properties": {
      "foo":{},
      "bar": {}
  },
  "oneOf": [
      {
          "required": [ "foo" ]
      },
      {
        "required": [ "bar" ]
    }     
  ]
}

and this test yaml:

foo: bar
bar: baz

The schema validation in the yaml plugin will flag the issue with the yaml with plugin version 1.2.2 and earlier, but starting with version 1.3.0 until the latest (1.7.0) it does not flag the issue any longer. Other oneOf validations that I have tested seem to work as expected, though I have by no means done comprehensive testing of scenarios.

Expected Behavior

An error should be identified with the provided test schema when the oneOf in the schema is violated.

Current Behavior

The error is not identified by the plugin

Steps to Reproduce

  1. configure validation of yaml files using the json schema above
  2. create the test yaml
  3. check for identified errors

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)
@stevestrutt
Copy link

Also hitting this issue. oneOf does not correctly match and allows more than one property to exist.

{
                    "oneOf": [
                        {
                            "required": [
                                "git_release"
                            ]
                        },
                        {
                            "required": [
                                "git_branch"
                            ]
                        }
                    ]
                },

Verified going back to 1.2.2 that the schema works correctly and fails validation when both properties exist.

@fbricon fbricon modified the milestones: 1.11.0, 1.12.0 Jan 26, 2023
@fbricon
Copy link
Contributor

fbricon commented Jan 26, 2023

Fixed in 1.1.0 1.11.0

@fbricon fbricon closed this as completed Jan 26, 2023
@sschuberth
Copy link

Fixed in 1.1.0

That should have said 1.11.0, right?

@fbricon
Copy link
Contributor

fbricon commented Jan 26, 2023

Fixed in 1.1.0

That should have said 1.11.0, right?

yes, sorry

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

5 participants