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

Validation error message for @input / @output seems to be backwards #1719

Closed
rafial opened this issue Apr 4, 2023 · 1 comment
Closed

Validation error message for @input / @output seems to be backwards #1719

rafial opened this issue Apr 4, 2023 · 1 comment
Labels
bug This issue is a bug.

Comments

@rafial
Copy link

rafial commented Apr 4, 2023

Given this:

/// Lookup for a particular ASIN if a product is eligible for subscribe and save.
@readonly
@http(uri: "/subscriptions/products/{asin}" method: "GET")
operation IsProductEligible {
    input: IsProductEligibleRequest
    output: IsProductEligibleResponse
    errors: [SubscribeAndSaveClientException, SubscribeAndSaveServiceException]
}

@output
structure IsProductEligibleRequest {
    @required
    @httpLabel
    asin: UrlEncodedString
}

...building produces the following validation error:

| /// Lookup for a particular ASIN if a product is eligible for subscribe and sav…
6| @readonly
7| @http(uri: "/subscriptions/products/{asin}" method: "GET")
8| operation IsProductEligible {
 | ^

Operation output cannot target structures marked with the @input trait

...but in fact it is the the other way around, the operation is targeting for input a structure marked with the @output trait.

The message is similarly backwards when trying to use a structure marked as @input as the output for an operation.

@mtdowling mtdowling added the bug This issue is a bug. label Apr 8, 2023
milesziemer added a commit to milesziemer/smithy that referenced this issue Apr 10, 2023
Fixes issue smithy-lang#1719, which pointed out that error messages when operation
input targeted structures with the `@output` trait (and vice-versa) were
incorrect. The error message was built using the operation <-> target
relationship name for the name of the invalid trait, instead of using
it as the operation property which targeted an invalid shape.

The error message was also updated to include the shape id of the
targeted shape, and existing tests were updated to reflect that
change.
milesziemer added a commit to milesziemer/smithy that referenced this issue Apr 10, 2023
Fixes issue smithy-lang#1719, which pointed out that error messages when operation
input targeted structures with the `@output` trait (and vice-versa) were
incorrect. The error message was built using the operation <-> target
relationship name for the name of the invalid trait, instead of using
it as the operation property which targeted an invalid shape.

The error message was also updated to include the shape id of the
targeted shape, and existing tests were updated to reflect that
change.
milesziemer added a commit that referenced this issue Apr 10, 2023
Fixes issue #1719, which pointed out that error messages when operation
input targeted structures with the `@output` trait (and vice-versa) were
incorrect. The error message was built using the operation <-> target
relationship name for the name of the invalid trait, instead of using
it as the operation property which targeted an invalid shape.

The error message was also updated to include the shape id of the
targeted shape, and existing tests were updated to reflect that
change.
@milesziemer
Copy link
Contributor

Thanks for calling this out. Fixed by #1728

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug.
Projects
None yet
Development

No branches or pull requests

3 participants