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 support for validating different IDL versions #917

Merged
merged 1 commit into from
Sep 24, 2021

Conversation

mtdowling
Copy link
Member

Various IDL features are only supported in versions > 1.0, including
mixins, the "!" suffix for structure members, and other features soon to
come. This commit adds version-specific validation to the IDL loading
process to ensure that these features are only used in the appropriate
versions.

Given we're moving to Smithy IDL 2.0 instead of 1.1, I started using 2.0
in test cases. I'll send a followup commit that updates everything from
1.0 or 1.1 to 2.0. I kept that out of this commit to make it easier to
review.

Issue #, if available:

Description of changes:

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

Various IDL features are only supported in versions > 1.0, including
mixins, the "!" suffix for structure members, and other features soon to
come. This commit adds version-specific validation to the IDL loading
process to ensure that these features are only used in the appropriate
versions.

Given we're moving to Smithy IDL 2.0 instead of 1.1, I started using 2.0
in test cases. I'll send a followup commit that updates everything from
1.0 or 1.1 to 2.0. I kept that out of this commit to make it easier to
review.
@mtdowling mtdowling requested a review from a team as a code owner September 22, 2021 23:25
if (!modelFile.getVersion().supportsRequiredSugar()) {
throw syntax(memberId, String.format(
"The '!' suffix can only be used on structure members when using Smithy 2.0 or later, but "
+ "you're using version `%s`. Make `$version: \"2\"` the first line of this file.",
Copy link
Contributor

Choose a reason for hiding this comment

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

"Make `$version: "2"` the first line of this file to update" or something to indicate they're updating (pedantic i know but still)

@mtdowling mtdowling merged commit 32af691 into idl-1.1 Sep 24, 2021
@mtdowling mtdowling deleted the multi-version-idl-loading branch January 7, 2022 21:56
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