forked from OSS/graphql-spice
Release 1.0.0.0
This commit is contained in:
@ -1,7 +1,12 @@
|
||||
{- This Source Code Form is subject to the terms of the Mozilla Public License,
|
||||
v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
obtain one at https://mozilla.org/MPL/2.0/. -}
|
||||
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE NamedFieldPuns #-}
|
||||
{-# LANGUAGE RecordWildCards #-}
|
||||
|
||||
-- | JSON serialization.
|
||||
module Language.GraphQL.JSON
|
||||
( JSON(..)
|
||||
, graphql
|
||||
@ -31,6 +36,7 @@ import qualified Language.GraphQL.Type.In as In
|
||||
import qualified Language.GraphQL.Type.Out as Out
|
||||
import qualified Language.GraphQL.Type as Type
|
||||
|
||||
-- | Wraps an aeson value.
|
||||
newtype JSON = JSON Aeson.Value
|
||||
|
||||
instance Aeson.ToJSON JSON where
|
||||
@ -111,7 +117,7 @@ instance VariableValue JSON where
|
||||
foldVector _ Nothing = Nothing
|
||||
foldVector variableValue (Just list) = do
|
||||
coerced <- coerceVariableValue listType $ JSON variableValue
|
||||
pure $ coerced : list
|
||||
pure $ coerced : list
|
||||
coerceVariableValue _ _ = Nothing
|
||||
|
||||
-- | If the text parses correctly as a @GraphQL@ query the query is
|
||||
|
Reference in New Issue
Block a user