You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given a resource named main having two related resources of type a and b. When requesting main using fields[a]=label and fields[b]=label Result all fields of resource b are returned. Expected only label must be returned.
publicCollection<QuerySpec> getNestedSpecs() {
// Using a set to remove duplicate querySpec between typeRelatedSpecs and classRelatedSpecsSet<QuerySpec> allRelatedSpecs = newHashSet(typeRelatedSpecs.values());
allRelatedSpecs.addAll(classRelatedSpecs.values());
returnCollections.unmodifiableCollection(allRelatedSpecs);
}
and
QuerySpec.equals does not use resourceType (neither resourceClass).
So when DocumentMapperUtil.getRequestedFields is called, QuerySpecAdapter.getIncludedFields is called, and then QuerySpec.getNestedSpecs is called ... and a spec is missing.
The text was updated successfully, but these errors were encountered:
Issue
Given a resource named
main
having two related resources of typea
andb
.When requesting
main
usingfields[a]=label
andfields[b]=label
Result all fields of resource
b
are returned.Expected only
label
must be returned.Example :
Resources
NB: Getters and setters are omitted for brevity.
Requests
NB: requests are written with httpie, for these examples, you just have to know that 'x==y' means add a request parameter x with value y.
No fields 👍
http :8080/main/mainId include==relatedResourceA,relatedResourceB
All fields from resource A and resource B are returned.
Only label for resource A (or resource B) 👍
http :8080/main/mainId include==relatedResourceA,relatedResourceB 'fields[a]==label'
Field
otherField
has been filtered out.Only label for resource A and resource B 👎
http :8080/main/mainId include==relatedResourceA,relatedResourceB 'fields[a]==label' 'fields[b]==label'
The field 'somethingDifferent' is returned when it shouldn't
Here the full spring boot app to illustrate
You need maven and java (8+), unzip, go to directory, run
mvn spring-boot:run
Causes :
QuerySpec. getNestedSpecs returns a Set of QuerySpec
and
QuerySpec.equals does not use resourceType (neither resourceClass).
So when DocumentMapperUtil.getRequestedFields is called, QuerySpecAdapter.getIncludedFields is called, and then QuerySpec.getNestedSpecs is called ... and a spec is missing.
The text was updated successfully, but these errors were encountered: