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

Missing smithy-trait-codegen union support #2268

Open
msosnicki opened this issue May 1, 2024 · 5 comments
Open

Missing smithy-trait-codegen union support #2268

msosnicki opened this issue May 1, 2024 · 5 comments
Labels
feature-request A feature should be added or improved.

Comments

@msosnicki
Copy link
Contributor

msosnicki commented May 1, 2024

We're using the new smithy-trait-codegen module to generate the java trait files for the protocols. Seem that the unions are not supported yet

throw new UnsupportedOperationException("Union shapes are not supported at this time.");
.

Is it something on the radar for the upcoming releases? If not, would contribution speed up the process?

Thanks

@hpmellema hpmellema added the feature-request A feature should be added or improved. label May 1, 2024
@hpmellema
Copy link
Contributor

We do have plans to add support for union traits in a future release.

@joelvanderhoof
Copy link

joelvanderhoof commented May 6, 2024

We do have plans to add support for union traits in a future release.

Will this include traits to support untagged and discriminated unions?

@hpmellema
Copy link
Contributor

The support for union traits mentioned here is for generating the java implementation of custom Smithy Union traits such as:

@trait 
union MyUnion {
    option1: String 
    option2: Integer
}

I was not referring to adding additional behavior traits to modify the behavior of Smithy unions. Support for union trait generation will not include anything relating to untagged unions.

@msosnicki
Copy link
Contributor Author

@hpmellema Will it also support the following case?

@trait
structure MyTrait {
    union: MyUnion
} 
union MyUnion {
    option1: String 
    option2: Integer
}

During decoding, it would work only for tagged unions, right? For example:

@MyTrait(
    union: {
        option1: "Foo"
    }
}
structure StructWithTrait {}

@hpmellema
Copy link
Contributor

hpmellema commented May 7, 2024

Yes, we plan to support nested unions within trait definitions, and yes, on node deserialization only tagged unions would be supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

3 participants