summaryrefslogtreecommitdiff
path: root/src/Language/GraphQL
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2024-08-23 11:25:54 +0200
committerEugen Wissner <belka@caraus.de>2024-08-23 11:25:54 +0200
commita4e648d5aa1b51adba3939377c7e5f1c12cd315a (patch)
tree946afd2e9dc9123dfd2f2c8940f28769c821f029 /src/Language/GraphQL
parent6e32112be4a9fe898ec615b59dabcda8c36005bd (diff)
downloadgraphql-a4e648d5aa1b51adba3939377c7e5f1c12cd315a.tar.gz
Add specifiedBy directive
Diffstat (limited to 'src/Language/GraphQL')
-rw-r--r--src/Language/GraphQL/Type/Schema.hs14
1 files 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