Open
Description
As of writing, this diff atop e78da55:
diff --git a/codegen-core/common-test-models/naming-obstacle-course-ops.smithy b/codegen-core/common-test-models/naming-obstacle-course-ops.smithy
index 087d99b75..f54b27e76 100644
--- a/codegen-core/common-test-models/naming-obstacle-course-ops.smithy
+++ b/codegen-core/common-test-models/naming-obstacle-course-ops.smithy
@@ -5,6 +5,7 @@ use smithy.test#httpRequestTests
use smithy.test#httpResponseTests
use aws.protocols#awsJson1_1
use aws.api#service
+use smithy.framework#ValidationException
/// Confounds model generation machinery with lots of problematic names
@awsJson1_1
@@ -41,17 +42,20 @@ service Config {
}
])
operation ReservedWordsAsMembers {
- input: ReservedWords
+ input: ReservedWords,
+ errors: [ValidationException],
}
// tests that module names are properly escaped
operation Match {
input: ReservedWords
+ errors: [ValidationException],
}
// Should generate a PascalCased `RpcEchoInput` struct.
operation RPCEcho {
input: ReservedWords
+ errors: [ValidationException],
}
structure ReservedWords {
makes codegen-server-test:build -P modules="naming_test_ops" -P cargoCommands="test"
yield:
error[E0412]: cannot find type `RpcEchoError` in module `crate::error`
--> naming_test_ops/rust-server-codegen/src/operation_shape.rs:130:32
|
130 | type Error = crate::error::RpcEchoError;
| ^^^^^^^^^^^^ help: an enum with a similar name exists: `RPCEchoError`
|
::: naming_test_ops/rust-server-codegen/src/error.rs:326:1
|
326 | pub enum RPCEchoError {
| --------------------- similarly named enum `RPCEchoError` defined here
This is due to the fact that the operation error struct name is generated as:
So it's not pascal cased; RPCEchoError
is generated. However, ServerOperationGenerator
pascal cases the operation name here:
Note that we do pascal case operation inputs and outputs, since these are regular Structure
shapes, and so SymbolVisitor
pascal cases them here:
My preference to fix this bug would be to just pascal case operation names; that's a breaking change for the clients, since it uses the operation names as-is in operation.rs
. I'm assuming we don't rename operation names for a reason?