mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 08:02:15 +03:00
Ignore unexpected fields in action responses
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/2459 GitOrigin-RevId: 9269fa6e71770cb31183d917595b704c5dee9713
This commit is contained in:
parent
4e05bdcaec
commit
22bc0e09df
@ -3,6 +3,7 @@
|
||||
## Next release
|
||||
(Add entries below in the order of server, console, cli, docs, others)
|
||||
|
||||
- server: Ignore unexpected fields in action responses (#5731)
|
||||
- server: add webhook transformations for Actions and EventTriggers
|
||||
- server: optimize SQL query generation with LIMITs
|
||||
- server: add GraphQL request query in the payload for synchronous actions
|
||||
|
@ -574,11 +574,7 @@ callWebhook
|
||||
|
||||
-- Webhook response object should conform to action output fields
|
||||
validateResponseObject obj = do
|
||||
-- Fields not specified in the output type shouldn't be present in the response
|
||||
let extraFields = filter (not . flip Map.member outputFields) $ Map.keys obj
|
||||
unless (null extraFields) $
|
||||
throwUnexpected $
|
||||
"unexpected fields in webhook response: " <> commaSeparated extraFields
|
||||
-- Note: Fields not specified in the output are ignored
|
||||
|
||||
void $
|
||||
flip Map.traverseWithKey outputFields $ \fieldName fieldTy ->
|
||||
|
@ -395,6 +395,7 @@ class ActionsWebhookHandler(http.server.BaseHTTPRequestHandler):
|
||||
return response, HTTPStatus.BAD_REQUEST
|
||||
|
||||
response = resp['data']['insert_user_one']
|
||||
|
||||
return response, HTTPStatus.OK
|
||||
|
||||
def create_users(self):
|
||||
|
@ -1,40 +1,11 @@
|
||||
description: Unexpected extra field in response
|
||||
description: Unexpected extra field in response should be ignored
|
||||
url: /v1/graphql
|
||||
status: 200
|
||||
response:
|
||||
errors:
|
||||
- extensions:
|
||||
internal:
|
||||
error: unexpected response
|
||||
response:
|
||||
status: 200
|
||||
body:
|
||||
age: 25
|
||||
name: Alice
|
||||
id: some-id
|
||||
headers:
|
||||
- value: application/json
|
||||
name: Content-Type
|
||||
- value: abcd
|
||||
name: Set-Cookie
|
||||
request:
|
||||
body:
|
||||
session_variables:
|
||||
x-hasura-role: admin
|
||||
input:
|
||||
arg:
|
||||
age: 25
|
||||
name: Alice
|
||||
id: some-id
|
||||
action:
|
||||
name: mirror
|
||||
request_query: "mutation ($id: ID, $name: String, $age: Int) {\n mirror(arg:\
|
||||
\ {id: $id, name: $name, age: $age}){\n id\n name\n }\n}\n"
|
||||
url: http://127.0.0.1:5593/mirror-action
|
||||
headers: []
|
||||
path: $
|
||||
code: unexpected
|
||||
message: 'unexpected fields in webhook response: age'
|
||||
data:
|
||||
mirror:
|
||||
id: some-id
|
||||
name: Alice
|
||||
query:
|
||||
variables:
|
||||
id: some-id
|
||||
|
Loading…
Reference in New Issue
Block a user