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
Fix server SDK bug with directly constrained list/map shapes in operation output (#2761)
Fixes#2760.
## Testing
I verified that the updated `constraints.smithy` integration test does
not compile without the fix applied.
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
Copy file name to clipboardExpand all lines: codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/CollectionConstraintViolationGenerator.kt
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,7 @@ class CollectionConstraintViolationGenerator(
48
48
49
49
inlineModuleCreator(constraintViolationSymbol) {
50
50
val constraintViolationVariants = constraintsInfo.map { it.constraintViolationVariant }.toMutableList()
51
-
if (isMemberConstrained) {
51
+
if (shape.isReachableFromOperationInput() &&isMemberConstrained) {
Copy file name to clipboardExpand all lines: codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/MapConstraintViolationGenerator.kt
+6-4Lines changed: 6 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -45,10 +45,12 @@ class MapConstraintViolationGenerator(
45
45
val constraintViolationName = constraintViolationSymbol.name
46
46
47
47
val constraintViolationCodegenScopeMutableList:MutableList<Pair<String, Any>> =mutableListOf()
48
-
if (isKeyConstrained(keyShape, symbolProvider)) {
48
+
val keyConstraintViolationExists = shape.isReachableFromOperationInput() && isKeyConstrained(keyShape, symbolProvider)
49
+
val valueConstraintViolationExists = shape.isReachableFromOperationInput() && isValueConstrained(valueShape, model, symbolProvider)
50
+
if (keyConstraintViolationExists) {
49
51
constraintViolationCodegenScopeMutableList.add("KeyConstraintViolationSymbol" to constraintViolationSymbolProvider.toSymbol(keyShape))
50
52
}
51
-
if (isValueConstrained(valueShape, model, symbolProvider)) {
Copy file name to clipboardExpand all lines: codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/UnconstrainedCollectionGeneratorTest.kt
0 commit comments