Reject queries with incompatible "filter.fields" and "filter.include" #3455
Labels
feature
Relations
Model relations (has many, etc.)
Repository
Issues related to @loopback/repository package
stale
The filter property
fields
allows callers to limit which model properties are returned by the database. This creates a problem when the primary or the foreign key is excluded from the data, because then we cannot resolve included models.In LB3, I think we were silently ignoring
include
filter in such case.I am proposing to be more explicit in LB4 and reject such queries with a 4xx (Bad Request) error.
Later, we can improve our implementation to automatically add PK/FK properties to the
fields
configuration and remove PK/FK properties from the data returned back to the user, so that inclusions are resolved as expected and yet the data contains only the specified properties.See also #3387
Acceptance criteria
TBD - will be filled by the team.
The text was updated successfully, but these errors were encountered: