-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: add url, diagram for 3 relations for inclusion #4007
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor comments / suggestions. They apply to both BelongsTo and HasMany md files. Thanks.
docs/site/BelongsTo-relation.md
Outdated
@@ -328,6 +328,13 @@ on constructor to avoid "Circular dependency" error (see | |||
|
|||
## Querying related models | |||
|
|||
LoopBack 4 creates a different inclusion resolver for each relation type. Each |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we call it LoopBack
instead of LoopBack 4
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't mention anything about inclusion resolver in LB3. Would it be better if I change it to LB4
? or
Different from LB3, LB4 creates a different inclusion resolver for each relation type to query related models.
?
docs/site/BelongsTo-relation.md
Outdated
@@ -336,12 +343,18 @@ belongs to a `Customer`. | |||
|
|||
After setting up the relation in the repository class, the inclusion resolver | |||
allows users to retrieve all orders along with their related customers through | |||
the following code: | |||
the following code in repository level: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in repository level
-> in the repository class
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good diagram. LGTM, just a question about the url.
or use APIs with controllers: | ||
|
||
``` | ||
GET http://localhost:3000/orders?filter[include][][relation]=customer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it an extra []
? I am looking at the similar include filter in LB3 https://loopback.io/doc/en/lb2/Include-filter.html#rest-examples:
/customers?filter[include][reviews]=author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, /customers?filter[include][reviews]=author
wouldn't work because include.filter
is not a function.
And different queries between LB3 and LB4 make me wonder if we need a querying data
page for LB4 as well. Cause right now the only way to check the query syntax is to go to the LB3 site.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The include filter for LB2 is different from the LB4 one. In LB4 it's {include: [{relation: 'customer'}]}
, whereas in LB2 (from my understanding) it's {include: {customer: [/* ... */]}}
.
7db429a
to
49f38db
Compare
After triaging some community issues and the inclusion blog, I'd like to enhance our docs for inclusion to have less confusion.
inclusionResolvers
andinclusionResolver
GET ...
as query examples in case users don't know how to query it with controller/urlChecklist
👉 Read and sign the CLA (Contributor License Agreement) 👈
npm test
passes on your machinepackages/cli
were updatedexamples/*
were updated👉 Check out how to submit a PR 👈