morpheus-graphql-server 0.22.1 → 0.23.0
raw patch · 27 files changed
+297/−177 lines, 27 filesdep ~morpheus-graphql-appdep ~morpheus-graphql-coredep ~morpheus-graphql-subscriptionsPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: morpheus-graphql-app, morpheus-graphql-core, morpheus-graphql-subscriptions, morpheus-graphql-tests
API changes (from Hackage documentation)
- Data.Morpheus.Server.Types: [name] :: Rename -> Text
+ Data.Morpheus.Server.Types: DropNamespace :: Text -> DropNamespace
+ Data.Morpheus.Server.Types: InputTypeNamespace :: Text -> InputTypeNamespace
+ Data.Morpheus.Server.Types: [dropNamespace] :: DropNamespace -> Text
+ Data.Morpheus.Server.Types: [inputTypeNamespace] :: InputTypeNamespace -> Text
+ Data.Morpheus.Server.Types: [newName] :: Rename -> Text
+ Data.Morpheus.Server.Types: excludeFromSchema :: GQLDirective a => f a -> Bool
+ Data.Morpheus.Server.Types: newtype DropNamespace
+ Data.Morpheus.Server.Types: newtype InputTypeNamespace
+ Data.Morpheus.Server.Types: visitEnumNames :: VisitType a => a -> Text -> Text
+ Data.Morpheus.Server.Types: visitFieldNames :: VisitType a => a -> Text -> Text
- Data.Morpheus.Server.Types: visitTypeName :: VisitType a => a -> Text -> Text
+ Data.Morpheus.Server.Types: visitTypeName :: VisitType a => a -> Bool -> Text -> Text
Files
- morpheus-graphql-server.cabal +7/−7
- src/Data/Morpheus/Server/Deriving/Channels.hs +5/−10
- src/Data/Morpheus/Server/Deriving/Decode.hs +4/−9
- src/Data/Morpheus/Server/Deriving/Encode.hs +1/−3
- src/Data/Morpheus/Server/Deriving/Named/EncodeValue.hs +1/−3
- src/Data/Morpheus/Server/Deriving/Schema.hs +2/−3
- src/Data/Morpheus/Server/Deriving/Schema/Directive.hs +36/−12
- src/Data/Morpheus/Server/Deriving/Utils/Decode.hs +2/−4
- src/Data/Morpheus/Server/Deriving/Utils/DeriveGType.hs +8/−15
- src/Data/Morpheus/Server/Deriving/Utils/Proxy.hs +4/−14
- src/Data/Morpheus/Server/Types.hs +4/−0
- src/Data/Morpheus/Server/Types/DirectiveDefinitions.hs +43/−8
- src/Data/Morpheus/Server/Types/Directives.hs +37/−21
- src/Data/Morpheus/Server/Types/GQLType.hs +73/−30
- src/Data/Morpheus/Server/Types/Internal.hs +11/−3
- src/Data/Morpheus/Server/Types/SchemaT.hs +1/−1
- src/Data/Morpheus/Server/Types/Visitors.hs +14/−2
- test/Feature/Collision/CategoryCollisionSuccess.hs +13/−8
- test/Feature/Collision/category-collision-fail/response.json +1/−1
- test/Feature/Directive/Definition.hs +1/−1
- test/Feature/Directive/EnumVisitor.hs +5/−5
- test/Feature/Directive/FieldVisitor.hs +6/−6
- test/Feature/Input/Collections.hs +4/−5
- test/Feature/Input/collections/assoc/invalid/response.json +6/−2
- test/Feature/Input/collections/map/invalid/response.json +6/−2
- test/Feature/Input/variables/invalidValue/invalidDefaultValue/response.json +1/−1
- test/Feature/Input/variables/invalidValue/invalidDefaultValueButVariableProvided/response.json +1/−1
morpheus-graphql-server.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: morpheus-graphql-server-version: 0.22.1+version: 0.23.0 synopsis: Morpheus GraphQL description: Build GraphQL APIs with your favourite functional language! category: web, graphql@@ -320,8 +320,8 @@ , base >=4.7.0 && <5.0.0 , bytestring >=0.10.4 && <0.12.0 , containers >=0.4.2.1 && <0.7.0- , morpheus-graphql-app >=0.22.0 && <0.23.0- , morpheus-graphql-core >=0.22.0 && <0.23.0+ , morpheus-graphql-app >=0.23.0 && <0.24.0+ , morpheus-graphql-core >=0.23.0 && <0.24.0 , mtl >=2.0.0 && <3.0.0 , relude >=0.3.0 && <2.0.0 , template-haskell >=2.0.0 && <3.0.0@@ -365,11 +365,11 @@ , bytestring >=0.10.4 && <0.12.0 , containers >=0.4.2.1 && <0.7.0 , file-embed >=0.0.10 && <1.0.0- , morpheus-graphql-app >=0.22.0 && <0.23.0- , morpheus-graphql-core >=0.22.0 && <0.23.0+ , morpheus-graphql-app >=0.23.0 && <0.24.0+ , morpheus-graphql-core >=0.23.0 && <0.24.0 , morpheus-graphql-server- , morpheus-graphql-subscriptions >=0.22.0 && <0.23.0- , morpheus-graphql-tests >=0.22.0 && <0.23.0+ , morpheus-graphql-subscriptions >=0.23.0 && <0.24.0+ , morpheus-graphql-tests >=0.23.0 && <0.24.0 , mtl >=2.0.0 && <3.0.0 , relude >=0.3.0 && <2.0.0 , tasty >=0.1.0 && <1.5.0
src/Data/Morpheus/Server/Deriving/Channels.hs view
@@ -32,10 +32,10 @@ ( Decode, decodeArguments, )+import Data.Morpheus.Server.Deriving.Schema.Directive (toFieldRes) import Data.Morpheus.Server.Deriving.Utils ( ConsRep (..), DataType (..),- FieldRep (..), ) import Data.Morpheus.Server.Deriving.Utils.DeriveGType ( DeriveValueOptions (..),@@ -43,8 +43,7 @@ deriveValue, ) import Data.Morpheus.Server.Deriving.Utils.Kinded (KindedProxy (..), kinded)-import Data.Morpheus.Server.Types.GQLType (GQLType (typeOptions), deriveTypename, __typeData)-import Data.Morpheus.Server.Types.Internal (defaultTypeOptions)+import Data.Morpheus.Server.Types.GQLType (GQLType, deriveTypename, __typeData) import Data.Morpheus.Server.Types.Types (Undefined) import Data.Morpheus.Types.Internal.AST ( FieldName,@@ -140,12 +139,13 @@ instance (GQLType a, Generic a, DeriveWith (ChannelConstraint e) (ChannelRes e) (Rep a)) => ExploreChannels 'False e a where exploreChannels _ = HM.fromList- . convertNode+ . map (toFieldRes (Proxy @a))+ . consFields+ . tyCons . deriveValue ( DeriveValueOptions { __valueApply = getChannel, __valueTypeName = deriveTypename (KindedProxy :: KindedProxy OUT a),- __valueGQLOptions = typeOptions (Proxy @a) defaultTypeOptions, __valueGetType = __typeData . kinded (Proxy @OUT) } :: DeriveValueOptions OUT (ChannelConstraint e) (ChannelRes e)@@ -153,8 +153,3 @@ instance ExploreChannels 'True e (Undefined m) where exploreChannels _ = pure HM.empty--convertNode :: DataType (ChannelRes e) -> [(FieldName, ChannelRes e)]-convertNode DataType {tyCons = ConsRep {consFields}} = map toChannels consFields- where- toChannels FieldRep {fieldSelector, fieldValue} = (fieldSelector, fieldValue)
src/Data/Morpheus/Server/Deriving/Decode.hs view
@@ -49,14 +49,10 @@ ) import Data.Morpheus.Server.Types.GQLType ( GQLType- ( KIND,- typeOptions+ ( KIND ), deriveTypename, )-import Data.Morpheus.Server.Types.Internal- ( defaultTypeOptions,- ) import Data.Morpheus.Server.Types.Kind ( CUSTOM, DerivingKind,@@ -122,8 +118,7 @@ where context = Context- { options = typeOptions proxy defaultTypeOptions,- isVariantRef = False,+ { isVariantRef = False, typeName = deriveTypename (KindedProxy :: KindedProxy IN a), enumVisitor = visitEnumName proxy, fieldVisitor = visitFieldName proxy@@ -206,11 +201,11 @@ instance (Selector s, GQLType a, Decode a) => DecodeFields (M1 S s (K1 i a)) where decodeFields index value = M1 . K1 <$> do- Context {options, isVariantRef, fieldVisitor} <- ask+ Context {isVariantRef, fieldVisitor} <- ask if isVariantRef then lift (decode value) else- let fieldName = fieldVisitor $ getFieldName (selNameProxy options (Proxy @s)) index+ let fieldName = fieldVisitor $ getFieldName (selNameProxy (Proxy @s)) index fieldDecoder = decodeFieldWith (lift . decode) fieldName in withInputObject fieldDecoder value
src/Data/Morpheus/Server/Deriving/Encode.hs view
@@ -62,13 +62,12 @@ ( RootResolver (..), ) import Data.Morpheus.Server.Types.GQLType- ( GQLType (typeOptions),+ ( GQLType, KIND, deriveTypename, __isEmptyType, __typeData, )-import Data.Morpheus.Server.Types.Internal (defaultTypeOptions) import Data.Morpheus.Server.Types.Kind ( CUSTOM, DerivingKind,@@ -212,7 +211,6 @@ ( DeriveValueOptions { __valueApply = encode, __valueTypeName = deriveTypename (KindedProxy :: KindedProxy IN a),- __valueGQLOptions = typeOptions (Proxy @a) defaultTypeOptions, __valueGetType = __typeData . kinded (Proxy @IN) } :: DeriveValueOptions IN (ExplorerConstraint m) (m (ResolverValue m))
src/Data/Morpheus/Server/Deriving/Named/EncodeValue.hs view
@@ -60,9 +60,8 @@ ( NamedResolverT (..), ResolveNamed (..), )-import Data.Morpheus.Server.Types (defaultTypeOptions) import Data.Morpheus.Server.Types.GQLType- ( GQLType (typeOptions, __type),+ ( GQLType (__type), KIND, deriveTypename, __typeData,@@ -166,7 +165,6 @@ ( DeriveValueOptions { __valueApply = encodeField, __valueTypeName = deriveTypename (KindedProxy :: KindedProxy OUT a),- __valueGQLOptions = typeOptions (Proxy @a) defaultTypeOptions, __valueGetType = __typeData . kinded (Proxy @OUT) } :: DeriveValueOptions OUT (GValueMapConstraint m) (m (ResolverValue m))
src/Data/Morpheus/Server/Deriving/Schema.hs view
@@ -61,7 +61,7 @@ __isEmptyType, __typeData, )-import Data.Morpheus.Server.Types.Internal (TypeData (..), defaultTypeOptions)+import Data.Morpheus.Server.Types.Internal (TypeData (..)) import Data.Morpheus.Server.Types.Kind ( CUSTOM, DerivingKind,@@ -289,8 +289,7 @@ deriveTypeContent = deriveTypeContentWith ( DeriveTypeDefinitionOptions- { __typeGQLOptions = typeOptions (Proxy @a) defaultTypeOptions,- __typeGetType = __typeData . kinded (Proxy @kind),+ { __typeGetType = __typeData . kinded (Proxy @kind), __typeApply = deriveFieldContent } :: DeriveTypeOptions kind (DeriveWithConstraint kind) (TyContentM kind)
src/Data/Morpheus/Server/Deriving/Schema/Directive.hs view
@@ -31,7 +31,7 @@ import Control.Monad.Except (throwError) import qualified Data.HashMap.Lazy as HM import Data.Morpheus.Internal.Ext (resultOr, unsafeFromList)-import Data.Morpheus.Internal.Utils (Empty (..))+import Data.Morpheus.Internal.Utils (Empty (..), fromElems) import Data.Morpheus.Server.Deriving.Utils.Kinded ( KindedProxy (..), )@@ -51,17 +51,21 @@ applyFieldDescription, applyFieldName, applyTypeDescription,+ applyTypeEnumNames,+ applyTypeFieldNames, deriveFingerprint, deriveTypename, encodeArguments, )+import Data.Morpheus.Server.Types.Internal import Data.Morpheus.Server.Types.SchemaT ( SchemaT, insertDirectiveDefinition, outToAny, ) import Data.Morpheus.Types.Internal.AST- ( CONST,+ ( Argument (..),+ CONST, Description, Directive (..), DirectiveDefinition (..),@@ -101,9 +105,6 @@ where proxy = Proxy @a -deriveTypeDirectives :: forall c f a. GQLType a => f a -> SchemaT c (Directives CONST)-deriveTypeDirectives proxy = deriveDirectiveUsages (typeDirectives $ directives proxy)- deriveDirectiveUsages :: [DirectiveUsage] -> SchemaT c (Directives CONST) deriveDirectiveUsages = fmap unsafeFromList . traverse toDirectiveTuple @@ -114,7 +115,8 @@ toDirectiveTuple (DirectiveUsage x) = do insertDirective (deriveDirectiveDefinition x) x let directiveName = deriveDirectiveName (Identity x)- directiveArgs <- resultOr (const $ throwError "TODO: fix me") pure (encodeArguments x)+ args <- toList <$> resultOr (const $ throwError "TODO: fix me") pure (encodeArguments x)+ directiveArgs <- fromElems (map editArg args) pure ( directiveName, Directive@@ -123,6 +125,8 @@ directiveArgs } )+ where+ editArg Argument {..} = Argument {argumentName = applyGQLFieldOptions (Identity x) argumentName, ..} insertDirective :: forall a c.@@ -137,8 +141,8 @@ getDirHM :: (Ord k, Hashable k, Empty a) => k -> HashMap k a -> a getDirHM name xs = fromMaybe empty $ name `HM.lookup` xs -deriveFieldDirectives :: GQLType a => f a -> FieldName -> SchemaT c (Directives CONST)-deriveFieldDirectives proxy name = deriveDirectiveUsages $ getFieldDirectiveUsages name proxy+isIncluded :: DirectiveUsage -> Bool+isIncluded (DirectiveUsage x) = not $ excludeFromSchema (Identity x) getEnumDirectiveUsages :: GQLType a => f a -> TypeName -> [DirectiveUsage] getEnumDirectiveUsages proxy name = getDirHM name $ enumValueDirectives $ directives proxy@@ -146,23 +150,43 @@ getFieldDirectiveUsages :: GQLType a => FieldName -> f a -> [DirectiveUsage] getFieldDirectiveUsages name proxy = getDirHM name $ fieldDirectives $ directives proxy +getOptions :: GQLType a => f a -> GQLTypeOptions+getOptions proxy = typeOptions proxy defaultTypeOptions++-- derive directives deriveEnumDirectives :: GQLType a => f a -> TypeName -> SchemaT c (Directives CONST)-deriveEnumDirectives proxy name = deriveDirectiveUsages $ getEnumDirectiveUsages proxy name+deriveEnumDirectives proxy name = deriveDirectiveUsages $ filter isIncluded $ getEnumDirectiveUsages proxy name +deriveFieldDirectives :: GQLType a => f a -> FieldName -> SchemaT c (Directives CONST)+deriveFieldDirectives proxy name = deriveDirectiveUsages $ filter isIncluded $ getFieldDirectiveUsages name proxy++deriveTypeDirectives :: forall c f a. GQLType a => f a -> SchemaT c (Directives CONST)+deriveTypeDirectives proxy = deriveDirectiveUsages $ filter isIncluded $ typeDirectives $ directives proxy++-- visit visitEnumValueDescription :: GQLType a => f a -> TypeName -> Maybe Description -> Maybe Description visitEnumValueDescription proxy name desc = foldr applyEnumDescription desc (getEnumDirectiveUsages proxy name) visitEnumName :: GQLType a => f a -> TypeName -> TypeName-visitEnumName proxy name = foldr applyEnumName name (getEnumDirectiveUsages proxy name)+visitEnumName proxy name = foldr applyEnumName (withTypeDirectives $ withOptions name) (getEnumDirectiveUsages proxy name)+ where+ withOptions = fromString . constructorTagModifier (getOptions proxy) . toString+ withTypeDirectives dirName = foldr applyTypeEnumNames dirName (typeDirectives $ directives proxy) visitFieldDescription :: GQLType a => f a -> FieldName -> Maybe Description -> Maybe Description visitFieldDescription proxy name desc = foldr applyFieldDescription desc (getFieldDirectiveUsages name proxy) +applyGQLFieldOptions :: (GQLType a) => f a -> FieldName -> FieldName+applyGQLFieldOptions proxy = withTypeDirectives . withOptions+ where+ withOptions = fromString . fieldLabelModifier (getOptions proxy) . toString+ withTypeDirectives name = foldr applyTypeFieldNames name (typeDirectives $ directives proxy)+ visitFieldName :: GQLType a => f a -> FieldName -> FieldName-visitFieldName proxy name = foldr applyFieldName name (getFieldDirectiveUsages name proxy)+visitFieldName proxy name = foldr applyFieldName (applyGQLFieldOptions proxy name) (getFieldDirectiveUsages name proxy) visitTypeDescription :: GQLType a => f a -> Maybe Description -> Maybe Description visitTypeDescription proxy desc = foldr applyTypeDescription desc (typeDirectives $ directives proxy) -toFieldRes :: GQLType a => f a -> FieldRep (m v) -> (FieldName, m v)+toFieldRes :: GQLType a => f a -> FieldRep v -> (FieldName, v) toFieldRes proxy FieldRep {..} = (visitFieldName proxy fieldSelector, fieldValue)
src/Data/Morpheus/Server/Deriving/Utils/Decode.hs view
@@ -37,7 +37,6 @@ ( GQLType, deriveTypename, )-import Data.Morpheus.Server.Types.Internal import Data.Morpheus.Types.GQLScalar ( toScalar, )@@ -133,7 +132,6 @@ data Context = Context { isVariantRef :: Bool, typeName :: TypeName,- options :: GQLTypeOptions, enumVisitor :: TypeName -> TypeName, fieldVisitor :: FieldName -> FieldName }@@ -153,14 +151,14 @@ tags _ = tags (Proxy @a) <> tags (Proxy @b) instance (Constructor c, DescribeFields a) => DescribeCons (M1 C c a) where- tags _ Context {typeName, options} = getTag (refType (Proxy @a))+ tags _ Context {typeName} = getTag (refType (Proxy @a)) where getTag (Just memberRef) | isUnionRef memberRef = Info {kind = VariantRef, tagName = [memberRef]} | otherwise = Info {kind = InlineVariant, tagName = [consName]} getTag Nothing = Info {kind = InlineVariant, tagName = [consName]} --------- consName = conNameProxy options (Proxy @c)+ consName = conNameProxy (Proxy @c) ---------- isUnionRef x = typeName <> x == consName
src/Data/Morpheus/Server/Deriving/Utils/DeriveGType.hs view
@@ -32,8 +32,7 @@ ) import Data.Morpheus.Server.Deriving.Utils.Types import Data.Morpheus.Server.Types.Internal- ( GQLTypeOptions (..),- TypeData (..),+ ( TypeData (..), ) import Data.Morpheus.Types.Internal.AST ( TypeName,@@ -59,14 +58,12 @@ data DeriveValueOptions kind c v = DeriveValueOptions { __valueTypeName :: TypeName,- __valueGQLOptions :: GQLTypeOptions, __valueApply :: forall a. c a => a -> v, __valueGetType :: forall f a. c a => f a -> TypeData } data DeriveTypeOptions kind c v = DeriveTypeDefinitionOptions- { __typeGQLOptions :: GQLTypeOptions,- __typeApply :: forall f a. c a => f a -> v,+ { __typeApply :: forall f a. c a => f a -> v, __typeGetType :: forall f a. c a => f a -> TypeData } @@ -105,22 +102,18 @@ DataType { dataTypeName = "", tyIsUnion = False,- tyCons = deriveConsRep (__valueGQLOptions options) (Proxy @c) (toFieldRep options src)+ tyCons = deriveConsRep (Proxy @c) (toFieldRep options src) }- deriveTypeDefinition options _ = [deriveConsRep (__typeGQLOptions options) (Proxy @c) (conRep options (Proxy @f))]+ deriveTypeDefinition options _ = [deriveConsRep (Proxy @c) (conRep options (Proxy @f))] deriveConsRep :: Constructor (c :: Meta) =>- GQLTypeOptions -> f c -> [FieldRep v] -> ConsRep v-deriveConsRep opt proxy fields =- ConsRep- { consName = conNameProxy opt proxy,- consFields- }+deriveConsRep proxy fields = ConsRep {..} where+ consName = conNameProxy proxy consFields | isRecordProxy proxy = fields | otherwise = enumerate fields@@ -136,7 +129,7 @@ instance (Selector s, c a) => DeriveFieldRep c v (M1 S s (Rec0 a)) where toFieldRep DeriveValueOptions {..} (M1 (K1 src)) = [ FieldRep- { fieldSelector = selNameProxy __valueGQLOptions (Proxy @s),+ { fieldSelector = selNameProxy (Proxy @s), fieldTypeRef = TypeRef gqlTypeName gqlWrappers, fieldValue = __valueApply src }@@ -145,7 +138,7 @@ TypeData {gqlTypeName, gqlWrappers} = __valueGetType (Proxy @a) conRep DeriveTypeDefinitionOptions {..} _ = [ FieldRep- { fieldSelector = selNameProxy __typeGQLOptions (Proxy @s),+ { fieldSelector = selNameProxy (Proxy @s), fieldTypeRef = TypeRef gqlTypeName gqlWrappers, fieldValue = __typeApply (Proxy @a) }
src/Data/Morpheus/Server/Deriving/Utils/Proxy.hs view
@@ -17,18 +17,12 @@ ) where -import Data.Morpheus.Server.Types.Internal- ( GQLTypeOptions (..),- ) import Data.Morpheus.Server.Types.Kind (DerivingKind) import Data.Morpheus.Types.Internal.AST ( FieldName, TypeName, packName, )-import Data.Text- ( pack,- ) import qualified Data.Text as T import GHC.Generics ( C,@@ -46,15 +40,11 @@ import Relude hiding (undefined) import Prelude (undefined) -conNameProxy :: forall f (c :: Meta). Constructor c => GQLTypeOptions -> f c -> TypeName-conNameProxy options _ =- packName $ pack $ constructorTagModifier options $ conName (undefined :: M1 C c U1 a)+conNameProxy :: forall f (c :: Meta). Constructor c => f c -> TypeName+conNameProxy _ = fromString $ conName (undefined :: M1 C c U1 a) -selNameProxy :: forall f (s :: Meta). Selector s => GQLTypeOptions -> f s -> FieldName-selNameProxy options _ =- fromHaskellName $- fieldLabelModifier options $- selName (undefined :: M1 S s f a)+selNameProxy :: forall f (s :: Meta). Selector s => f s -> FieldName+selNameProxy _ = fromHaskellName $ selName (undefined :: M1 S s f a) fromHaskellName :: String -> FieldName fromHaskellName hsName
src/Data/Morpheus/Server/Types.hs view
@@ -76,6 +76,8 @@ RootResolver (..), defaultRootResolver, Rename (..),+ InputTypeNamespace (..),+ DropNamespace (..), ) where @@ -102,12 +104,14 @@ import Data.Morpheus.Server.Types.DirectiveDefinitions ( Deprecated (..), Describe (..),+ DropNamespace (..), Prefixes (..), Rename (..), ) import Data.Morpheus.Server.Types.Directives (GQLDirective (..)) import Data.Morpheus.Server.Types.GQLType ( GQLType (..),+ InputTypeNamespace (..), enumDirective, enumDirective', fieldDirective,
src/Data/Morpheus/Server/Types/DirectiveDefinitions.hs view
@@ -12,12 +12,17 @@ Deprecated (..), Describe (..), Rename (..),+ DropNamespace (..), ) where import Data.Morpheus.Server.Types.Directives (GQLDirective (..)) import Data.Morpheus.Server.Types.GQLType (GQLType (__type))-import Data.Morpheus.Server.Types.Internal (mkTypeData)+import Data.Morpheus.Server.Types.Internal+ ( mkTypeData,+ stripConstructorNamespace,+ stripFieldNamespace,+ ) import Data.Morpheus.Server.Types.Visitors ( VisitEnum (..), VisitField (..),@@ -26,8 +31,8 @@ import Data.Morpheus.Types.Internal.AST ( DirectiveLocation (..), )-import qualified Data.Text as T-import Relude+import Data.Text (drop, length, pack, unpack)+import Relude hiding (drop, length) -- | a custom GraphQL directive for adding or removing -- of prefixes@@ -49,7 +54,7 @@ ] instance VisitType Prefixes where- visitTypeName Prefixes {addPrefix, removePrefix} name = addPrefix <> T.drop (T.length removePrefix) name+ visitTypeName Prefixes {addPrefix, removePrefix} _ name = addPrefix <> drop (length removePrefix) name visitTypeDescription _ = id -- native GraphQL directive @deprecated@@ -107,9 +112,14 @@ -- | a custom GraphQL directive for adding or removing -- of prefixes-newtype Rename = Rename {name :: Text} deriving (Generic, GQLType)+newtype Rename = Rename {newName :: Text}+ deriving+ ( Generic,+ GQLType+ ) instance GQLDirective Rename where+ excludeFromSchema _ = True type DIRECTIVE_LOCATIONS Rename = '[ 'OBJECT,@@ -124,11 +134,36 @@ ] instance VisitType Rename where- visitTypeName Rename {name} _ = name+ visitTypeName Rename {newName} _ _ = newName visitTypeDescription _ = id instance VisitEnum Rename where- visitEnumName Rename {name} _ = name+ visitEnumName Rename {newName} _ = newName instance VisitField Rename where- visitFieldName Rename {name} _ = name+ visitFieldName Rename {newName} _ = newName++-- DropTypeNamespace+newtype DropNamespace = DropNamespace+ { dropNamespace :: Text+ }+ deriving+ ( Generic,+ GQLType+ )++instance GQLDirective DropNamespace where+ type+ DIRECTIVE_LOCATIONS DropNamespace =+ '[ 'OBJECT,+ 'ENUM,+ 'INPUT_OBJECT,+ 'UNION,+ 'SCALAR,+ 'INTERFACE+ ]+ excludeFromSchema _ = True++instance VisitType DropNamespace where+ visitFieldNames DropNamespace {dropNamespace} = pack . stripFieldNamespace dropNamespace . unpack+ visitEnumNames DropNamespace {dropNamespace} = pack . stripConstructorNamespace dropNamespace . unpack
src/Data/Morpheus/Server/Types/Directives.hs view
@@ -17,12 +17,14 @@ ToLocations (..), getLocations, -- visitors- visitTypeName,- visitTypeDescription,- visitFieldName,- visitFieldDescription,- visitEnumName,- visitEnumDescription,+ visitTypeName',+ visitTypeDescription',+ visitFieldName',+ visitFieldDescription',+ visitEnumName',+ visitEnumDescription',+ visitFieldNames',+ visitEnumNames', ) where @@ -126,34 +128,48 @@ GQLDirective a where type DIRECTIVE_LOCATIONS a :: [DirectiveLocation]+ excludeFromSchema :: f a -> Bool+ excludeFromSchema _ = False -- TYPE VISITORS -visitTypeName :: forall a. GQLDirective a => a -> TypeName -> TypeName-visitTypeName = __visitTypeName (Proxy :: Proxy (ALLOWED a TYPE_VISITOR_KIND))+visitTypeName' :: forall a. GQLDirective a => a -> Bool -> TypeName -> TypeName+visitTypeName' = __visitTypeName (Proxy :: Proxy (ALLOWED a TYPE_VISITOR_KIND)) -visitTypeDescription :: forall a. GQLDirective a => a -> Maybe Description -> Maybe Description-visitTypeDescription = __visitTypeDescription (Proxy :: Proxy (ALLOWED a TYPE_VISITOR_KIND))+visitTypeDescription' :: forall a. GQLDirective a => a -> Maybe Description -> Maybe Description+visitTypeDescription' = __visitTypeDescription (Proxy :: Proxy (ALLOWED a TYPE_VISITOR_KIND)) +visitFieldNames' :: forall a. GQLDirective a => a -> FieldName -> FieldName+visitFieldNames' = __visitFieldNames (Proxy :: Proxy (ALLOWED a TYPE_VISITOR_KIND))++visitEnumNames' :: forall a. GQLDirective a => a -> TypeName -> TypeName+visitEnumNames' = __visitEnumNames (Proxy :: Proxy (ALLOWED a TYPE_VISITOR_KIND))+ class VISIT_TYPE a (t :: Bool) where- __visitTypeName :: f t -> a -> TypeName -> TypeName+ __visitTypeName :: f t -> a -> Bool -> TypeName -> TypeName __visitTypeDescription :: f t -> a -> Maybe Description -> Maybe Description+ __visitFieldNames :: f t -> a -> FieldName -> FieldName+ __visitEnumNames :: f t -> a -> TypeName -> TypeName instance VISIT_TYPE a 'False where- __visitTypeName _ _ = id+ __visitTypeName _ _ _ = id __visitTypeDescription _ _ = id+ __visitFieldNames _ _ = id+ __visitEnumNames _ _ = id instance Visitors.VisitType a => VISIT_TYPE a TRUE where- __visitTypeName _ x name = packName $ Visitors.visitTypeName x (unpackName name)+ __visitTypeName _ x isInput name = packName $ Visitors.visitTypeName x isInput (unpackName name) __visitTypeDescription _ = Visitors.visitTypeDescription+ __visitFieldNames _ x = packName . Visitors.visitFieldNames x . unpackName+ __visitEnumNames _ x = packName . Visitors.visitEnumNames x . unpackName -- FIELD VISITORS -visitFieldName :: forall a. GQLDirective a => a -> FieldName -> FieldName-visitFieldName = __visitFieldName (Proxy :: Proxy (ALLOWED a FIELD_VISITOR_KIND))+visitFieldName' :: forall a. GQLDirective a => a -> FieldName -> FieldName+visitFieldName' = __visitFieldName (Proxy :: Proxy (ALLOWED a FIELD_VISITOR_KIND)) -visitFieldDescription :: forall a. GQLDirective a => a -> Maybe Description -> Maybe Description-visitFieldDescription = __visitFieldDescription (Proxy :: Proxy (ALLOWED a FIELD_VISITOR_KIND))+visitFieldDescription' :: forall a. GQLDirective a => a -> Maybe Description -> Maybe Description+visitFieldDescription' = __visitFieldDescription (Proxy :: Proxy (ALLOWED a FIELD_VISITOR_KIND)) class VISIT_FIELD a (t :: Bool) where __visitFieldName :: f t -> a -> FieldName -> FieldName@@ -169,11 +185,11 @@ -- VISIT_ENUM -visitEnumName :: forall a. GQLDirective a => a -> TypeName -> TypeName-visitEnumName = __visitEnumName (Proxy :: Proxy (ALLOWED a ENUM_VISITOR_KIND))+visitEnumName' :: forall a. GQLDirective a => a -> TypeName -> TypeName+visitEnumName' = __visitEnumName (Proxy :: Proxy (ALLOWED a ENUM_VISITOR_KIND)) -visitEnumDescription :: forall a. GQLDirective a => a -> Maybe Description -> Maybe Description-visitEnumDescription = __visitEnumDescription (Proxy :: Proxy (ALLOWED a ENUM_VISITOR_KIND))+visitEnumDescription' :: forall a. GQLDirective a => a -> Maybe Description -> Maybe Description+visitEnumDescription' = __visitEnumDescription (Proxy :: Proxy (ALLOWED a ENUM_VISITOR_KIND)) class VISIT_ENUM a (t :: Bool) where __visitEnumName :: f t -> a -> TypeName -> TypeName
src/Data/Morpheus/Server/Types/GQLType.hs view
@@ -1,6 +1,9 @@ {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DefaultSignatures #-}+{-# LANGUAGE DeriveAnyClass #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-}@@ -44,7 +47,10 @@ applyEnumDescription, applyFieldName, applyFieldDescription,+ applyTypeFieldNames,+ applyTypeEnumNames, __isEmptyType,+ InputTypeNamespace (..), ) where @@ -66,23 +72,24 @@ import Data.Morpheus.Server.Types.Directives ( GQLDirective (..), ToLocations,- visitEnumDescription,- visitEnumName,- visitFieldDescription,- visitFieldName,- visitTypeDescription,- visitTypeName,+ visitEnumDescription',+ visitEnumName',+ visitEnumNames',+ visitFieldDescription',+ visitFieldName',+ visitFieldNames',+ visitTypeDescription',+ visitTypeName', ) import Data.Morpheus.Server.Types.Internal ( GQLTypeOptions (..), TypeData (..), defaultTypeOptions, mkTypeData,- prefixInputs, ) import Data.Morpheus.Server.Types.Kind ( CUSTOM,- DerivingKind (..),+ DerivingKind, SCALAR, TYPE, WRAPPER,@@ -96,6 +103,7 @@ Undefined (..), __typenameUndefined, )+import Data.Morpheus.Server.Types.Visitors (VisitType (..)) import Data.Morpheus.Types.GQLScalar (EncodeScalar (..)) import Data.Morpheus.Types.GQLWrapper (EncodeWrapperValue (..)) import Data.Morpheus.Types.ID (ID)@@ -105,6 +113,7 @@ ArgumentsDefinition, CONST, Description,+ DirectiveLocation (..), Directives, FieldName, IN,@@ -148,15 +157,23 @@ deriveFingerprint :: (GQLType a, CategoryValue kind) => kinded kind a -> TypeFingerprint deriveFingerprint proxy = gqlFingerprint $ __typeData proxy -deriveTypeData :: Typeable a => f a -> (Bool -> String -> String) -> TypeCategory -> TypeData-deriveTypeData proxy typeNameModifier cat =+deriveTypeData ::+ Typeable a =>+ f a ->+ DirectiveUsages ->+ (Bool -> String -> String) ->+ TypeCategory -> TypeData- { gqlTypeName = packName . pack $ typeNameModifier (cat == IN) originalTypeName,+deriveTypeData proxy DirectiveUsages {typeDirectives} typeNameModifier cat =+ TypeData+ { gqlTypeName = modifyName . packName . pack $ typeNameModifier isInput originalTypeName, gqlWrappers = mkBaseType, gqlFingerprint = getFingerprint cat proxy } where+ isInput = cat == IN originalTypeName = unpack . unpackName $ getTypename proxy+ modifyName name = typeNameWithDirectives isInput name typeDirectives list :: TypeWrapper -> TypeWrapper list = flip TypeList True@@ -184,6 +201,8 @@ {-# DEPRECATED getDescriptions "use: directive Describe { text } with fieldDirective" #-} +{-# DEPRECATED typeOptions "use: custom directives with 'VisitType'" #-}+ class GQLType a where type KIND a :: DerivingKind type KIND a = TYPE@@ -214,9 +233,8 @@ __type :: f a -> TypeCategory -> TypeData default __type :: Typeable a => f a -> TypeCategory -> TypeData- __type proxy category = editTypeData derivedType (directives proxy)+ __type proxy = deriveTypeData proxy (directives proxy) typeNameModifier where- derivedType = deriveTypeData proxy typeNameModifier category GQLTypeOptions {typeNameModifier} = typeOptions proxy defaultTypeOptions instance GQLType Int where@@ -279,8 +297,8 @@ type KIND (SubscriptionField a) = WRAPPER __type _ = __type $ Proxy @a -instance (Typeable a, Typeable b, GQLType a, GQLType b) => GQLType (Pair a b) where- typeOptions _ = prefixInputs+instance (Typeable a, Typeable b, GQLType a, GQLType b, DeriveArguments TYPE InputTypeNamespace) => GQLType (Pair a b) where+ directives _ = typeDirective InputTypeNamespace {inputTypeNamespace = "Input"} -- Manual @@ -288,7 +306,7 @@ type KIND (a -> b) = CUSTOM __type _ = __type $ Proxy @b -instance (GQLType k, GQLType v, Typeable k, Typeable v) => GQLType (Map k v) where+instance (GQLType k, GQLType v, Typeable k, Typeable v, DeriveArguments TYPE InputTypeNamespace) => GQLType (Map k v) where type KIND (Map k v) = CUSTOM __type _ = __type $ Proxy @[Pair k v] @@ -296,9 +314,9 @@ type KIND (Resolver o e m a) = CUSTOM __type _ = __type $ Proxy @a -instance (Typeable a, Typeable b, GQLType a, GQLType b) => GQLType (a, b) where+instance (Typeable a, Typeable b, GQLType a, GQLType b, DeriveArguments TYPE InputTypeNamespace) => GQLType (a, b) where __type _ = __type $ Proxy @(Pair a b)- typeOptions _ = prefixInputs+ directives _ = typeDirective InputTypeNamespace {inputTypeNamespace = "Input"} instance (GQLType value) => GQLType (Arg name value) where type KIND (Arg name value) = CUSTOM@@ -372,7 +390,6 @@ ( DeriveValueOptions { __valueApply = encode, __valueTypeName = deriveTypename (KindedProxy :: KindedProxy IN a),- __valueGQLOptions = typeOptions (Proxy @a) defaultTypeOptions, __valueGetType = __typeData . kinded (Proxy @IN) } :: DeriveValueOptions IN ExplorerConstraint (GQLResult (Value CONST))@@ -431,26 +448,52 @@ data DirectiveUsage where DirectiveUsage :: (GQLDirective a, GQLType a, Decode a, DeriveArguments (KIND a) a, ToLocations (DIRECTIVE_LOCATIONS a)) => a -> DirectiveUsage -applyTypeName :: DirectiveUsage -> TypeName -> TypeName-applyTypeName (DirectiveUsage x) = visitTypeName x+applyTypeName :: DirectiveUsage -> Bool -> TypeName -> TypeName+applyTypeName (DirectiveUsage x) = visitTypeName' x -typeNameWithDirectives :: TypeName -> [DirectiveUsage] -> TypeName-typeNameWithDirectives = foldr applyTypeName+typeNameWithDirectives :: Bool -> TypeName -> [DirectiveUsage] -> TypeName+typeNameWithDirectives x = foldr (`applyTypeName` x) +applyTypeFieldNames :: DirectiveUsage -> FieldName -> FieldName+applyTypeFieldNames (DirectiveUsage x) = visitFieldNames' x++applyTypeEnumNames :: DirectiveUsage -> TypeName -> TypeName+applyTypeEnumNames (DirectiveUsage x) = visitEnumNames' x+ applyEnumDescription :: DirectiveUsage -> Maybe Description -> Maybe Description-applyEnumDescription (DirectiveUsage x) = visitEnumDescription x+applyEnumDescription (DirectiveUsage x) = visitEnumDescription' x applyEnumName :: DirectiveUsage -> TypeName -> TypeName-applyEnumName (DirectiveUsage x) = visitEnumName x+applyEnumName (DirectiveUsage x) = visitEnumName' x applyFieldDescription :: DirectiveUsage -> Maybe Description -> Maybe Description-applyFieldDescription (DirectiveUsage x) = visitFieldDescription x+applyFieldDescription (DirectiveUsage x) = visitFieldDescription' x applyFieldName :: DirectiveUsage -> FieldName -> FieldName-applyFieldName (DirectiveUsage x) = visitFieldName x+applyFieldName (DirectiveUsage x) = visitFieldName' x applyTypeDescription :: DirectiveUsage -> Maybe Description -> Maybe Description-applyTypeDescription (DirectiveUsage x) = visitTypeDescription x+applyTypeDescription (DirectiveUsage x) = visitTypeDescription' x -editTypeData :: TypeData -> DirectiveUsages -> TypeData-editTypeData TypeData {..} DirectiveUsages {typeDirectives} = TypeData {gqlTypeName = typeNameWithDirectives gqlTypeName typeDirectives, ..}+newtype InputTypeNamespace = InputTypeNamespace {inputTypeNamespace :: Text}+ deriving+ ( Generic,+ GQLType+ )++instance GQLDirective InputTypeNamespace where+ excludeFromSchema _ = True+ type+ DIRECTIVE_LOCATIONS InputTypeNamespace =+ '[ 'OBJECT,+ 'ENUM,+ 'INPUT_OBJECT,+ 'UNION,+ 'SCALAR,+ 'INTERFACE+ ]++instance VisitType InputTypeNamespace where+ visitTypeName InputTypeNamespace {inputTypeNamespace} isInput name+ | isInput = inputTypeNamespace <> name+ | otherwise = name
src/Data/Morpheus/Server/Types/Internal.hs view
@@ -8,6 +8,8 @@ prefixInputs, mkTypeData, dropNamespaceOptions,+ stripConstructorNamespace,+ stripFieldNamespace, ) where @@ -21,8 +23,8 @@ TypeWrapper (..), mkBaseType, )-import qualified Data.Text as T-import Relude hiding (Seq, Undefined, intercalate)+import Data.Text (length)+import Relude hiding (Seq, Undefined, intercalate, length) data TypeData = TypeData { gqlTypeName :: TypeName,@@ -31,6 +33,8 @@ } deriving (Show) +{-# DEPRECATED GQLTypeOptions "use: custom directives with 'VisitType'" #-}+ -- | Options that specify how to map GraphQL field, type, and constructor names -- to and from their Haskell equivalent. --@@ -47,6 +51,8 @@ typeNameModifier :: Bool -> String -> String } +{-# DEPRECATED defaultTypeOptions "use: custom directives with 'VisitType'" #-}+ -- | Default encoding 'GQLTypeOptions': -- -- @@@ -65,6 +71,7 @@ typeNameModifier = const id } +{-# DEPRECATED prefixInputs "use: custom directives" #-} prefixInputs :: GQLTypeOptions -> GQLTypeOptions prefixInputs options = options {typeNameModifier = \isInput name -> if isInput then "Input" <> name else name} @@ -77,7 +84,7 @@ } dropPrefix :: Text -> String -> String-dropPrefix name = drop (T.length name)+dropPrefix name = drop (length name) stripConstructorNamespace :: Text -> String -> String stripConstructorNamespace = dropPrefix@@ -88,6 +95,7 @@ __uncapitalize [] = [] __uncapitalize (x : xs) = toLower x : xs +{-# DEPRECATED dropNamespaceOptions "use: custom directives" #-} dropNamespaceOptions :: TypeKind -> Text -> GQLTypeOptions -> GQLTypeOptions dropNamespaceOptions KindInterface tName opt = opt
src/Data/Morpheus/Server/Types/SchemaT.hs view
@@ -146,7 +146,7 @@ <> msg typename <> " was used as both input and output type, which is not allowed by GraphQL specifications." <> "\n\n "- <> "If you supply \"typeNameModifier\" in \"GQLType.typeOptions\", "+ <> "If you use \"InputTypeNamespace\" directive, " <> "you can override the default type names for " <> msg typename <> " to solve this problem."
src/Data/Morpheus/Server/Types/Visitors.hs view
@@ -19,11 +19,23 @@ import Relude class VisitType a where- visitTypeName :: a -> Text -> Text- visitTypeName _ = id+ -- | Construct a new type name depending on whether it is an input,+ -- and being given the original type name.+ visitTypeName :: a -> Bool -> Text -> Text+ visitTypeName _ _ = id visitTypeDescription :: a -> Maybe Text -> Maybe Text visitTypeDescription = const id++ -- | Function applied to field labels.+ -- Handy for removing common record prefixes for example.+ visitFieldNames :: a -> Text -> Text+ visitFieldNames _ = id++ -- | Function applied to enum values+ -- Handy for removing common enum prefixes for example.+ visitEnumNames :: a -> Text -> Text+ visitEnumNames _ = id class VisitField a where visitFieldName :: a -> Text -> Text
test/Feature/Collision/CategoryCollisionSuccess.hs view
@@ -15,10 +15,11 @@ ( GQLRequest, GQLResponse, GQLType (..),- GQLTypeOptions (..),+ InputTypeNamespace (..), RootResolver (..), Undefined, defaultRootResolver,+ typeDirective, ) import Data.Text ( Text,@@ -31,22 +32,26 @@ } deriving (Show, Generic) -nonClashingTypeNameModifier :: Bool -> String -> String-nonClashingTypeNameModifier True original = "Input" ++ original-nonClashingTypeNameModifier False original = original- instance GQLType Deity where- typeOptions _ opt = opt {typeNameModifier = nonClashingTypeNameModifier}+ directives _ =+ typeDirective InputTypeNamespace {inputTypeNamespace = "Input"} newtype DeityArgs = DeityArgs { input :: Deity }- deriving (Show, Generic, GQLType)+ deriving+ ( Show,+ Generic,+ GQLType+ ) newtype Query (m :: Type -> Type) = Query { deity :: DeityArgs -> m Deity }- deriving (Generic, GQLType)+ deriving+ ( Generic,+ GQLType+ ) rootResolver :: RootResolver IO () Query Undefined Undefined rootResolver =
test/Feature/Collision/category-collision-fail/response.json view
@@ -1,7 +1,7 @@ { "errors": [ {- "message": "It appears that the Haskell type \"Deity\" was used as both input and output type, which is not allowed by GraphQL specifications.\n\n If you supply \"typeNameModifier\" in \"GQLType.typeOptions\", you can override the default type names for \"Deity\" to solve this problem."+ "message": "It appears that the Haskell type \"Deity\" was used as both input and output type, which is not allowed by GraphQL specifications.\n\n If you use \"InputTypeNamespace\" directive, you can override the default type names for \"Deity\" to solve this problem." } ] }
test/Feature/Directive/Definition.hs view
@@ -51,7 +51,7 @@ type DIRECTIVE_LOCATIONS Power = '[ 'OBJECT] instance VisitType Power where- visitTypeName _ = id+ visitTypeName _ _ = id instance GQLType MythologyDeity where directives _ =
test/Feature/Directive/EnumVisitor.hs view
@@ -42,11 +42,11 @@ enumDirective' 'Sparta Describe {text = "city of warriors"} <> enumDirective' 'Delphi Describe {text = "city of oracle"} <> enumDirective' 'ARgos Describe {text = "city of argonauts"}- <> enumDirective' 'Sparta Rename {name = "sparta"}- <> enumDirective' 'Delphi Rename {name = "delphi"}- <> enumDirective' 'Athens Rename {name = "_athens"}- <> enumDirective' 'CORINTH__UGLY_ENUM_NAME Rename {name = "corinth"}- <> enumDirective' 'ARgos Rename {name = "argos"}+ <> enumDirective' 'Sparta Rename {newName = "sparta"}+ <> enumDirective' 'Delphi Rename {newName = "delphi"}+ <> enumDirective' 'Athens Rename {newName = "_athens"}+ <> enumDirective' 'CORINTH__UGLY_ENUM_NAME Rename {newName = "corinth"}+ <> enumDirective' 'ARgos Rename {newName = "argos"} data Query (m :: Type -> Type) = Query { cities :: [City],
test/Feature/Directive/FieldVisitor.hs view
@@ -19,12 +19,13 @@ GQLRequest, GQLResponse, GQLType (..),- GQLTypeOptions (..),+ InputTypeNamespace (..), Rename (..), RootResolver (..), Undefined, defaultRootResolver, fieldDirective',+ typeDirective, ) import Data.Text (Text, pack) import GHC.Generics (Generic)@@ -36,13 +37,12 @@ deriving (Generic, Show) instance GQLType Deity where- typeOptions _ options = options {typeNameModifier = \isInput n -> if isInput then "Input" <> n else n}- directives _ =- fieldDirective' '__name Describe {text = "name of the deity"}+ typeDirective (InputTypeNamespace "Input")+ <> fieldDirective' '__name Describe {text = "name of the deity"} <> fieldDirective' '__power Describe {text = "extraterrestrial ability"}- <> fieldDirective' '__name Rename {name = "name"}- <> fieldDirective' '__power Rename {name = "power"}+ <> fieldDirective' '__name Rename {newName = "name"}+ <> fieldDirective' '__power Rename {newName = "power"} data Query (m :: Type -> Type) = Query { deity :: Deity,
test/Feature/Input/Collections.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TypeFamilies #-} module Feature.Input.Collections@@ -17,10 +18,11 @@ GQLRequest, GQLResponse, GQLType (..),- GQLTypeOptions (..),+ InputTypeNamespace (..), RootResolver (..), Undefined, defaultRootResolver,+ typeDirective, ) import Data.Sequence (Seq) import Data.Set (Set)@@ -38,10 +40,7 @@ deriving (Generic) instance GQLType Product where- typeOptions _ options =- options- { typeNameModifier = \isInput name -> if isInput then "Input" <> name else name- }+ directives _ = typeDirective (InputTypeNamespace "Input") -- resolver data Query m = Query
test/Feature/Input/collections/assoc/invalid/response.json view
@@ -1,11 +1,15 @@ { "errors": [ {- "message": "Argument \"value\" got invalid value. Expected type \"[InputPairTextInt!]!\" found {}.",+ "message": "Argument \"value\" got invalid value. Undefined Field \"_0\".", "locations": [{ "line": 2, "column": 17 }] }, {- "message": "Argument \"value\" got invalid value. Expected type \"[InputPairTextInt!]!\" found 635.",+ "message": "Argument \"value\" got invalid value. Undefined Field \"_1\".",+ "locations": [{ "line": 2, "column": 17 }]+ },+ {+ "message": "Argument \"value\" got invalid value. Expected type \"InputPairTextInt!\" found 635.", "locations": [{ "line": 3, "column": 17 }] }, {
test/Feature/Input/collections/map/invalid/response.json view
@@ -1,11 +1,15 @@ { "errors": [ {- "message": "Argument \"value\" got invalid value. Expected type \"[InputPairTextInt!]!\" found {}.",+ "message": "Argument \"value\" got invalid value. Undefined Field \"_0\".", "locations": [{ "line": 2, "column": 15 }] }, {- "message": "Argument \"value\" got invalid value. Expected type \"[InputPairTextInt!]!\" found 635.",+ "message": "Argument \"value\" got invalid value. Undefined Field \"_1\".",+ "locations": [{ "line": 2, "column": 15 }]+ },+ {+ "message": "Argument \"value\" got invalid value. Expected type \"InputPairTextInt!\" found 635.", "locations": [{ "line": 3, "column": 15 }] }, {
test/Feature/Input/variables/invalidValue/invalidDefaultValue/response.json view
@@ -1,7 +1,7 @@ { "errors": [ {- "message": "Variable \"$v1\" got invalid value. Expected type \"[[[Int!]!]]!\" found { id: \"12\" }.",+ "message": "Variable \"$v1\" got invalid value. Expected type \"Int!\" found { id: \"12\" }.", "locations": [ { "line": 1,
test/Feature/Input/variables/invalidValue/invalidDefaultValueButVariableProvided/response.json view
@@ -1,7 +1,7 @@ { "errors": [ {- "message": "Variable \"$v1\" got invalid value. Expected type \"[Int!]!\" found \"boo\".",+ "message": "Variable \"$v1\" got invalid value. Expected type \"Int!\" found \"boo\".", "locations": [ { "line": 1,