fix: don't add graphql types if API doesn't compile

This commit is contained in:
Zach Daniel 2020-08-17 03:00:13 -04:00
parent f81f8d45cb
commit a7e4b165e4
No known key found for this signature in database
GPG key ID: C377365383138D4B

View file

@ -22,8 +22,9 @@ defmodule AshGraphql do
def run(blueprint, _opts) do
api = unquote(api)
Code.ensure_compiled(api)
case Code.ensure_compiled(api) do
{:module, _} ->
blueprint_with_queries =
api
|> AshGraphql.Api.queries(__MODULE__)
@ -49,6 +50,11 @@ defmodule AshGraphql do
end)
{:ok, %{blueprint_with_mutations | schema_definitions: new_defs}}
{:error, _} ->
# Something else will fail here, so we don't need to
{:ok, blueprint}
end
end
end