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: add JSON Schema 2019-09+ validation keyword - dependentRequired #1600

Merged

Conversation

jeremyfiel
Copy link
Contributor

fixes #1558

What/Why/How?

JSON Schema 2019-09 introduced a new validation keyword which applies to OpenAPI 3.1.x support of JSON Schema 2020-12.

[6.5.4. ](https://json-schema.org/draft/2020-12/json-schema-validation#section-6.5.4)[dependentRequired](https://json-schema.org/draft/2020-12/json-schema-validation#name-dependentrequired)
The value of this keyword MUST be an object. Properties in this object, if any, MUST be arrays. Elements in each array, if any, MUST be strings, and MUST be unique.

This keyword specifies properties that are required if a specific other property is present. Their requirement is dependent on the presence of the other property.

Validation succeeds if, for each name that appears in both the instance and as a name within this keyword's value, every item in the corresponding array is also the name of a property in the instance.

Omitting this keyword has the same behavior as an empty object.

Reference

Testing

Screenshots (optional)

Check yourself

  • Code changed? - Tested with redoc/reference-docs/workflows (internal)
  • All new/updated code is covered with tests
  • New package installed? - Tested in different environments (browser/node)

Security

  • Security impact of change has been considered
  • Code follows company security practices and guidelines

@jeremyfiel jeremyfiel requested a review from a team as a code owner June 24, 2024 16:03
Copy link

changeset-bot bot commented Jun 24, 2024

🦋 Changeset detected

Latest commit: c086bc5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@redocly/openapi-core Patch
@redocly/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@jeremyfiel jeremyfiel requested a review from a team as a code owner June 24, 2024 16:05
packages/core/src/types/oas3_1.ts Outdated Show resolved Hide resolved
packages/core/src/types/oas3_1.ts Outdated Show resolved Hide resolved
@jeremyfiel jeremyfiel force-pushed the feat/dependent-required-json-schema branch 3 times, most recently from b4e2f61 to 3bbe36d Compare June 24, 2024 22:25
@jeremyfiel jeremyfiel requested a review from tatomyr June 24, 2024 22:45
@tatomyr tatomyr changed the title Add JSON Schema 2019-09+ validation keyword - dependentRequired fix: add JSON Schema 2019-09+ validation keyword - dependentRequired Jul 1, 2024
@jeremyfiel jeremyfiel force-pushed the feat/dependent-required-json-schema branch from 3bbe36d to 3097b08 Compare July 1, 2024 18:18
@jeremyfiel jeremyfiel force-pushed the feat/dependent-required-json-schema branch from 3097b08 to 1dc6b2a Compare July 1, 2024 19:47
Copy link
Contributor

@lornajane lornajane left a comment

Choose a reason for hiding this comment

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

Changeset is good

Copy link
Contributor

@tatomyr tatomyr left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the contribution!

@tatomyr tatomyr merged commit f807944 into Redocly:main Jul 3, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants