Closed Human closed 3 years ago
@Human thanks for PR, will take a look and merge/provide feedback.
Hello @Human,
I've finally checked the PR.
Instead of making validation dependant on the ALLOW_UNKNOWN_INCLUSIONS
, validation should be changed so it allows resource objects with only id
and type
attributes. Currently, validation also requires the attributes
attribute which then causes the test to fail.
So, validation logic of included resources should be changed to correctly enforce the JSON spec: https://jsonapi.org/format/#document-resource-objects
Edit:
Following change to the validation logic should fix it:
public static boolean isArrayOfResourceObjects(JsonNode dataNode) {
if (dataNode != null && dataNode.isArray()) {
for (JsonNode element : dataNode) {
if (!isResourceObject(element) && !isResourceIdentifierObject(element)) {
return false;
}
}
return true;
}
return false;
}
…orming a more thorough check of 'included'
I believe commit 6e5f1d479ae1d27eceeaec81d1df7fdf57c0f66e introduced this regression. There's a new json resource and unit test that fails in 0.10 but passes in this branch. All other unit tests (including the ones added as part of 6e5f1d479ae1d27eceeaec81d1df7fdf57c0f66e) still pass.