Skip to content

ResourceAssemblerSupport.toResources() should return Resources<D> instead of List<D> #416

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

Closed
JakobFels opened this issue Nov 19, 2015 · 0 comments
Assignees
Milestone

Comments

@JakobFels
Copy link

When exposing a Collection as a Resource, it is counter intuitive to have to wrap the result of toResources() into an Object of Resources.

List<DomainObject> objects = domainRepository.findAll();
List<DomainResource> resources = myResourceAssembler.toResources(objects);
Resources<DomainResource> resourcesWrapped = new Resources<>(resources);
//Add links to resources etc...

Ideally, toResources should actually return Resources, like the name implies.

@gregturn gregturn self-assigned this May 23, 2017
gregturn added a commit that referenced this issue May 23, 2017
Adds getters to allow implementers access to controllerClass and resourceType.

Related issues: #416
gregturn added a commit that referenced this issue May 23, 2017
Implement a ResourceAssembler that returns a Resource<T> solely based on a non-Resource domain class.

Related issues: #416
gregturn added a commit that referenced this issue Sep 26, 2017
To avoid confusion about what to return on a Spring MVC endpoint, change toResources to not return `List<D>`, but instead `Resources<D>`. This clearly ensures when used to construct Spring MVC endpoints, will return a type Spring HATEOAS will properly marshal.

Related issues: #493
Related pull requests: #572
gregturn added a commit that referenced this issue Sep 26, 2017
To avoid confusion about what to return on a Spring MVC endpoint, change toResources to not return `List<D>`, but instead `Resources<D>`. This clearly ensures when used to construct Spring MVC endpoints, will return a type Spring HATEOAS will properly marshal.

Related issues: #493
Related pull requests: #572
gregturn added a commit that referenced this issue Sep 10, 2018
Implement a ResourceAssembler that returns a Resource<T> solely based on a non-Resource domain class.

Related issues: #416
gregturn added a commit that referenced this issue Sep 10, 2018
Implement a ResourceAssembler that returns a Resource<T> solely based on a non-Resource domain class.

Related issues: #416
gregturn added a commit that referenced this issue Sep 10, 2018
Adds getters to allow implementers access to controllerClass and resourceType.

Related issues: #416
gregturn added a commit that referenced this issue Sep 10, 2018
Adds getters to allow implementers access to controllerClass and resourceType.

Related issues: #416
gregturn added a commit that referenced this issue Dec 6, 2018
To avoid confusion about what to return on a Spring MVC endpoint, change toResources to not return `List<D>`, but instead `Resources<D>`. This clearly ensures when used to construct Spring MVC endpoints, will return a type Spring HATEOAS will properly marshal.

Related issues: #493
Related pull requests: #572
gregturn added a commit that referenced this issue Dec 6, 2018
To avoid confusion about what to return on a Spring MVC endpoint, change toResources to not return `List<D>`, but instead `Resources<D>`. This clearly ensures when used to construct Spring MVC endpoints, will return a type Spring HATEOAS will properly marshal.

Related issues: #493
Related pull requests: #572
gregturn added a commit that referenced this issue Dec 6, 2018
To avoid confusion about what to return on a Spring MVC endpoint, change toResources to not return `List<D>`, but instead `Resources<D>`. This clearly ensures when used to construct Spring MVC endpoints, will return a type Spring HATEOAS will properly marshal.

To support people that have already built apps on top of Lists, include a `toList<D>` method that honors the old contract.

Related issues: #493
Related pull requests: #572

Hack
gregturn added a commit that referenced this issue Dec 18, 2018
To avoid confusion about what to return on a Spring MVC endpoint, change toResources to not return `List<D>`, but instead `Resources<D>`. This clearly ensures when used to construct Spring MVC endpoints, will return a type Spring HATEOAS will properly marshal.

To support people that have already built apps on top of Lists, include a `toList<D>` method that honors the old contract.

Related issues: #493
Related pull requests: #572
@gregturn gregturn added this to the 1.0 M1 milestone Dec 18, 2018
gregturn added a commit that referenced this issue Dec 18, 2018
Implement a ResourceAssembler that returns a Resource<T> solely based on a non-Resource domain class.

Related issues: #416
gregturn added a commit that referenced this issue Dec 18, 2018
Implement a ResourceAssembler that returns a Resource<T> solely based on a non-Resource domain class.

Related issues: #416
gregturn added a commit that referenced this issue Dec 18, 2018
Implement a ResourceAssembler based solely on a domain type, returning Resource<T> for the `toResource(obj)` method.

Related issues: #416
gregturn added a commit that referenced this issue Dec 18, 2018
Implement a ResourceAssembler based solely on a domain type, returning Resource<T> for the `toResource(obj)` method.

Related issues: #416
gregturn added a commit that referenced this issue Dec 18, 2018
Implement a ResourceAssembler based solely on a domain type, returning Resource<T> for the `toResource(obj)` method.

Related issues: #416
gregturn added a commit that referenced this issue Dec 18, 2018
Implement a ResourceAssembler based solely on a domain type, returning Resource<T> for the `toResource(obj)` method.

Related issues: #416
gregturn added a commit that referenced this issue Dec 19, 2018
Implement a ResourceAssembler based solely on a domain type, returning Resource<T> for the `toResource(obj)` method.

Related issues: #416
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

2 participants