Skip to content
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

Add restJson1 validation test for uniqueItems missing required keys inside lists of objects #1735

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,37 @@ apply MalformedUniqueItems @httpMalformedRequestTests([
}
}
},
{
id: "RestJsonMalformedUniqueItemsStructureMissingKeyList",
documentation: """
When a list of structures does not contain required keys,
the response should be a 400 ValidationException and not
a 500 error.""",
protocol: restJson1,
request: {
method: "POST",
uri: "/MalformedUniqueItems",
body: """
{ "structureListWithNoKey" : [{"hi2": "bar"}] }""",
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 at '/structureListWithNoKey/0/hi' failed to satisfy constraint: Member must not be null",
"fieldList" : [{"message": "Value at '/structureListWithNoKey/0/hi' failed to satisfy constraint: Member must not be null", "path": "/structureListWithNoKey/0/hi"}]}"""
}
}
}
},
{
id: "RestJsonMalformedUniqueItemsUnionList",
documentation: """
Expand Down Expand Up @@ -491,6 +522,19 @@ apply MalformedUniqueItems @httpMalformedRequestTests([
},
])


string MyStringKey

structure MissingKeyStructure {
@required
hi: MyStringKey
}

@uniqueItems
list StructureSetWithNoKey {
member: MissingKeyStructure
}

structure MalformedUniqueItemsInput {
blobList: BlobSet
booleanList: BooleanSet
Expand All @@ -504,7 +548,8 @@ structure MalformedUniqueItemsInput {
httpDateList: HttpDateSet
enumList: FooEnumSet
intEnumList: IntegerEnumSet
listList: ListSet,
listList: ListSet
structureList: StructureSet
structureListWithNoKey: StructureSetWithNoKey
unionList: UnionSet
}