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

Correctly dealing with InputObject without any fields #4135

Closed
Bertg opened this issue Jul 11, 2022 · 1 comment · Fixed by #4138
Closed

Correctly dealing with InputObject without any fields #4135

Bertg opened this issue Jul 11, 2022 · 1 comment · Fixed by #4138

Comments

@Bertg
Copy link

Bertg commented Jul 11, 2022

Describe the bug

Possible invalid schema generation

Versions

graphql version: 2.0.5
rails (or other framework): Rails-7.0.3
other applicable versions: graphql-batch (0.5.1)

GraphQL schema

See above

GraphQL query

See below

Steps to reproduce

Given I define an Input Object without any fields
When I generate the schema, I get the following result:

input SomeInputType {
}

When I try to read this with @graphql-tools/load I get an error.

However If I modify the output to

input SomeInputType

reading with @graphql-tools/load works fine.

Expected behavior

I'm not sure what is correct here, but I'm assuming the GraphQL lib should not render empty lists { }. Both for InputObject and Objects. If not, maybe there should be runtime warnings for having InputObject/Objects without any field defined.

Actual behavior

See above

Additional context

No other context

@rmosolgo
Copy link
Owner

Thanks for the detailed report! I've worked up a fix and I'll release it soon.

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 a pull request may close this issue.

2 participants