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

Add optional configuration parameter to select JSON schema version #1617

Merged
merged 6 commits into from
Feb 17, 2023

Conversation

hpmellema
Copy link
Contributor

Issue #, if available: issue #1252

Description of changes:
Adds an optional configuration parameter jsonSchemaVersion to select the version of JSON schema to use. The JSON schema version will still default to draft07, but can be set to draft2020-12. This new configuration parameter will also provide a mechanism to support future JSON schema changes.

Reviewing the JSON schema specifications, it appears that the only change needed was to update "definitions" -> "$defs" as Smithy jsonSchema does not support meta-schema generation, the use of plain-name fragments, tuples, or dynamic anchors.

Cloudformation
Cloudformation only supports jsonSchema draft07 at this time (see here)
In order to prevent compatibility issues, a check was added to the cloudformation plugin to ensure only JSON Schema draft07 is used in the configuration. I expect we will update this as Cloudformation and API Gateway add support for later versions.

OpenAPI
The OpenAPI plugin was updated to set the JSON Schema version parameter based on the latest version supported by the OpenAPI spec version.
I.e. OpenAPI3.1 will use draft2020-12 while OpenAPI3.0 will use draft07

Testing

  • manually tested that both OpenAPI and Cloudformation plugins correctly used the new configuration parameter and rejected unsupported versions/parameters
  • Added a new integration test for draft2020-12 in the JSON schema module
  • Added test that OpenAPI config correctly associates with the right JSON schema version

JSON Schema Change list
The following two web pages detail the
Schema Changes:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@hpmellema hpmellema requested a review from a team as a code owner February 14, 2023 19:53
@hpmellema hpmellema merged commit ea4b7d9 into smithy-lang:main Feb 17, 2023
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