zf

zenflows testing
git clone https://s.sonu.ch/~srfsh/zf.git
Log | Files | Refs | Submodules | README | LICENSE

scalar_type_definition.ex (1241B)


      1 defmodule Absinthe.Blueprint.Schema.ScalarTypeDefinition do
      2   @moduledoc false
      3 
      4   alias Absinthe.Blueprint
      5 
      6   @enforce_keys [:name]
      7   defstruct [
      8     :name,
      9     :identifier,
     10     :module,
     11     description: nil,
     12     parse: nil,
     13     serialize: nil,
     14     directives: [],
     15     source_location: nil,
     16     open_ended: false,
     17     # Added by phases
     18     flags: %{},
     19     errors: [],
     20     __reference__: nil,
     21     __private__: []
     22   ]
     23 
     24   @type t :: %__MODULE__{
     25           name: String.t(),
     26           description: nil | String.t(),
     27           directives: [Blueprint.Directive.t()],
     28           source_location: nil | Blueprint.SourceLocation.t(),
     29           # Added by phases
     30           flags: Blueprint.flags_t(),
     31           errors: [Absinthe.Phase.Error.t()]
     32         }
     33 
     34   def build(type_def, _schema) do
     35     %Absinthe.Type.Scalar{
     36       identifier: type_def.identifier,
     37       name: type_def.name,
     38       description: type_def.description,
     39       definition: type_def.module,
     40       serialize: type_def.serialize,
     41       parse: type_def.parse,
     42       open_ended: type_def.open_ended
     43     }
     44   end
     45 
     46   @doc false
     47   def functions(), do: [:serialize, :parse]
     48 
     49   defimpl Inspect do
     50     defdelegate inspect(term, options),
     51       to: Absinthe.Schema.Notation.SDL.Render
     52   end
     53 end