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 migrate command version matchers #1769

Merged
merged 1 commit into from
May 12, 2023

Conversation

syall
Copy link
Contributor

@syall syall commented May 11, 2023

Issue #, if available:

N/A.

Description of changes:

Previously, Smithy models with versions without a decimal suffix (.0)
would not be matched properly in the smithy migrate command.

For Smithy models with a version of "1", the upgraded files would
result in conflicting version control statements, e.g.

$version: "2.0"

$version: "1"

// ...

Similarly for Smithy models with a version of "2", the files would
incorrectly attempt to be upgraded, e.g.

$version: "2.0"

$version: "2"

// ...

This change loosens the version matchers to match the
Version::fromString
implementation.

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

@syall syall requested a review from a team as a code owner May 11, 2023 23:54
Previously, Smithy models with versions without a decimal suffix (`.0`)
would not be matched properly in the `smithy migrate` command.

For Smithy models with a version of `"1"`, the upgraded files would
result in conflicting version control statements, e.g.

```smithy
$version: "2.0"

$version: "1"

// ...
```

Similarly for Smithy models with a version of `"2"`, the files would
incorrectly attempt to be upgraded, e.g.

```smithy
$version: "2.0"

$version: "2"

// ...
```

This change loosens the version matchers to match the
[`Version::fromString`](https://github.com/awslabs/smithy/blob/c95943844a65a6623f79ac647e54326d87a68c24/smithy-model/src/main/java/software/amazon/smithy/model/loader/Version.java#L205-L216)
implementation.
@syall syall force-pushed the fix-migrate-command-version-matcher branch from 7b3e309 to e399ee7 Compare May 12, 2023 00:12
@syall syall changed the title Loosen migrate command version 2 matcher Fix migrate command version matchers May 12, 2023
@syall syall merged commit 3675c72 into smithy-lang:main May 12, 2023
syall pushed a commit to Xtansia/smithy that referenced this pull request Aug 11, 2023
Previously, Smithy models with versions without a decimal suffix (`.0`)
would not be matched properly in the `smithy migrate` command.

For Smithy models with a version of `"1"`, the upgraded files would
result in conflicting version control statements, e.g.

```smithy
$version: "2.0"

$version: "1"

// ...
```

Similarly for Smithy models with a version of `"2"`, the files would
incorrectly attempt to be upgraded, e.g.

```smithy
$version: "2.0"

$version: "2"

// ...
```

This change loosens the version matchers to match the
[`Version::fromString`](https://github.com/awslabs/smithy/blob/c95943844a65a6623f79ac647e54326d87a68c24/smithy-model/src/main/java/software/amazon/smithy/model/loader/Version.java#L205-L216)
implementation.
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.

3 participants