-
Notifications
You must be signed in to change notification settings - Fork 218
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
Allow smithy.api#jsonName trait to target union members #953
Comments
Do you have a particular reason for wanting this? The jsonName trait, as it is, is kind of a concession to the reality of needing to support existing services. IMO a new service shouldn't use traits like that because they make it harder for a human to reason about the serialized data. I'm not super against adding it, I just want to know if there's some context I'm missing. |
Here are a few reasons
|
Those sound like good reasons to me! Just for bookkeeping: to implement this, we need to update the spec, the prelude model's trait definition, and add a protocol test for awsRestJson1 to make sure AWS SDK generators know about the change. |
We are running into similar problems trying to match existing HTTP API style guides where we have standardised on We were getting by with I would have expected to be able to do the following (example from the Smithy docs):
so that awsRestJson1 protocol would adapt the input and output shapes. For reference we're using smithy-typescript to generate the validation code, and it's all working well. I'm worried that this approach we're taking is repeatedly going to bump into issues attempting to curate JSON shapes via the Smithy models alone. @JordonPhillips do you think we should be approaching this differently, so that we are more aligned with Smithy and can leverage as much as possible out of the box? Or is enforcing style guides on a serialization format fundamentally misaligned with Smithy? |
@mtdowling just a note on implementation as I didn't see it mentioned. While the |
|
🎉 ❤️ |
It is currently restricted to structure members.
I think it should be possible for it to target union members as well.
The text was updated successfully, but these errors were encountered: