smithy-go
smithy-go copied to clipboard
Include `json` tag in structs if field is annotated with @jsonName
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.
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.
Tracked by #458 - the json family of protocol generators should handle this.