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

Feature/did you mean input objects #902

Conversation

pmargreff
Copy link
Contributor

It address #314.

The steps to make things happen are:

  • Extract suggesion's to Utils module, so both input and objects can use the same implementation.
  • Complement unknown field error message with suggestions (when they exists).

I've based the tests on current ones, feel free to request new tests where necessary to avoid any regressions.

I also have no sure about the Utils module inside /validation dir is a good pattern, since each module inside /validation maps directly to a step, I've created this new Utils thing to differentiate it.

Suggestions are always welcome! : )

Copy link
Contributor

@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.

This is fantastic thank you! I've got a minor note which you may want to create a test case around to validate that it is actually necessary.

@@ -79,7 +79,14 @@ defmodule Absinthe.Phase.Document.Validation.ArgumentsOfCorrectType do
node.fields
|> Enum.flat_map(fn
%{flags: %{invalid: _}, schema_node: nil} = child ->
[unknown_field_error_message(child.name)]
field_suggestions =
case node.schema_node do
Copy link
Contributor

Choose a reason for hiding this comment

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

You should Type.unwrap(node.schema_node) because this could be wrapped in non_null.

Copy link
Contributor Author

@pmargreff pmargreff Apr 8, 2020

Choose a reason for hiding this comment

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

Used this line as example, should I change this one also? It's not related with the new feature!

@benwilson512 benwilson512 merged commit 62979de into absinthe-graphql:master Apr 9, 2020
@benwilson512
Copy link
Contributor

benwilson512 commented Apr 9, 2020

Thank you!

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