feat: simplify filter and where usage for constraint, schema, and OpenAPI mapping#4745
feat: simplify filter and where usage for constraint, schema, and OpenAPI mapping#4745raymondfeng merged 6 commits intomasterfrom
Conversation
03d7109 to
be725df
Compare
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 |
nabdelgadir
left a comment
There was a problem hiding this comment.
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
findorfindOneinstead.
Ah, I see. Thank you for the explanation 👍
@raymondfeng |
bajtos
left a comment
There was a problem hiding this comment.
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.
nitpick: double space after repository?
There was a problem hiding this comment.
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.
31177ff to
137aa2d
Compare
137aa2d to
282c371
Compare
jannyHou
left a comment
There was a problem hiding this comment.
👍 Nice to have the shortcut!
bajtos
left a comment
There was a problem hiding this comment.
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
|
@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). |
282c371 to
60514c6
Compare
Fixes #1721, #3336, and #1749
findByIdfilter.fieldsfilterandwhereChecklist
👉 Read and sign the CLA (Contributor License Agreement) 👈
npm testpasses on your machinepackages/cliwere updatedexamples/*were updated👉 Check out how to submit a PR 👈