Closed nabdelgadir closed 3 years ago
Few examples of the syntax supported by LB3:
userRepo.find({include: ['posts', 'passports']});
userRepo.find({
include: [
{relation: 'posts', scope: {where: {title: 'Post A'}}},
'passports',
],
});
Description / Steps to reproduce / Feature proposal
See https://github.com/strongloop/loopback-next/pull/3171/files#r296128644.
Currently to specify inclusion, the following filter syntax is needed:
{include: [{relation: 'todos'}]}
e.g. http://127.0.0.1:3000/todo-lists?filter[include][][relation]=todosIf we try the following call:
The complier complains:
Argument of type '{ include: string[]; }' is not assignable to parameter of type 'Filter<TodoList>'
because the type is currently:include?: Inclusion<MT>[];
As LoopBack 3 supports
{include: ['todos']}
, LoopBack 4 should support this shortcut as well.Acceptance Criteria
{include: ['todos']}
is accepted.Important: we need to preserve backwards compatiblity, i.e. the current verbose syntax must stay supported too.