Open grantwest opened 1 year ago
It looks like Code.ensure_compiled!/1
was added in elixir 1.12.0. Are you open to bumping the minimum elixir version up to 1.12.0 for the next release? If so, do you want a separate PR or should I do it in this one?
I am open to bumping the Elixir requirement to 1.12.0
Ok, I bumped the min elixir version in this same commit to maintain the reason for the bump in the commit history.
Addresses 2 schema module validation issues:
Use
Code.ensure_compiled!/1
rather thanCode.ensure_compiled/1
to avoid masking compile issues and avoid potential race conditions. The existing pattern is specifically warned against in the elixir docs: https://hexdocs.pm/elixir/1.14/Code.html#module-code-loading-on-the-erlang-vmWith the current code it is possible to get the
is not valid Absinthe.Schema
error even though the issue is actually a failure to compile another module. This creates a painful experience.The second improvement is to specify exactly why a schema has failed validation. If a validation fails, the next question asked is why? This change answers that question immediately, rather than making the user change absinthe_plug code to debug.
Because
Code.ensure_compiled!/1
is introduced in elixir 1.12 this commit also bumps the minimum elixir version up to 1.12.