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

Include json tag in structs if field is annotated with @jsonName #326

Closed
jabalsad opened this issue Sep 7, 2021 · 2 comments
Closed

Include json tag in structs if field is annotated with @jsonName #326

jabalsad opened this issue Sep 7, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@jabalsad
Copy link

jabalsad commented Sep 7, 2021

As title says, in its current form json tags are not included in the generated Go code.

We use jsonName extensively throughout our Smithy models, but the Go code is unusable without the json struct tags.

If you can point me towards where it needs to be added, I can look at submitting a pull request.

Many thanks.

@jasdel jasdel added the enhancement New feature or request label Feb 26, 2022
@jasdel
Copy link
Contributor

jasdel commented Feb 26, 2022

Thanks for reaching out @jabalsad. The Shape type generators are generally protocol agnostic. This allows API clients to not be tightly coupled to an API protocol at its surface public interface. With that said, StructureGenerator would be a good place to investigate adding a builder so that the StructGenerator can be configured to optionally generate Go struct tags on struct members.

This probably should not make direct use of jsonName, as that is only valid for the awsRestJson1 protocol. Instead some strategy or custom implementation would be provided to the builder for deriving the struct tag key and value(s) that should be generated for the struct members.

@lucix-aws
Copy link
Contributor

Tracked by #458 - the json family of protocol generators should handle this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants