Closed cberio closed 6 years ago
Hello! The ResourceKeyResolver
actually used to return null
, but I changed it to a string for the sparse fieldset feature (the only
-method). Basically, Fractal uses the resource keys for the root object and relationships to filter out allowed fields.
In cases where you're transforming a model or a collection of models we will automatically resolve a resource key from the model's table, so no issue there. However, when there are no results, we would have no way of resolving a resource key, and an error would be thrown complaining about a missing resource key: https://github.com/flugger/laravel-responder/blob/master/src/FractalTransformFactory.php#L72
I'm not really sure why the data
would be added in the first place, there are no places in the NoopSerializer
that the resource key is actually used.
hello handsome mustache! I made small PR for trying to fix #115,
seems returning null as resourceKey is looks fine.
should I add more 'feature' test case for it?