Skip to content

PR for #2461 breaks the spec #2549

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

Closed
dteoh opened this issue Oct 16, 2019 · 2 comments
Closed

PR for #2461 breaks the spec #2549

dteoh opened this issue Oct 16, 2019 · 2 comments

Comments

@dteoh
Copy link

dteoh commented Oct 16, 2019

According to both the current and draft specs:

... a type definition like type Query { } type Query is a valid definition, because the production of FieldsDefinition is optional.

People might wonder why this could possibly be useful. Well in conjunction with union, it can be used to implement variant types like in OCaml, where some variants might have parameters, and others might not. For example:

type RGB {
  red: Int
  green: Int
  blue: Int
}

type SystemDefault

union Color = RGB | SystemDefault

Edit: Apologies, type Query { } is invalid, because it requires one or more FieldDefinition productions. However, type Query is valid, which is now not possible to model in graphql-ruby.

@swalkinshaw
Copy link
Collaborator

@dteoh
Copy link
Author

dteoh commented Oct 16, 2019

Ok, sorry about this. I guess I will just have to add a dummy field to model variants with no params.

I don't quite understand why FieldsDefinition would be marked as optional though.

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