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

Use smithy-trait-codegen for Java Trait representations #1536

Open
kubukoz opened this issue May 23, 2024 · 2 comments
Open

Use smithy-trait-codegen for Java Trait representations #1536

kubukoz opened this issue May 23, 2024 · 2 comments

Comments

@kubukoz
Copy link
Member

kubukoz commented May 23, 2024

https://github.com/smithy-lang/smithy/blob/1805e515bc3877a02aa8351da1a7ea62e92a2c8f/smithy-trait-codegen/src/main/java/software/amazon/smithy/traitcodegen/TraitCodegen.java

Doing this is likely to cause bincompat breakage in the protocol module, but it'll save us some boilerplate.

Should probably be attempted in Alloy first.

@Baccata
Copy link
Contributor

Baccata commented May 24, 2024

The protocol module should not be considered "library code", so bin breakage is okay.

Assuming we went ahead, what would the set-up even look like ?

@kubukoz
Copy link
Member Author

kubukoz commented May 24, 2024

The trait codegen can be set up as a source generator in the build tool. The trait classes are generated with builders and getters, and your validators / services can use those. I can't exactly share a snippet but we've done this at work so it's doable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants