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

Providing Type of parameterized collections in JSON #64

Closed
johanhaleby opened this issue Jul 20, 2015 · 2 comments
Closed

Providing Type of parameterized collections in JSON #64

johanhaleby opened this issue Jul 20, 2015 · 2 comments

Comments

@johanhaleby
Copy link
Collaborator

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

@johanhaleby
Copy link
Collaborator Author

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

  • Changed state: Accepted
  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect

@johanhaleby
Copy link
Collaborator Author

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

  • Added labels: 1.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant