From a4e648d5aa1b51adba3939377c7e5f1c12cd315a Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Fri, 23 Aug 2024 11:25:54 +0200 Subject: [PATCH] Add specifiedBy directive --- src/Language/GraphQL/Type/Schema.hs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Language/GraphQL/Type/Schema.hs b/src/Language/GraphQL/Type/Schema.hs index c8ac77a..27053f2 100644 --- a/src/Language/GraphQL/Type/Schema.hs +++ b/src/Language/GraphQL/Type/Schema.hs @@ -85,6 +85,7 @@ schemaWithTypes description' queryRoot mutationRoot subscriptionRoot types' dire [ ("skip", skipDirective) , ("include", includeDirective) , ("deprecated", deprecatedDirective) + , ("specifiedBy", specifiedByDirective) ] includeDirective = Directive includeDescription skipIncludeLocations includeArguments @@ -113,9 +114,8 @@ schemaWithTypes description' queryRoot mutationRoot subscriptionRoot types' dire \the Markdown syntax, as specified by \ \[CommonMark](https://commonmark.org/).'" deprecatedArguments = HashMap.singleton "reason" - $ In.Argument reasonDescription reasonType + $ In.Argument reasonDescription (In.NamedScalarType Definition.string) $ Just "No longer supported" - reasonType = In.NamedScalarType Definition.string deprecatedDescription = Just "Marks an element of a GraphQL schema as no longer supported." deprecatedLocations = @@ -124,6 +124,16 @@ schemaWithTypes description' queryRoot mutationRoot subscriptionRoot types' dire , TypeSystemDirectiveLocation DirectiveLocation.InputFieldDefinition , TypeSystemDirectiveLocation DirectiveLocation.EnumValue ] + specifiedByDirective = + Directive specifiedByDescription specifiedByLocations specifiedByArguments + urlDescription = Just + "The URL that specifies the behavior of this scalar." + specifiedByArguments = HashMap.singleton "url" + $ In.Argument urlDescription (In.NonNullScalarType Definition.string) Nothing + specifiedByDescription = Just + "Exposes a URL that specifies the behavior of this scalar." + specifiedByLocations = + [TypeSystemDirectiveLocation DirectiveLocation.Scalar] -- | Traverses the schema and finds all referenced types. collectReferencedTypes :: forall m