-
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
feat: simplify filter and where usage for constraint, schema, and OpenAPI mapping #4745
Conversation
03d7109
to
be725df
Compare
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.
Looks good. 👍
babe088
to
e2a4222
Compare
findById
@dougal83 I added one more feature. PTAL. |
e2a4222
to
bdfa28a
Compare
bdfa28a
to
5e3703d
Compare
@raymondfeng I'm a bit confused about why we're excluding (also there's a typo in the second commit message, |
5e3703d
to
01eec6c
Compare
The rationale behind |
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 rationale behind findById is to look up a record by its primary key (id). No other search criteria should be used. If a client wants to search beyond id, use
find
orfindOne
instead.
Ah, I see. Thank you for the explanation 👍
@raymondfeng |
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.
Other than @derdeka's comments, everything else LGTM 👍
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.
Personally, I think it's a better design to allow callers of getFilterSchemaFor
and @param.filter
to provide {excludeWhere: true}
when they want to remove where
from the schema, I find it more extensible and future-proof.
Having said that, it's something we can implement in addition to what's proposed in this pull request. I see there have been already view approvals, I am ok to go with the crowd.
packages/cli/snapshots/integration/generators/controller.integration.snapshots.js
Outdated
Show resolved
Hide resolved
2c2b093
to
a0e2e6e
Compare
@bajtos +1 If given a preference I would prefer to use this approach that you've given. While either way will work it is neater to use an option. |
@dougal83 The PR has been refined to address the review comments. PTAL. |
exports[ | ||
`lb4 relation checks generated source class repository answers {"relationType":"belongsTo","sourceModel":"Order","destinationModel":"Customer"} generates Order repository file with different inputs 1` | ||
] = ` | ||
exports[`lb4 relation checks generated source class repository answers {"relationType":"belongsTo","sourceModel":"Order","destinationModel":"Customer"} generates Order repository file with different inputs 1`] = ` |
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.
nitpick: double space after repository
?
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.
Sorry, I'll move this commit to a separate PR. The snapshot is generated. If we need to fix the prompt, we should fix cli
.
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.
See #4761
31177ff
to
137aa2d
Compare
137aa2d
to
282c371
Compare
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.
👍 Nice to have the shortcut!
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.
Awesome, I find the new implementation so much simpler and also more flexible 💪
I have few comments on details that could be improved, see below.
packages/repository-json-schema/src/__tests__/unit/filter-json-schema.unit.ts
Outdated
Show resolved
Hide resolved
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.
LGTM
@raymondfeng Feel free to merge the PR after my comments are addressed, no need to wait for another review from me (unless you want to). |
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.
👏
282c371
to
60514c6
Compare
Fixes #1721, #3336, and #1749
findById
filter.fields
filter
andwhere
Checklist
👉 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 👈