Fix embedded filter silently getting ignored (#2133)
When the embedded resource is not included in the request
This commit is contained in:
@@ -68,6 +68,7 @@ instance PgrstError ApiRequestError where
|
||||
status NoRpc{} = HTTP.status404
|
||||
status (UnacceptableSchema _) = HTTP.status406
|
||||
status (ContentTypeError _) = HTTP.status415
|
||||
status (NotEmbedded _) = HTTP.status400
|
||||
|
||||
headers _ = [ContentType.toHeader CTApplicationJSON]
|
||||
|
||||
@@ -111,6 +112,9 @@ instance JSON.ToJSON ApiRequestError where
|
||||
"message" .= ("The schema must be one of the following: " <> T.intercalate ", " schemas)]
|
||||
toJSON (ContentTypeError cts) = JSON.object [
|
||||
"message" .= ("None of these Content-Types are available: " <> T.intercalate ", " (map T.decodeUtf8 cts))]
|
||||
toJSON (NotEmbedded resource) = JSON.object [
|
||||
"hint" .= ("Verify that '" <> resource <> "' is included in the 'select' query parameter." :: Text),
|
||||
"message" .= ("Cannot apply filter because '" <> resource <> "' is not an embedded resource in this request" :: Text)]
|
||||
|
||||
compressedRel :: Relationship -> JSON.Value
|
||||
compressedRel Relationship{..} =
|
||||
|
||||
Reference in New Issue
Block a user