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

Empty types should not be allowed #209

Open
nonpop opened this issue May 15, 2018 · 2 comments
Open

Empty types should not be allowed #209

nonpop opened this issue May 15, 2018 · 2 comments

Comments

@nonpop
Copy link

nonpop commented May 15, 2018

According to the GraphQL specification both object types and input types should have at least one field. See here and here. So, the following program should crash saying something about empty types. Currently graphql-go just lets it through.

package main

import graphql "github.com/graph-gophers/graphql-go"

func main() {
	graphql.MustParseSchema("type Foo{}", nil)
}
@robsdedude
Copy link

robsdedude commented Sep 14, 2019

Don't be to quick there ;) graphql/graphql-js#937

As I understood, type Foo{} is indeed invalid, but type Foo is fine.

@robsdedude
Copy link

robsdedude commented Sep 14, 2019

Ok, I'll take that back. It's not ok as per the specs (as @nonpop wrote). How ever I'd suggest to keep it as is, as empty types are very useful (see my the linked issue).

Also it might well happen soon that it's ok to have empty types: graphql/graphql-spec#568

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

No branches or pull requests

2 participants