Add optional configuration parameter to select JSON schema version #1617
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 todraft07
, but can be set todraft2020-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 usedraft07
Testing
draft2020-12
in the JSON schema moduleJSON 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.