-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: [WIP] parameters tracked snippets, and application/json+sql response #4012
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
base: main
Are you sure you want to change the base?
Changes from all commits
a8500be
ae3d4ad
cc2901d
7535bb2
bf5aaa8
3dd222d
eb98b1e
d378f2d
85d96e5
ab98656
ff87f23
68472c7
2243b97
ea338e1
8a2f56b
d005ed3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1088,6 +1088,7 @@ negotiateContent conf ApiRequest{iAction=act, iPreferences=Preferences{preferRep | |||||||||||||||
-- TODO: despite no aggregate, these are responding with a Content-Type, which is not correct. | ||||||||||||||||
(ActDb (ActRelationRead _ True), Just (_, mt)) -> Right (NoAgg, mt) | ||||||||||||||||
(ActDb (ActRoutine _ (InvRead True)), Just (_, mt)) -> Right (NoAgg, mt) | ||||||||||||||||
(_, Just (_, MTApplicationJSONSQL)) -> Right (NoAgg, MTApplicationJSONSQL) | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This media type should be opt in (it reveals internal details that should only be available for debugging purposes), I suggest reusing the https://docs.postgrest.org/en/v12/references/configuration.html#db-plan-enabled ( postgrest/src/PostgREST/Plan.hs Lines 1098 to 1104 in c732591
It's a bit messy now unfortunately. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah so in a way on the Plan there should be a check to allow it if the |
||||||||||||||||
(_, Just (x, mt)) -> Right (x, mt) | ||||||||||||||||
where | ||||||||||||||||
firstAcceptedPick = listToMaybe $ mapMaybe matchMT accepts -- If there are multiple accepted media types, pick the first. This is usual in content negotiation. | ||||||||||||||||
|
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.
application/json
suffixes have to be registered on IANA to be valid (ref).So we would need a vendored media type. I suggest
application/vnd.pgrst.sql+json
.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.
Since
+json
is a registered suffix, wouldapplication/sql+json
work?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.
IIUC, we would have to register the
+json
to the SQL media type if we want to use it like that.That being said, I like that media type too and it doesn't seem "potentially damaging", unlike adding a suffix to
application/json
.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 do like the idea of vendoring the media type, though prefixing
sql
makes it more clear though IMO. Just to be safe, I'll probably go with the vendored media type for now