You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Disallow @uniqueItems-constrained list shapes that reach a map shape (#2375)
* Disallow `@uniqueItems`-constrained list shapes that reach a map shape
The server SDK codegen generates Rust code that does not compile when a
`@uniqueItems`-constrained list shape reaches a map shape, essentially
because `std::collections::HashMap` does not implement
`std::hash::Hash`.
A ticket with the Smithy team was opened in smithy-lang/smithy#1567 to
disallow such models.
This commit makes it so that codegen aborts with an informative message
when such models are encountered, instead of going ahead and producing
code that does not compile.
This commit also slightly adjusts the error messages produced when
unsupported constraint traits are found.
* ./gradlew ktlintFormat
Copy file name to clipboardExpand all lines: codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ValidateUnsupportedConstraints.kt
Copy file name to clipboardExpand all lines: codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ValidateUnsupportedConstraintsAreNotUsedTest.kt
+41-1Lines changed: 41 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,6 @@ internal class ValidateUnsupportedConstraintsAreNotUsedTest {
27
27
namespace test
28
28
29
29
service TestService {
30
-
version: "123",
31
30
operations: [TestOperation]
32
31
}
33
32
@@ -186,6 +185,47 @@ internal class ValidateUnsupportedConstraintsAreNotUsedTest {
0 commit comments