-
Notifications
You must be signed in to change notification settings - Fork 195
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
Pascal case operation names #1827
base: main
Are you sure you want to change the base?
Conversation
And hence pascal case operation error struct names too, like we're currently doing with operation input and output struct names. Fixes #1826.
Let's see what the "damage" to the SDK diff is. Changelog entries missing. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
It looks like the following 34 operations in the AWS Rust SDK are affected: AddClientIDToOpenIDConnectProvider
CreateOpenIDConnectProvider
CreateSAMLProvider
CreateVirtualMFADevice
DeactivateMFADevice
DeleteOpenIDConnectProvider
DeleteSAMLProvider
DeleteSSHPublicKey
DeleteVirtualMFADevice
EnableMFADevice
EnableVolumeIO
GetOpenIDConnectProvider
GetSAMLProvider
GetSSHPublicKey
ListMFADeviceTags
ListMFADevices
ListOpenIDConnectProviderTags
ListOpenIDConnectProviders
ListSAMLProviderTags
ListSAMLProviders
ListSSHPublicKeys
ListVirtualMFADevices
RemoveClientIDFromOpenIDConnectProvider
ResyncMFADevice
TagMFADevice
TagOpenIDConnectProvider
TagSAMLProvider
UntagMFADevice
UntagOpenIDConnectProvider
UntagSAMLProvider
UpdateOpenIDConnectProviderThumbprint
UpdateSAMLProvider
UpdateSSHPublicKey
UploadSSHPublicKey Even if the breaking change is large, we have to do something. We're being inconsistent right now. For example, we're currently generating:
in There's an argument to be made that we should leave operation names for input/output/error structs as they are in the input model, because it's likely that we would deviate from the official API docs (e.g. the official API documentation for this particular operation is @awslabs/rust-sdk-owners thoughts? |
Definitely agree we need consistency here. However, after examining the other SDKs and the SDK documentation, I think we should go in the opposite direction: preserve the operation name rather than convert it to Pascal case. The reason being is the overwhelming majority of the other SDKs take this approach, and maintaining the case from the model will make it consistent with the API reference docs. What we could do is change the input/output shape creation to use Does this work for the server side? |
The breaking change will also need to get called out in the SDK changelog. |
Agree, we should preserve the case. |
I'm in the middle of implementing this. What is it exactly that what we want? Personally I'd just keep every name as modeled in Smithy, but it's going to be a huge change if so.
We're lacking tests in many places where we're retaining names as modeled. If you have shape names containing underscores, we trigger |
I think we should use the modeled name for every name where both Smithy models and Rust convention call for We may also want to add a sanity check that we're outputting names in the correct Rust convention. For example, if someone calls their operation |
The Smithy spec's ABNF says that shape names are
Rust identifiers' grammar is a strict superset. However, Rust API guidelines say types and enum variants should be To convert shape names to type and enum variant names, we can't simply:
as you suggest, as that could introduce conflicts (e.g. distinct |
I think Smithy is opinionated by default on naming conventions, right? You would need to suppress warnings to encounter these edge cases if I recall correctly. |
the original failure to rename operations was an oversight (not an intentional choice). Personally I don't think we should necessarily preserve what's modeled—IIRC it's not totally consistent across all the models and can lead to weird results. My preference would be:
Personally, I'm not bothered at all by casing differences with the official docs but happy to be convinced |
If we're going to rename, the devil is in the details: what renaming strategy do we choose? |
We now lean towards using Smithy identifiers as-is in generated Rust code. However, this is blocked by #2340. |
we've decided to begin closing old PRs that we don't plan to work on in the near future. Please let us know if you still think this PR is needed |
And hence pascal case operation error struct names too, like we're
currently doing with operation input and output struct names.
Fixes #1826.
Checklist
CHANGELOG.next.toml
if I made changes to the smithy-rs codegen or runtime cratesCHANGELOG.next.toml
if I made changes to the AWS SDK, generated SDK code, or SDK runtime cratesBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.