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

Reading a schema file that has triple quotes? #81

Closed
gregarican opened this issue Aug 3, 2020 · 7 comments
Closed

Reading a schema file that has triple quotes? #81

gregarican opened this issue Aug 3, 2020 · 7 comments
Labels
duplicate This issue or pull request already exists enhancement New feature or request spec compliance The change is intended to solve the problem of inconsistency with the official GraphQL specification

Comments

@gregarican
Copy link

So I have a schema file. With comments encased in triple quotes. Trying to read in the file like this:
var schemaTxt = File.ReadAllText(@".\shopify.graphql"); var schema = Schema.For(schemaTxt);
When I do so the first line with triple quotes is throwing an exception. Is there an option I can configure to treat these as comments and ignore them?

For example, """Marks an element of a GraphQL schema as having restricted access."""

@gregarican
Copy link
Author

What further complicates the situation is that some comments have multiple lines, with triple quotes on either end of the block. I suppose I can just regex all of it away for now as a workaround.

@gregarican
Copy link
Author

So I was able to remove all triple-quoted comments using RegEx. Now I receive this error when porting in the schema:

GraphQLParser.Exceptions.GraphQLSyntaxErrorException
HResult=0x80131500
Message=Syntax Error GraphQL (1:3526) Unexpected character "&"

It appears that the routine is choking on:

type AppPurchaseOneTime implements AppPurchase & Node

The schema as a few cases where types implement from multiple other types. Is this something that's not allowed or is there an option that will allow this?

@sungam3r
Copy link
Member

sungam3r commented Aug 3, 2020

What version do you use? Try the latest 3.0.0 preview. Also look here https://github.com/graphql-dotnet/parser/issues

@gregarican
Copy link
Author

Just updated to the v3.0.0 preview version. Same result. I didn't previously search through the parser issue area to see if it can't process a type with multiple implements. I assume this is the case.

@gregarican
Copy link
Author

I replaced all & characters with commas and the schema successfully parsed. Need to perform some test queries to see if it all pulled over completely/correctly.

@sungam3r sungam3r transferred this issue from graphql-dotnet/graphql-dotnet Aug 16, 2020
@sungam3r
Copy link
Member

Possible duplicate of #33.

@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 Aug 16, 2020
@sungam3r sungam3r added the duplicate This issue or pull request already exists label Nov 9, 2021
@sungam3r
Copy link
Member

sungam3r commented Nov 9, 2021

Support for descriptions was added in #132

@sungam3r sungam3r closed this as completed Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists enhancement New feature or request spec compliance The change is intended to solve the problem of inconsistency with the official GraphQL specification
Projects
None yet
Development

No branches or pull requests

2 participants