-
Notifications
You must be signed in to change notification settings - Fork 525
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
Fix interior field nullability checks #239
Conversation
…#237) * Adding failing tests for enforcing non_null fields in input variables * simplifying the offending from a mutation to a query
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.
@nietaki thanks for your help!
@@ -28,6 +28,10 @@ defmodule Absinthe.Phase.Document.MissingLiterals do | |||
fields = fill_missing_nodes(Blueprint.Input.Field, fields, schema_fields, node.source_location, adapter, schema) | |||
%{node | fields: fields} | |||
end | |||
defp populate_node(%Blueprint.Input.Object{schema_node: %{of_type: type}} = node, adapter, schema) do | |||
%{ node | schema_node: type} | |||
|> populate_node(adapter, schema) |
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.
@nietaki in the end I just went with a recursive approach here.
@@ -17,7 +17,7 @@ defmodule Absinthe.Blueprint.Input.Object do | |||
@type t :: %__MODULE__{ | |||
fields: [Blueprint.Input.Field.t], | |||
flags: Blueprint.flags_t, | |||
schema_node: nil | Absinthe.Type.InputObject.t, | |||
schema_node: nil | Absinthe.Type.InputObject.t | Absinthe.Type.NonNull.t(Absinthe.Type.InputObject.t), |
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.
Fancy typespecs FTW
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.
I didn't even know you could do @type t(x) :: %__MODULE__{of_type: x}
, good stuff.
@@ -47,7 +47,18 @@ defmodule Absinthe.Execution.ArgumentsTest do | |||
value :sms, deprecate: "Use phone instead" | |||
end | |||
|
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.
I moved the tests to arguments_test because that's generally where we've been doing these kinds of tests.
No description provided.