-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
chore: Add separate request/response views #32448
Merged
Merged
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
4b4d23e
chore: Add separate request/response views (#31781)
sharat87 8f5bbef
Fix consolidated API's JsonView scope
sharat87 7e839b1
Merge branch 'release' into chore/jsonview
sharat87 fb7ec42
chore: merge release branch
sharat87 9561bc4
wip
sharat87 f332a0a
chore: merge release branch
sharat87 f2c9e1e
chore: merge release branch
sharat87 2ea52c4
Fix API action creation, again
sharat87 0a1a710
Add FromRequest view on id
sharat87 898ab55
fix again
sharat87 388d7f9
fix creation
sharat87 1bfa8fe
undo
sharat87 0ce8d68
fix more
sharat87 85a5ba3
Remove ToResponse
sharat87 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
chore: Add separate request/response views (#31781)
This PR gets finer control into what fields are allowed in request-body-only, vs what's allowed in response-body-only. This leaves the fields to separately controlled regarding what can go into the database and what can't. [Slack thread](https://theappsmith.slack.com/archives/CPQNLFHTN/p1710125307810949). ✅ Server and Cypress **Sanity** tests pass on EE. (cherry picked from commit 2617000)
- Loading branch information
commit 4b4d23eb7091eb8991dc2d21ccdcd9e98f7dda59
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/views/FromRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.appsmith.external.views; | ||
|
||
/** | ||
* Intended to annotate fields that can be set by HTTP request payloads, but should NOT be included | ||
* in HTTP responses sent back to the client. | ||
*/ | ||
public interface FromRequest extends Views.Public {} |
8 changes: 8 additions & 0 deletions
8
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/views/ToResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.appsmith.external.views; | ||
|
||
/** | ||
* Intended to mark entity/DTO fields that should be included as part of HTTP responses, but should | ||
* be ignored as part of HTTP requests. For example, if a field is marked with this annotation, in | ||
* a class used with {@code @RequestBody}, it's value will NOT be deserialized. | ||
*/ | ||
public interface ToResponse extends Views.Public {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I understand that we're using
FromRequest
to differentiate views that are restricted for client to edit. Could you please help me understand what the difference betweenToResponse
andPublic
is in this respect?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.
Hey, thanks for asking. Good question. It likely will work fine if I keep it to
ToResponse
. I've done so many experiments I don't recall why I didn't revert this. Let me go check that and come back. Thanks!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.
Done. Removed
ToResponse
, and all Cypress tests pass on EE. Can you review/approve please? Thanks!