Add fallback for unrecognised types in BigQuery RestArgument decoder

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5042
GitOrigin-RevId: 45efb6dff9fbe8e2ec10356921e5c61b2af1bcda
This commit is contained in:
Tom Harding 2022-07-14 09:26:49 +01:00 committed by hasura-bot
parent 6b03f8b0af
commit 2e940f88c4
2 changed files with 17 additions and 2 deletions

View File

@ -59,6 +59,7 @@
### Bug fixes and improvements
- server: use `root_field_namespace` as prefix for remote schema (fixes #8438)
- server: allow all argument types for BigQuery routines
- server: fix prefix/suffix behaviour for `graphql-default` naming convention (fixes #8544)
- server: fix namespace visibility during introspection (fix #8434)
- server: Create missing SQL triggers, if any, while reloading metadata and startup.

View File

@ -316,7 +316,14 @@ instance FromJSON RestArgument where
( \o -> do
name <- o .:? "name"
typeObject <- o .:? "dataType"
type' <- mapM (.: "typeKind") typeObject
-- (Hopefully) very temporary fix: right now, we don't have an
-- understanding of @ARRAY@ as a 'RestType', which is causing issues
-- in production. With this change, we ignore any BigQuery argument
-- types that we don't recognise. While not ideal, this should be
-- safe, as we shouldn't get types from BigQuery that it can't itself
-- understand.
type' <- mapM (.: "typeKind") typeObject <|> pure Nothing
pure $ RestArgument name type'
)
@ -336,7 +343,14 @@ instance FromJSON RestStandardSqlField where
( \o -> do
name <- o .:? "name"
typeObject <- o .:? "type"
type' <- mapM (.: "typeKind") typeObject
-- (Hopefully) very temporary fix: right now, we don't have an
-- understanding of @ARRAY@ as a 'RestType', which is causing issues
-- in production. With this change, we ignore any BigQuery argument
-- types that we don't recognise. While not ideal, this should be
-- safe, as we shouldn't get types from BigQuery that it can't itself
-- understand.
type' <- mapM (.: "typeKind") typeObject <|> pure Nothing
pure $ RestStandardSqlField name type'
)