-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Spec and graphql-js disagree on the meaning of a leading zero in numbers #572
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
Comments
Inside arrays as literal values: {
foo(arg: [0 0])
}
Yes, I brought this problem during the last working group meeting and used even more confusing example: {
foo(arg: [0x0F])
} In this context
So I want to include recommendation that any non-Punctuator tokens should have at least one ignored tokens between them. And the idea is to first test this in the context of |
I realized that afterwards and thought I edited my post; I appear to have discarded that edit accidentally.
Is it really a breaking change if what I think is effectively the reference implementation (graphql-js) doesn't follow the spec? The two primary .Net implementations, graphql-dotnet and HotChocolate reject '00' too. So does the Rust juniper parser, the Go graphql-go parser, and the PHP graphql-php parser. The two parsers that don't appear to reject '00' are the Java graphql-java and Ruby graphql-ruby parsers, which are built with parser/lexer generators rather than handcoded. Basically, I think at this point this is more of an editorial defect in the spec in that it doesn't reflect the reality of the parsers than a bug in the parsers. |
@CornedBee I don't mean Or do you propose to only forbid |
Just touching numeric tokens, so To express this, the same lookahead syntax as the |
@CornedBee Since this is a change to grammar it should go through RFC process, more details here: https://github.com/graphql/graphql-spec/blob/master/CONTRIBUTING.md#rfc-contribution-champions |
A test case from graphql-js:
But a literal reading of the grammar for IntValue simply says that
00
is two IntValue tokens, each with a value of 0.This is obviously not useful; first there's no place in the grammar where two IntValue tokens may appear next to each other, and second, it would be really confusing.
But the spec should probably change its grammar to explicitly call this out.
The text was updated successfully, but these errors were encountered: