From 27a5a0b44eb8568c53039f982c98cd07c3aef3c2 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Thu, 7 Nov 2024 18:18:12 +0100 Subject: [PATCH] Adjust wording according to the 2021 specification --- src/Language/GraphQL/Validate/Rules.hs | 8 ++--- tests/Language/GraphQL/Validate/RulesSpec.hs | 36 ++++++++++---------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/Language/GraphQL/Validate/Rules.hs b/src/Language/GraphQL/Validate/Rules.hs index 3fef94d..3d66125 100644 --- a/src/Language/GraphQL/Validate/Rules.hs +++ b/src/Language/GraphQL/Validate/Rules.hs @@ -856,8 +856,8 @@ knownArgumentNamesRule = ArgumentsRule fieldRule directiveRule , "\"." ] --- | GraphQL servers define what directives they support. For each usage of a --- directive, the directive must be available on that server. +-- | GraphQL services define what directives they support. For each usage of a +-- directive, the directive must be available on that service. knownDirectiveNamesRule :: Rule m knownDirectiveNamesRule = DirectivesRule $ const $ \directives' -> do definitions' <- asks $ Schema.directives . schema @@ -909,9 +909,9 @@ knownInputFieldNamesRule = ValueRule go constGo , "\"." ] --- | GraphQL servers define what directives they support and where they support +-- | GraphQL services define what directives they support and where they support -- them. For each usage of a directive, the directive must be used in a location --- that the server has declared support for. +-- that the service has declared support for. directivesInValidLocationsRule :: Rule m directivesInValidLocationsRule = DirectivesRule directivesRule where diff --git a/tests/Language/GraphQL/Validate/RulesSpec.hs b/tests/Language/GraphQL/Validate/RulesSpec.hs index c48b329..02f2cde 100644 --- a/tests/Language/GraphQL/Validate/RulesSpec.hs +++ b/tests/Language/GraphQL/Validate/RulesSpec.hs @@ -94,7 +94,7 @@ dogType = ObjectType "Dog" Nothing [petType] $ HashMap.fromList , ("nickname", nicknameResolver) , ("barkVolume", barkVolumeResolver) , ("doesKnowCommand", doesKnowCommandResolver) - , ("isHousetrained", isHousetrainedResolver) + , ("isHouseTrained", isHouseTrainedResolver) , ("owner", ownerResolver) ] where @@ -105,10 +105,10 @@ dogType = ObjectType "Dog" Nothing [petType] $ HashMap.fromList $ In.Argument Nothing (In.NonNullEnumType dogCommandType) Nothing doesKnowCommandResolver = ValueResolver doesKnowCommandField $ pure $ Boolean True - isHousetrainedField = Field Nothing (Out.NonNullScalarType boolean) + isHouseTrainedField = Field Nothing (Out.NonNullScalarType boolean) $ HashMap.singleton "atOtherHomes" $ In.Argument Nothing (In.NamedScalarType boolean) Nothing - isHousetrainedResolver = ValueResolver isHousetrainedField + isHouseTrainedResolver = ValueResolver isHouseTrainedField $ pure $ Boolean True ownerField = Field Nothing (Out.NamedObjectType humanType) mempty ownerResolver = ValueResolver ownerField $ pure Null @@ -455,7 +455,7 @@ spec = it "rejects duplicate field arguments" $ let queryString = "{\n\ \ dog {\n\ - \ isHousetrained(atOtherHomes: true, atOtherHomes: true)\n\ + \ isHouseTrained(atOtherHomes: true, atOtherHomes: true)\n\ \ }\n\ \}" expected = Error @@ -492,7 +492,7 @@ spec = it "rejects duplicate variables" $ let queryString = "query houseTrainedQuery($atOtherHomes: Boolean, $atOtherHomes: Boolean) {\n\ \ dog {\n\ - \ isHousetrained(atOtherHomes: $atOtherHomes)\n\ + \ isHouseTrained(atOtherHomes: $atOtherHomes)\n\ \ }\n\ \}" expected = Error @@ -507,7 +507,7 @@ spec = it "rejects non-input types as variables" $ let queryString = "query takesDogBang($dog: Dog!) {\n\ \ dog {\n\ - \ isHousetrained(atOtherHomes: $dog)\n\ + \ isHouseTrained(atOtherHomes: $dog)\n\ \ }\n\ \}" expected = Error @@ -522,12 +522,12 @@ spec = it "rejects undefined variables" $ let queryString = "query variableIsNotDefinedUsedInSingleFragment {\n\ \ dog {\n\ - \ ...isHousetrainedFragment\n\ + \ ...isHouseTrainedFragment\n\ \ }\n\ \}\n\ \\n\ - \fragment isHousetrainedFragment on Dog {\n\ - \ isHousetrained(atOtherHomes: $atOtherHomes)\n\ + \fragment isHouseTrainedFragment on Dog {\n\ + \ isHouseTrained(atOtherHomes: $atOtherHomes)\n\ \}" expected = Error { message = @@ -566,7 +566,7 @@ spec = it "rejects unused variables" $ let queryString = "query variableUnused($atOtherHomes: Boolean) {\n\ \ dog {\n\ - \ isHousetrained\n\ + \ isHouseTrained\n\ \ }\n\ \}" expected = Error @@ -648,7 +648,7 @@ spec = it "rejects directive arguments missing in the definition" $ let queryString = "{\n\ \ dog {\n\ - \ isHousetrained(atOtherHomes: true) @include(unless: false, if: true)\n\ + \ isHouseTrained(atOtherHomes: true) @include(unless: false, if: true)\n\ \ }\n\ \}" expected = Error @@ -663,7 +663,7 @@ spec = it "rejects undefined directives" $ let queryString = "{\n\ \ dog {\n\ - \ isHousetrained(atOtherHomes: true) @ignore(if: true)\n\ + \ isHouseTrained(atOtherHomes: true) @ignore(if: true)\n\ \ }\n\ \}" expected = Error @@ -740,13 +740,13 @@ spec = let queryString = "{\n\ \ dog {\n\ \ doesKnowCommand(dogCommand: SIT)\n\ - \ doesKnowCommand: isHousetrained(atOtherHomes: true)\n\ + \ doesKnowCommand: isHouseTrained(atOtherHomes: true)\n\ \ }\n\ \}" expected = Error { message = "Fields \"doesKnowCommand\" conflict because \ - \\"doesKnowCommand\" and \"isHousetrained\" are \ + \\"doesKnowCommand\" and \"isHouseTrained\" are \ \different fields. Use different aliases on the \ \fields to fetch both if this was intentional." , locations = [AST.Location 3 5, AST.Location 4 5] @@ -761,13 +761,13 @@ spec = \ }\n\ \ dog {\n\ \ name\n\ - \ doesKnowCommand: isHousetrained(atOtherHomes: true)\n\ + \ doesKnowCommand: isHouseTrained(atOtherHomes: true)\n\ \ }\n\ \}" expected = Error { message = "Fields \"doesKnowCommand\" conflict because \ - \\"doesKnowCommand\" and \"isHousetrained\" are \ + \\"doesKnowCommand\" and \"isHouseTrained\" are \ \different fields. Use different aliases on the \ \fields to fetch both if this was intentional." , locations = [AST.Location 4 5, AST.Location 8 5] @@ -860,7 +860,7 @@ spec = it "rejects wrongly typed variable arguments" $ let queryString = "query intCannotGoIntoBoolean($intArg: Int) {\n\ \ dog {\n\ - \ isHousetrained(atOtherHomes: $intArg)\n\ + \ isHouseTrained(atOtherHomes: $intArg)\n\ \ }\n\ \}" expected = Error @@ -875,7 +875,7 @@ spec = it "rejects values of incorrect types" $ let queryString = "{\n\ \ dog {\n\ - \ isHousetrained(atOtherHomes: 3)\n\ + \ isHouseTrained(atOtherHomes: 3)\n\ \ }\n\ \}" expected = Error