Skip to content
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

Merged
merged 3 commits into from
Dec 23, 2016
Merged

Fix interior field nullability checks #239

merged 3 commits into from
Dec 23, 2016

Conversation

benwilson512
Copy link
Contributor

No description provided.

nietaki and others added 3 commits December 23, 2016 10:19
…#237)

* Adding failing tests for enforcing non_null fields in input variables

* simplifying the offending from a mutation to a query
Copy link
Contributor Author

@benwilson512 benwilson512 left a 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)
Copy link
Contributor Author

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),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fancy typespecs FTW

Copy link
Contributor

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

Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants