manager.ex (683B)
1 defmodule Absinthe.Schema.Manager do 2 use GenServer 3 4 def start_link(schema) do 5 GenServer.start_link(__MODULE__, schema, []) 6 end 7 8 def init(schema_module) do 9 prototype_schema = schema_module.__absinthe_prototype_schema__ 10 11 pipeline = 12 schema_module 13 |> Absinthe.Pipeline.for_schema(prototype_schema: prototype_schema) 14 |> Absinthe.Schema.apply_modifiers(schema_module) 15 16 schema_module.__absinthe_blueprint__ 17 |> Absinthe.Pipeline.run(pipeline) 18 |> case do 19 {:ok, _, _} -> 20 [] 21 22 {:error, errors, _} -> 23 raise Absinthe.Schema.Error, phase_errors: List.wrap(errors) 24 end 25 26 {:ok, schema_module, :hibernate} 27 end 28 end