From 2e940f88c474fb30d4269788c9e253be76077035 Mon Sep 17 00:00:00 2001 From: Tom Harding Date: Thu, 14 Jul 2022 09:26:49 +0100 Subject: [PATCH] Add fallback for unrecognised types in `BigQuery` `RestArgument` decoder PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5042 GitOrigin-RevId: 45efb6dff9fbe8e2ec10356921e5c61b2af1bcda --- CHANGELOG.md | 1 + .../src-lib/Hasura/Backends/BigQuery/Meta.hs | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 607a6aba02d..a744c7171ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/server/src-lib/Hasura/Backends/BigQuery/Meta.hs b/server/src-lib/Hasura/Backends/BigQuery/Meta.hs index 18e5e065225..1d199159931 100644 --- a/server/src-lib/Hasura/Backends/BigQuery/Meta.hs +++ b/server/src-lib/Hasura/Backends/BigQuery/Meta.hs @@ -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' )