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

Ensure additionalProperty uses correct schema. #187

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

fiasco
Copy link

@fiasco fiasco commented Jan 29, 2023

I encountered this issue when attempting to validate data against this schema:

EnvironmentFlags:
      type: object
      description: An array of various flags that indicate functionality associated with the environment.
      additionalProperties:
        type: object
        properties:
          cde:
            type: boolean
            description: Determines if the environment is on-demand.

The Properties::validate() method currently attempts to validate additionalProperties by their parent definition which results in an error which validating valid data.

@fiasco
Copy link
Author

fiasco commented Jan 29, 2023

I've added a unit test for this scenario and updated the PR to support both existing and new scenarios.

Copy link
Member

@scaytrase scaytrase left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I'm getting this correct. I see incorrect match for spec and test data in your UT.

if you have additional properties being specd by object: props: flag: bool than your test data should look like

$data = ['someUnknownProperty' => ['flag' => true]];

For current format flag should be known property of main object, not for additionalProperties

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

Successfully merging this pull request may close these issues.

2 participants