-
Notifications
You must be signed in to change notification settings - Fork 530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support dynamic Enum value #1023
Support dynamic Enum value #1023
Conversation
@@ -145,7 +145,7 @@ defmodule Absinthe.Blueprint.Schema do | |||
end | |||
|
|||
defp build_types([{:values, values} | rest], [enum | stack], buff) do | |||
enum = Map.update!(enum, :values, &(values ++ &1)) | |||
enum = Map.update!(enum, :values, &(List.wrap(values) ++ &1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the need to wrap these in a list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, yes this is the sneaky bit. Now that values
are wrap_in_unquote
'd it can now be a list of atoms or AST for a function call - so I just wrap everything in a list here so that it can continue to collect in a list.
Then in the end after this all is injected into __absinthe_blueprint__
it'll be some form of nested list, and I can call List.flatten(type_def.values)
to get the final resulting list....
80f2660
to
4031ae9
Compare
4031ae9
to
31327dd
Compare
This PR adds support for dynamic Enum values in macro based schemas using
unqoute
like in #1005