Skip to content

Rework of all value nodes + tune error messages #166

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

Merged
merged 1 commit into from
Jan 7, 2022
Merged

Rework of all value nodes + tune error messages #166

merged 1 commit into from
Jan 7, 2022

Conversation

sungam3r
Copy link
Member

@sungam3r sungam3r commented Jan 7, 2022

I continue to work on strict grammar.

@sungam3r sungam3r requested a review from Shane32 January 7, 2022 21:11
@sungam3r sungam3r self-assigned this Jan 7, 2022
@sungam3r sungam3r added this to the 8.0 milestone Jan 7, 2022
@github-actions github-actions bot added the test Pull request that adds new or changes existing tests label Jan 7, 2022
@sungam3r
Copy link
Member Author

sungam3r commented Jan 7, 2022

I plan to add tests in further PRs to increase code coverage. Also I think about switching to file-scoped namespaces. There are no PRs in this repo so no conflicts.

@sungam3r sungam3r added enhancement New feature or request spec compliance The change is intended to solve the problem of inconsistency with the official GraphQL specification labels Jan 7, 2022
/// <see cref="ASTNodeKind.NullValue">Null</see>
/// </summary>
[DebuggerDisplay("{Value}")]
public class GraphQLScalarValue : GraphQLValue
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad design here, misleading naming. I removed this node. Also now all child nodes don't store ASTNodeKind -> less memory.

[InlineData("enum E { true A }", "Unexpected Name \"true\"; enum values are represented as unquoted names but not 'true' or 'false' or 'null'.", 1, 10)]
[InlineData("enum E { B false }", "Unexpected Name \"false\"; enum values are represented as unquoted names but not 'true' or 'false' or 'null'.", 1, 12)]
[InlineData("enum E { A null B }", "Unexpected Name \"null\"; enum values are represented as unquoted names but not 'true' or 'false' or 'null'.", 1, 12)]
public void Should_Throw_On_Invalid_EnumValue(string query, string description, int line, int column)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test failed before changes since EnumValueDefinition accepts true/false/null that contradicts spec.

Copy link
Member

@Shane32 Shane32 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have to see the corresponding changes required in GraphQL.NET to really know how these changes will work. I suggest having the dev branch pull in the beta build from GitHub Packages before publishing the new version here. Here's a few concerns I see:

  • Is there a unified way of retrieving the Value of a node -- or certainly a scalar node -- without having to cast it to it's specific node type? Does it matter?
  • How does elimination of GraphQLScalarValue from the inheritance chain affect use?

@sungam3r
Copy link
Member Author

sungam3r commented Jan 7, 2022

I think that nothing bad will happen. See CoreToVanillaConverter especilly internal static IValue Value(GraphQLValue source) with switch by ASTNodeKind. I hope that we can eliminate GraphQL.Language.AST subsystem at all in v5. At least I have suspicion. The missing API can be added to the parser project.

@sungam3r
Copy link
Member Author

sungam3r commented Jan 7, 2022

I would say that the parser object model / API evolved to such an extent that ready to "absorb" GraphQL.Language.AST (or be merged with it). Just open two projects side-by-side and compare file names, interfaces, API, etc.

@Shane32
Copy link
Member

Shane32 commented Jan 7, 2022

Again, let's use the beta build in graphql.net before releasing vNext of parser, so we can make tweaks if necessary

@sungam3r sungam3r merged commit a32b806 into master Jan 7, 2022
@sungam3r sungam3r deleted the enums branch January 7, 2022 23:40
@sungam3r
Copy link
Member Author

sungam3r commented Jan 7, 2022

Of course. I was not going to release the parser separately.

@sungam3r
Copy link
Member Author

sungam3r commented Jan 7, 2022

I still have work in the parser, a few PRs. When done I'll bump parser version on develop branch here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request spec compliance The change is intended to solve the problem of inconsistency with the official GraphQL specification test Pull request that adds new or changes existing tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants