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 introspection bug with import_fields and input #1015

Merged

Conversation

binaryseed
Copy link
Contributor

This PR fixes a bug that would include __typename in an input if it called import_fields on an object.

Fixes #989

@binaryseed binaryseed changed the title Show introspection bug with import_fields and input Fix introspection bug with import_fields and input Jan 1, 2021
def import_fields(%def_type{} = type, types) when def_type in @can_import do
Enum.reduce(type.imports, type, fn {source, opts}, type ->
source_type = Map.fetch!(types, source)

rejections = Keyword.get(opts, :except, [])
rejections = Keyword.get(opts, :except, []) ++ @exclude_fields
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 chose to always exclude __typename since the current behavior was actually causing it to be included twice for object as well as once for input_object

@binaryseed binaryseed force-pushed the import_fields-input-__typename branch from 16553d0 to d437a58 Compare January 2, 2021 00:29
@binaryseed binaryseed merged commit 4cb5beb into absinthe-graphql:master Jan 2, 2021
@binaryseed binaryseed deleted the import_fields-input-__typename branch January 2, 2021 03:04
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.

Import fields includes introspect fields
1 participant