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

Referencing members in traits fails parsing by Smithy assembler #2021

Closed
b-vennes opened this issue Oct 26, 2023 · 1 comment · Fixed by #2023
Closed

Referencing members in traits fails parsing by Smithy assembler #2021

b-vennes opened this issue Oct 26, 2023 · 1 comment · Fixed by #2023
Labels
bug This issue is a bug.

Comments

@b-vennes
Copy link

I am attempting to create a new trait which uses the idRef trait. The new trait lets members in structs be linked to members of other structs. When I reference a struct member from the trait using the @traitName(StructName$memberName) syntax I get the following parsing error when loading the model using the Smithy assembler: Expected RPAREN(')') but found DOLLAR('$'). Is this the expected behavior for referencing members within traits, or should it be possible?

This is a minimal example which demonstrates the behavior:

$version: "2.0"

namespace example

@trait
@idRef(failWhenMissing: true, selector: ":test(structure) > member")
string link

structure StructA {
  @required
  id: String
}

structure StructB {
  @required
  @link(StructA$id) // invalid line
  structAId: String
}

This model appears to be valid when parsed by both the Smithy LSP and Intellij Smithy Plugin syntax highlighting.

I also noticed that I can replace @link(StructA$id) with a fully qualified string like @link("example#StructA$Id") and it will parse and assemble correctly.

@mtdowling
Copy link
Member

Looks like a bug in the parser.

@mtdowling mtdowling added the bug This issue is a bug. label Oct 26, 2023
mtdowling added a commit that referenced this issue Oct 27, 2023
mtdowling added a commit that referenced this issue Oct 27, 2023
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

Successfully merging a pull request may close this issue.

2 participants