python-botocore/tests/unit/protocols/output/rest-json.json
2022-05-25 15:10:07 -07:00

1313 lines
29 KiB
JSON

[
{
"description": "Scalar members",
"metadata": {
"protocol": "rest-json"
},
"shapes": {
"OutputShape": {
"type": "structure",
"members": {
"ImaHeader": {
"shape": "HeaderShape"
},
"ImaHeaderLocation": {
"shape": "HeaderShape",
"locationName": "X-Foo"
},
"Status": {
"shape": "StatusShape",
"location": "statusCode"
},
"Str": {
"shape": "StringType"
},
"Num": {
"shape": "IntegerType"
},
"FalseBool": {
"shape": "BooleanType"
},
"TrueBool": {
"shape": "BooleanType"
},
"Float": {
"shape": "FloatType"
},
"Double": {
"shape": "DoubleType"
},
"Long": {
"shape": "LongType"
},
"Char": {
"shape": "CharType"
}
}
},
"HeaderShape": {
"type": "string",
"location": "header"
},
"StatusShape": {
"type": "integer"
},
"StringType": {
"type": "string"
},
"IntegerType": {
"type": "integer"
},
"BooleanType": {
"type": "boolean"
},
"FloatType": {
"type": "float"
},
"DoubleType": {
"type": "double"
},
"LongType": {
"type": "long"
},
"CharType": {
"type": "character"
}
},
"cases": [
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"ImaHeader": "test",
"ImaHeaderLocation": "abc",
"Status": 200,
"Str": "myname",
"Num": 123,
"FalseBool": false,
"TrueBool": true,
"Float": 1.2,
"Double": 1.3,
"Long": 200,
"Char": "a"
},
"response": {
"status_code": 200,
"headers": {
"ImaHeader": "test",
"X-Foo": "abc"
},
"body": "{\"Str\": \"myname\", \"Num\": 123, \"FalseBool\": false, \"TrueBool\": true, \"Float\": 1.2, \"Double\": 1.3, \"Long\": 200, \"Char\": \"a\"}"
}
}
]
},
{
"description": "Blob members",
"metadata": {
"protocol": "rest-json"
},
"shapes": {
"OutputShape": {
"type": "structure",
"members": {
"BlobMember": {
"shape": "BlobType"
},
"StructMember": {
"shape": "BlobContainer"
}
}
},
"BlobType": {
"type": "blob"
},
"BlobContainer": {
"type": "structure",
"members": {
"foo": {
"shape": "BlobType"
}
}
}
},
"cases": [
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"BlobMember": "hi!",
"StructMember": {
"foo": "there!"
}
},
"response": {
"status_code": 200,
"headers": {},
"body": "{\"BlobMember\": \"aGkh\", \"StructMember\": {\"foo\": \"dGhlcmUh\"}}"
}
}
]
},
{
"description": "Timestamp members",
"metadata": {
"protocol": "rest-json"
},
"shapes": {
"OutputShape": {
"type": "structure",
"members": {
"TimeArg": {
"shape": "TimestampType"
},
"TimeArgInHeader": {
"shape": "TimestampType",
"location": "header",
"locationName": "x-amz-timearg"
},
"TimeCustom": {
"timestampFormat": "rfc822",
"shape": "TimestampType"
},
"TimeCustomInHeader": {
"timestampFormat": "unixTimestamp",
"shape": "TimestampType",
"location": "header",
"locationName": "x-amz-timecustom"
},
"TimeFormat": {
"shape": "TimestampFormatType"
},
"TimeFormatInHeader": {
"shape": "TimestampFormatType",
"location": "header",
"locationName": "x-amz-timeformat"
},
"StructMember": {
"shape": "TimeContainer"
}
}
},
"TimeContainer": {
"type": "structure",
"members": {
"foo": {
"shape": "TimestampType"
},
"bar": {
"shape": "TimestampFormatType"
}
}
},
"TimestampFormatType": {
"timestampFormat": "iso8601",
"type": "timestamp"
},
"TimestampType": {
"type": "timestamp"
}
},
"cases": [
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"TimeArg": 1398796238,
"TimeArgInHeader": 1398796238,
"TimeCustom": 1398796238,
"TimeCustomInHeader": 1398796238,
"TimeFormat": 1398796238,
"TimeFormatInHeader": 1398796238,
"StructMember": {
"foo": 1398796238,
"bar": 1398796238
}
},
"response": {
"status_code": 200,
"headers": {
"x-amz-timearg": "Tue, 29 Apr 2014 18:30:38 GMT",
"x-amz-timecustom": "1398796238",
"x-amz-timeformat": "2014-04-29T18:30:38+00:00"
},
"body": "{\"TimeArg\": 1398796238, \"TimeCustom\": \"Tue, 29 Apr 2014 18:30:38 GMT\", \"TimeFormat\": \"2014-04-29T18:30:38+00:00\", \"StructMember\": {\"foo\": 1398796238, \"bar\": \"2014-04-29T18:30:38+00:00\"}}"
}
}
]
},
{
"description": "Lists",
"metadata": {
"protocol": "rest-json"
},
"shapes": {
"OutputShape": {
"type": "structure",
"members": {
"ListMember": {
"shape": "ListType"
}
}
},
"ListType": {
"type": "list",
"member": {
"shape": "StringType"
}
},
"StringType": {
"type": "string"
}
},
"cases": [
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"ListMember": ["a", "b"]
},
"response": {
"status_code": 200,
"headers": {},
"body": "{\"ListMember\": [\"a\", \"b\"]}"
}
}
]
},
{
"description": "Lists with structure member",
"metadata": {
"protocol": "rest-json"
},
"shapes": {
"OutputShape": {
"type": "structure",
"members": {
"ListMember": {
"shape": "ListType"
}
}
},
"ListType": {
"type": "list",
"member": {
"shape": "SingleStruct"
}
},
"StringType": {
"type": "string"
},
"SingleStruct": {
"type": "structure",
"members": {
"Foo": {
"shape": "StringType"
}
}
}
},
"cases": [
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"ListMember": [{"Foo": "a"}, {"Foo": "b"}]
},
"response": {
"status_code": 200,
"headers": {},
"body": "{\"ListMember\": [{\"Foo\": \"a\"}, {\"Foo\": \"b\"}]}"
}
}
]
},
{
"description": "Maps",
"metadata": {
"protocol": "rest-json"
},
"shapes": {
"OutputShape": {
"type": "structure",
"members": {
"MapMember": {
"shape": "MapType"
}
}
},
"MapType": {
"type": "map",
"key": {
"shape": "StringType"
},
"value": {
"shape": "ListType"
}
},
"ListType": {
"type": "list",
"member": {
"shape": "IntegerType"
}
},
"StringType": {
"type": "string"
},
"IntegerType": {
"type": "integer"
}
},
"cases": [
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"MapMember": {
"a": [1, 2],
"b": [3, 4]
}
},
"response": {
"status_code": 200,
"headers": {},
"body": "{\"MapMember\": {\"a\": [1, 2], \"b\": [3, 4]}}"
}
}
]
},
{
"description": "Complex Map Values",
"metadata": {
"protocol": "rest-json"
},
"shapes": {
"OutputShape": {
"type": "structure",
"members": {
"MapMember": {
"shape": "MapType"
}
}
},
"MapType": {
"type": "map",
"key": {
"shape": "StringType"
},
"value": {
"shape": "TimeType"
}
},
"TimeType": {
"type": "timestamp"
},
"StringType": {
"type": "string"
}
},
"cases": [
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"MapMember": {
"a": 1398796238,
"b": 1398796238
}
},
"response": {
"status_code": 200,
"headers": {},
"body": "{\"MapMember\": {\"a\": 1398796238, \"b\": 1398796238}}"
}
}
]
},
{
"description": "Ignores extra data",
"metadata": {
"protocol": "rest-json"
},
"shapes": {
"OutputShape": {
"type": "structure",
"members": {
"StrType": {
"shape": "StrType"
}
}
},
"StrType": {
"type": "string"
}
},
"cases": [
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {},
"response": {
"status_code": 200,
"headers": {},
"body": "{\"foo\": \"bar\"}"
}
}
]
},
{
"description": "Ignores undefined output",
"metadata": {
"protocol": "rest-json"
},
"shapes": {},
"cases": [
{
"given": {
"name": "OperationName"
},
"result": {},
"response": {
"status_code": 200,
"headers": {},
"body": "OK"
}
}
]
},
{
"description": "Supports header maps",
"metadata": {
"protocol": "rest-json"
},
"shapes": {
"OutputShape": {
"type": "structure",
"members": {
"AllHeaders": {
"shape": "HeaderMap",
"location": "headers"
},
"PrefixedHeaders": {
"shape": "HeaderMap",
"location": "headers",
"locationName": "X-"
}
}
},
"HeaderMap": {
"type": "map",
"key": {
"shape": "StringType"
},
"value": {
"shape": "StringType"
}
},
"StringType": {
"type": "string"
}
},
"cases": [
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"AllHeaders": {
"Content-Length": "10",
"x-Foo": "bar",
"X-bam": "boo"
},
"PrefixedHeaders": {
"Foo": "bar",
"bam": "boo"
}
},
"response": {
"status_code": 200,
"headers": {
"Content-Length": "10",
"x-Foo": "bar",
"X-bam": "boo"
},
"body": "{}"
}
}
]
},
{
"description": "JSON payload",
"metadata": {
"protocol": "rest-json"
},
"shapes": {
"OutputShape": {
"type": "structure",
"payload": "Data",
"members": {
"Header": {
"shape": "StringType",
"location": "header",
"locationName": "X-Foo"
},
"Data": {
"shape": "BodyStructure"
}
}
},
"BodyStructure": {
"type": "structure",
"members": {
"Foo": {
"shape": "StringType"
}
}
},
"StringType": {
"type": "string"
}
},
"cases": [
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"Header": "baz",
"Data": {
"Foo": "abc"
}
},
"response": {
"status_code": 200,
"headers": {
"X-Foo": "baz"
},
"body": "{\"Foo\": \"abc\"}"
}
}
]
},
{
"description": "Streaming payload",
"metadata": {
"protocol": "rest-json"
},
"shapes": {
"OutputShape": {
"type": "structure",
"payload": "Stream",
"members": {
"Stream": {
"shape": "Stream"
}
}
},
"Stream": {
"type": "blob"
}
},
"cases": [
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"Stream": "abc"
},
"response": {
"status_code": 200,
"headers": {},
"body": "abc"
}
}
]
},
{
"description": "JSON value trait",
"metadata": {
"protocol": "rest-json"
},
"shapes": {
"OutputShape": {
"type": "structure",
"members": {
"Attr": {
"shape": "StringType",
"jsonvalue": true,
"location": "header",
"locationName": "X-Amz-Foo"
}
}
},
"StringType": {
"type": "string"
}
},
"cases": [
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"Attr": {"Foo":"Bar"}
},
"response": {
"status_code": 200,
"headers": {"X-Amz-Foo": "eyJGb28iOiJCYXIifQ=="},
"body": ""
}
}
]
},
{
"description": "Modeled exceptions",
"metadata": {
"protocol": "rest-json"
},
"shapes": {
"ExceptionShape": {
"exception": true,
"type": "structure",
"members": {
"ImaHeader": {
"shape": "HeaderShape"
},
"ImaHeaderLocation": {
"shape": "HeaderShape",
"locationName": "X-Foo"
},
"Status": {
"shape": "StatusShape",
"location": "statusCode"
},
"BodyMember": {
"shape": "StringType"
},
"Message": {
"shape": "StringType"
}
}
},
"OtherExceptionShape": {
"exception": true,
"type": "structure",
"members": {
"BodyMember": {
"shape": "StringType"
}
}
},
"HeaderShape": {
"type": "string",
"location": "header"
},
"StatusShape": {
"type": "integer"
},
"StringType": {
"type": "string"
}
},
"cases": [
{
"given": {
"errors": [
{"shape": "ExceptionShape"}
],
"name": "OperationName"
},
"error": {
"ImaHeader": "test",
"ImaHeaderLocation": "abc",
"Status": 400,
"BodyMember": "mybody",
"Message": "mymessage"
},
"errorCode": "ExceptionShape",
"errorMessage": "mymessage",
"response": {
"status_code": 400,
"headers": {
"ImaHeader": "test",
"X-Foo": "abc",
"X-Amzn-Errortype": "ExceptionShape"
},
"body": "{\"BodyMember\": \"mybody\", \"Message\": \"mymessage\"}"
}
},
{
"given": {
"errors": [
{"shape": "ExceptionShape"}
],
"name": "OperationName"
},
"error": {
"ImaHeader": "test",
"ImaHeaderLocation": "abc",
"Status": 400,
"BodyMember": "mybody",
"Message": "mymessage"
},
"errorCode": "ExceptionShape",
"errorMessage": "mymessage",
"response": {
"status_code": 400,
"headers": {
"ImaHeader": "test",
"X-Foo": "abc"
},
"body": "{ \"code\": \"ExceptionShape\", \"BodyMember\": \"mybody\", \"Message\": \"mymessage\"}"
}
},
{
"given": {
"errors": [
{"shape": "ExceptionShape"}
],
"name": "OperationName"
},
"error": {
"ImaHeader": "test",
"ImaHeaderLocation": "abc",
"Status": 400,
"BodyMember": "mybody",
"Message": "mymessage"
},
"errorCode": "ExceptionShape",
"errorMessage": "mymessage",
"response": {
"status_code": 400,
"headers": {
"ImaHeader": "test",
"X-Foo": "abc",
"X-Amzn-Errortype": "ExceptionShape"
},
"body": "{ \"code\": \"OtherExceptionShape\", \"BodyMember\": \"mybody\", \"Message\": \"mymessage\"}"
}
},
{
"given": {
"errors": [
{"shape": "ExceptionShape"}
],
"name": "OperationName"
},
"error": {
"BodyMember": "mybody"
},
"errorCode": "OtherExceptionShape",
"errorMessage": "mymessage",
"response": {
"status_code": 400,
"headers": {
"ImaHeader": "test",
"X-Foo": "abc",
"X-Amzn-Errortype": "OtherExceptionShape"
},
"body": "{ \"BodyMember\": \"mybody\", \"Message\": \"mymessage\"}"
}
},
{
"given": {
"errors": [
{"shape": "ExceptionShape"}
],
"name": "OperationName"
},
"error": {
"BodyMember": "mybody"
},
"errorCode": "OtherExceptionShape",
"errorMessage": "mymessage",
"response": {
"status_code": 400,
"headers": {
"ImaHeader": "test",
"X-Foo": "abc"
},
"body": "{ \"code\": \"OtherExceptionShape\", \"BodyMember\": \"mybody\", \"Message\": \"mymessage\"}"
}
},
{
"given": {
"errors": [
{"shape": "ExceptionShape"}
],
"name": "OperationName"
},
"error": {},
"errorCode": "UndefinedShape",
"response": {
"status_code": 400,
"headers": {
"ImaHeader": "test",
"X-Foo": "abc",
"X-Amzn-Errortype": "UndefinedShape"
},
"body": "{ \"BodyMember\": \"mybody\"}"
}
},
{
"given": {
"errors": [
{"shape": "ExceptionShape"}
],
"name": "OperationName"
},
"error": {},
"errorCode": "UndefinedShape",
"response": {
"status_code": 400,
"headers": {
"ImaHeader": "test",
"X-Foo": "abc"
},
"body": "{ \"code\": \"UndefinedShape\", \"BodyMember\": \"mybody\"}"
}
}
]
},
{
"description": "Serializes document with standalone primitive as part of the JSON response payload with no escaping.",
"metadata": {
"protocol": "rest-json",
"apiVersion": "2014-01-01"
},
"shapes": {
"OutputShape": {
"type": "structure",
"members": {
"documentValue": {
"shape": "DocumentType"
}
}
},
"DocumentType": {
"type": "structure",
"document": true
}
},
"cases": [
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"documentValue": "foo"
},
"response": {
"status_code": 200,
"headers": {},
"body": "{\"documentValue\": \"foo\"}"
}
},
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"documentValue": 123
},
"response": {
"status_code": 200,
"headers": {},
"body": "{\"documentValue\": 123}"
}
},
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"documentValue": 1.2
},
"response": {
"status_code": 200,
"headers": {},
"body": "{\"documentValue\": 1.2}"
}
},
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"documentValue": true
},
"response": {
"status_code": 200,
"headers": {},
"body": "{\"documentValue\": true}"
}
},
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"documentValue": ""
},
"response": {
"status_code": 200,
"headers": {},
"body": "{\"documentValue\": \"\"}"
}
}
]
},
{
"description": "Serializes inline documents as part of the JSON response payload with no escaping.",
"metadata": {
"protocol": "rest-json",
"apiVersion": "2014-01-01"
},
"shapes": {
"OutputShape": {
"type": "structure",
"members": {
"documentValue": {
"shape": "DocumentType"
}
}
},
"DocumentType": {
"type": "structure",
"document": true
}
},
"cases": [
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"documentValue": {"foo": "bar"}
},
"response": {
"status_code": 200,
"headers": {},
"body": "{\"documentValue\": {\"foo\": \"bar\"}}"
}
}
]
},
{
"description": "Serializes aggregate documents as part of the JSON response payload with no escaping.",
"metadata": {
"protocol": "rest-json",
"apiVersion": "2014-01-01"
},
"shapes": {
"OutputShape": {
"type": "structure",
"members": {
"documentValue": {
"shape": "DocumentType"
}
}
},
"DocumentType": {
"type": "structure",
"document": true
}
},
"cases": [
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"documentValue": {
"str": "test",
"num": 123,
"float": 1.2,
"bool": true,
"null": "",
"document": {"foo": false},
"list": ["myname", 321, 1.3, true, "", {"nested": true}, [200, ""]]
}
},
"response": {
"status_code": 200,
"headers": {},
"body": "{\"documentValue\": {\"str\": \"test\", \"num\": 123, \"float\": 1.2, \"bool\": true, \"null\": \"\", \"document\": {\"foo\": false}, \"list\": [\"myname\", 321, 1.3, true, \"\", {\"nested\": true}, [200, \"\"]]}}"
}
},
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"documentValue": [
"test",
123,
1.2,
true,
"",
{"str": "myname", "num": 321, "float": 1.3, "bool": true, "null": "", "document": {"nested": true}, "list": [200, ""]},
["foo", false]
]
},
"response": {
"status_code": 200,
"headers": {},
"body": "{\"documentValue\": [\"test\", 123, 1.2, true, \"\", {\"str\": \"myname\", \"num\": 321, \"float\": 1.3, \"bool\": true, \"null\": \"\", \"document\": {\"nested\": true}, \"list\": [200, \"\"]}, [\"foo\", false]]}"
}
}
]
},
{
"description": "Tagged Unions",
"metadata": {
"protocol": "rest-json"
},
"shapes": {
"OutputShape": {
"type": "structure",
"members": {
"UnionMember": {
"shape": "UnionType"
}
}
},
"UnionType": {
"type": "structure",
"members": {
"S":{"shape":"StringType"},
"L": {"shape": "ListType"}
},
"union": true
},
"ListType": {
"type": "list",
"member": {
"shape": "StringType"
}
},
"StringType": {
"type": "string"
}
},
"cases": [
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"UnionMember": {"S": "mystring"}
},
"response": {
"status_code": 200,
"headers": {},
"body": "{\"UnionMember\": {\"S\": \"mystring\"}}"
}
},
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"UnionMember": {"L": ["a", "b"]}
},
"response": {
"status_code": 200,
"headers": {},
"body": "{\"UnionMember\": {\"L\": [\"a\", \"b\"]}}"
}
},
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"UnionMember": {"SDK_UNKNOWN_MEMBER": {"name": "SomeUnknownMember"}}
},
"response": {
"status_code": 200,
"headers": {},
"body": "{\"UnionMember\": {\"SomeUnknownMember\": \"foo\"}}"
}
}
]
},
{
"description": "List in header",
"metadata": {
"protocol": "rest-json"
},
"shapes": {
"OutputShape": {
"type": "structure",
"members": {
"ListMember": {
"shape": "ListShape",
"location": "header",
"locationName": "x-amz-list-member"
}
}
},
"ListShape": {
"type": "list",
"member": {
"shape": "EnumType"
}
},
"EnumType": {
"type": "string",
"enum": ["one", "two", "three"]
}
},
"cases": [
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"ListMember": ["one", "two", "three"]
},
"response": {
"status_code": 200,
"headers": {
"x-amz-list-member": " one,two , three "
},
"body": ""
}
}
]
},
{
"description": "Number in header",
"metadata": {
"protocol": "rest-json"
},
"shapes": {
"OutputShape": {
"type": "structure",
"members": {
"IntegerMember": {
"shape": "IntegerShape",
"location": "header",
"locationName": "x-amz-integer-member"
},
"LongMember": {
"shape": "LongShape",
"location": "header",
"locationName": "x-amz-long-member"
}
}
},
"IntegerShape": {
"type": "integer"
},
"LongShape": {
"type": "long"
}
},
"cases": [
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"IntegerMember": 123,
"LongMember": 200
},
"response": {
"status_code": 200,
"headers": {
"x-amz-integer-member": "123",
"x-amz-long-member": "200"
},
"body": ""
}
}
]
}
]