zf

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

build.ex (1036B)


      1 defmodule Absinthe.Phase.Schema.Build do
      2   @moduledoc false
      3 
      4   def run(blueprint, _opts) do
      5     %{schema_definitions: [schema]} = blueprint
      6 
      7     types = build_types(blueprint)
      8     directives = build_directives(blueprint)
      9 
     10     schema = %{schema | type_artifacts: types, directive_artifacts: directives}
     11 
     12     blueprint = %{blueprint | schema_definitions: [schema]}
     13 
     14     {:ok, blueprint}
     15   end
     16 
     17   def build_types(%{schema_definitions: [schema]}) do
     18     for %module{} = type_def <- schema.type_definitions do
     19       type = module.build(type_def, schema)
     20 
     21       %{
     22         type
     23         | __reference__: type_def.__reference__,
     24           __private__: type_def.__private__
     25       }
     26     end
     27   end
     28 
     29   def build_directives(%{schema_definitions: [schema]}) do
     30     for %module{} = type_def <- schema.directive_definitions do
     31       type = module.build(type_def, schema)
     32 
     33       %{
     34         type
     35         | definition: type_def.module,
     36           __reference__: type_def.__reference__,
     37           __private__: type_def.__private__
     38       }
     39     end
     40   end
     41 end