这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion server/src-lib/Hasura/GraphQL/Resolve/Context.hs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ withArgM
-> (AnnGValue -> m a)
-> m (Maybe a)
withArgM args arg f = prependArgsInPath $ nameAsPath arg $
mapM f $ Map.lookup arg args
mapM f $ handleNull =<< Map.lookup arg args
where
handleNull v = bool (Just v) Nothing $ hasNullVal v

type PrepArgs = Seq.Seq Q.PrepArg

Expand Down
2 changes: 1 addition & 1 deletion server/src-lib/Hasura/GraphQL/Resolve/InputValue.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ asPGColVal
asPGColVal = \case
AGScalar colTy (Just val) -> return (colTy, val)
AGScalar colTy Nothing ->
throw500 $ "unexpected null for ty"
throw500 $ "unexpected null for ty "
<> T.pack (show colTy)
v -> tyMismatch "pgvalue" v

Expand Down
4 changes: 2 additions & 2 deletions server/src-lib/Hasura/GraphQL/Validate/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,11 @@ pgColValToAnnGVal colTy colVal = AGScalar colTy $ Just colVal

hasNullVal :: AnnGValue -> Bool
hasNullVal = \case
AGScalar _ Nothing -> True
AGScalar _ Nothing -> True
AGEnum _ Nothing -> True
AGObject _ Nothing -> True
AGArray _ Nothing -> True
_ -> False
_ -> False

getAnnInpValKind :: AnnGValue -> Text
getAnnInpValKind = \case
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
description: Nested select on article with limit (null)
url: /v1alpha1/graphql
status: 200
response:
data:
article:
- id: 3
title: Article 3
content: Sample article content 3
author:
id: 2
name: Author 2
- id: 2
title: Article 2
content: Sample article content 2
author:
id: 1
name: Author 1
- id: 1
title: Article 1
content: Sample article content 1
author:
id: 1
name: Author 1

query:
query: |
query {
article(limit: null, order_by: {id: desc}) {
id
title
content
author {
id
name
}
}
}
3 changes: 3 additions & 0 deletions server/tests-py/test_graphql_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ def test_limit_1(self, hge_ctx):
def test_limit_2(self, hge_ctx):
check_query_f(hge_ctx, self.dir() + '/select_query_article_limit_2.yaml')

def test_limit_null(self, hge_ctx):
check_query_f(hge_ctx, self.dir() + '/select_query_article_limit_null.yaml')

def test_err_str_limit_error(self, hge_ctx):
check_query_f(hge_ctx, self.dir() + '/select_query_article_string_limit_error.yaml')

Expand Down