You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code used to represent typed values for traits are ripe for code generation-- they're mostly the same thing and formulaic depending on the type of trait.
I pushed up a proof of concept branch to kick start the idea. It needs work and has lots of todos. I probably wont have the cycles to finish this for the next few weeks, so anyone is free to take it over.
While it would be nice to generate the traits in the smithy-model package, it might not be worth it at this point since it would require pulling a ton of code out into a lower-level package that doesn't depend on code generation so that the smithy-model package could.
It would be nice if this could be an exercise to prove out the design of CodeWriter, but if that proves insufficient, feel free to pull in a dependency on JavaPoet.
Traits that target structure shapes should inline the members of the targeted structure into the trait itself rather than require a structure value to be passed into the code generated trait.
Tracking: SDK-23707
The text was updated successfully, but these errors were encountered:
Would it fit better to create a meta-trait that could connect a trait to the structure declaration that defines its value shape? These implicit shapes would become explicit, and this problem would be mostly solved by existing code generation logic. There's probably some user understanding benefit here, and some deeper dogfooding of the IDL.
I think we basically did what you're suggesting. You define traits in the model by adding the trait trait to a shape. I think the issue description here may have been written before we made that change, so the last bullet point doesn't make much sense anymore.
The code used to represent typed values for traits are ripe for code generation-- they're mostly the same thing and formulaic depending on the type of trait.
I pushed up a proof of concept branch to kick start the idea. It needs work and has lots of todos. I probably wont have the cycles to finish this for the next few weeks, so anyone is free to take it over.
https://github.com/awslabs/smithy/tree/smithy-codegen-traits/codegen/smithy-codegen-traits/src/main/java/software/amazon/smithy/codegen/traits
Notes and considerations:
Tracking: SDK-23707
The text was updated successfully, but these errors were encountered: