This commit adds support for the `@uniqueItems` trait on `list` shapes
in server SDKs. Requests with duplicate values for `list` shapes
constrained with `@uniqueItems` will be rejected by servers.
message="The [`@uniqueItems`](https://smithy.io/2.0/spec/constraint-traits.html#uniqueitems-trait) trait on `list` shapes is now supported in server SDKs."
When the list has duplicated items, the response should be a 400
ValidationException.""",
protocol: restJson1,
request: {
method: "POST",
uri: "/MalformedUniqueItems",
body: """
{ "set" : ["a", "a", "b", "c"] }""",
headers: {
"content-type": "application/json"
}
},
response: {
code: 400,
headers: {
"x-amzn-errortype": "ValidationException"
},
body: {
mediaType: "application/json",
assertion: {
contents: """
{ "message" : "1 validation error detected. Value with repeated values at indices [0, 1] at '/set' failed to satisfy constraint: Member must have unique values",
"fieldList" : [{"message": "Value with repeated values at indices [0, 1] at '/set' failed to satisfy constraint: Member must have unique values", "path": "/set"}]}"""
}
}
}
},
{
id: "RestJsonMalformedUniqueItemsDuplicateBlobs",
documentation: """
When the list has duplicated blobs, the response should be a 400
{ "message" : "1 validation error detected. Value with repeated values at indices [0, 2] at '/complexSet' failed to satisfy constraint: Member must have unique values",
"fieldList" : [{"message": "Value with repeated values at indices [0, 2] at '/complexSet' failed to satisfy constraint: Member must have unique values", "path": "/complexSet"}]}"""
}
}
}
},
// Note that the previously existing `RestJsonMalformedUniqueItemsNullItem` test is already covered by `RestJsonMalformedUniqueItemsNullItem`.
// See https://github.com/awslabs/smithy/issues/1577#issuecomment-1397069720.