From 137b5aace3d6c5cac5f9c7cc3c45d1c5c87c253e Mon Sep 17 00:00:00 2001 From: Maarten van Vliet Date: Wed, 7 Sep 2022 10:51:18 +0200 Subject: [PATCH] Add specifiedBy type system directive as per spec See https://spec.graphql.org/October2021/#sec--specifiedBy for the specification Fixes https://github.com/absinthe-graphql/absinthe/issues/918 --- lib/absinthe/schema/prototype/notation.ex | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/absinthe/schema/prototype/notation.ex b/lib/absinthe/schema/prototype/notation.ex index 5f10068f78..d8043ee959 100644 --- a/lib/absinthe/schema/prototype/notation.ex +++ b/lib/absinthe/schema/prototype/notation.ex @@ -32,6 +32,17 @@ defmodule Absinthe.Schema.Prototype.Notation do expand &__MODULE__.expand_deprecate/2 end + directive :specified_by do + description "Exposes a URL that specifies the behavior of this scalar." + + repeatable false + + arg :url, non_null(:string), + description: "The URL that specifies the behavior of this scalar." + + on [:scalar] + end + def pipeline(pipeline) do pipeline |> Absinthe.Pipeline.without(Absinthe.Phase.Schema.Validation.QueryTypeMustBeObject)