Campoie / rest-assured

Automatically exported from code.google.com/p/rest-assured
0 stars 0 forks source link

Providing Type of parameterized collections in JSON #141

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Provide a REST service returning a typed JSON array like this one : [ { 
"foo": "foo", "bar": "bar" }, { "foo": "hello", "bar": "world" } ]
2. Try to call this service in rest-assured, then map it on a List<Foo> (where 
Foo contains foo and bar fields) :
List<Foo> myList = expect().statusCode(200).when().get("/foos").as(List.class);
3. Since we have reified generics in Java, rest-assured cannot predict the 
parameterized type of the List and then, will map the return type in a 
List<Map> instead of a List<Foo>

Idea would be to provide a GSON-like approach with something looking like 
TypeToken.

Discussion started on google group here : 
https://groups.google.com/forum/#!topic/rest-assured/0GIQQfzC_6c

Original issue reported on code.google.com by fcamb...@gmail.com on 10 Jan 2012 at 8:08

GoogleCodeExporter commented 9 years ago

Original comment by johan.ha...@gmail.com on 10 Jan 2012 at 10:26

GoogleCodeExporter commented 9 years ago

Original comment by johan.ha...@gmail.com on 2 Feb 2012 at 7:18