Skip to content

Commit

Permalink
Replace input values with formatted values in JSON list serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
jeskew committed Jun 25, 2015
1 parent 959ebde commit 70cdeba
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Api/Serializer/JsonBody.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private function format(Shape $shape, $value)
case 'list':
$items = $shape->getMember();
foreach ($value as &$v) {
$data[] = $this->format($items, $v);
$v = $this->format($items, $v);
}
return $value;

Expand Down
76 changes: 76 additions & 0 deletions tests/Api/test_cases/protocols/input/json.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,82 @@
}
]
},
{
"description": "Lists",
"metadata": {
"protocol": "json",
"jsonVersion": 1.1,
"targetPrefix": "com.amazonaws.foo"
},
"shapes": {
"InputShape": {
"type": "structure",
"members": {
"Structures": {
"shape": "StructureList"
}
}
},
"StructureList": {
"type": "list",
"member": {
"shape": "StructureType"
}
},
"StructureType": {
"type": "structure",
"members": {
"a": {
"type": "string"
},
"b": {
"type": "integer"
},
"c": {
"type": "double"
},
"d": {
"type": "timestamp"
},
"e": {
"type": "blob"
}
}
}
},
"cases": [
{
"given": {
"input": {
"shape": "InputShape"
},
"name": "OperationName",
"http": {
"method": "POST"
}
},
"params": {
"Structures": [
{
"a": "a",
"b": 1,
"c": 2.5,
"d": 1397259637,
"e": "string"
}
]
},
"serialized": {
"uri": "/",
"body": "{\"Structures\": [{\"a\": \"a\", \"b\": 1, \"c\": 2.5, \"d\": 1397259637, \"e\": \"c3RyaW5n\"}]}",
"headers": {
"X-Amz-Target": "com.amazonaws.foo.OperationName",
"Content-Type": "application/x-amz-json-1.1"
}
}
}
]
},
{
"description": "Timestamp values",
"metadata": {
Expand Down

0 comments on commit 70cdeba

Please sign in to comment.