prototype.ex (923B)
1 defmodule Absinthe.Schema.Prototype do 2 @moduledoc """ 3 Provides the directives available for SDL schema definitions. 4 5 By default, the only directive provided is `@deprecated`, which supports 6 a `reason` argument (of GraphQL type `String`). This can be used to 7 mark a field 8 9 To add additional schema directives, define your own prototype schema, e.g.: 10 11 ``` 12 defmodule MyAppWeb.SchemaPrototype do 13 use Absinthe.Schema.Prototype 14 15 directive :feature do 16 arg :name, non_null(:string) 17 on [:interface] 18 # Define `expand`, etc. 19 end 20 21 # More directives... 22 end 23 ``` 24 25 Then, set it as the prototype for your schema: 26 27 ``` 28 defmodule MyAppWeb.Schema do 29 use Absinthe.Schema 30 31 @prototype_schema MyAppWeb.SchemaPrototype 32 33 # Use `import_sdl`, etc... 34 end 35 ``` 36 """ 37 use __MODULE__.Notation 38 39 defmacro __using__(opts \\ []) do 40 __MODULE__.Notation.content(opts) 41 end 42 end