I have been using Playground for a while now with a GraphQL API developed in ASP.NET Core, using the open source library graphql-dotnet.
Everytime I download the SDL schema from Playground, there are several comment lines with line breaks in the middle, which makes the exported file invalid until I manually delete all unwanted line breaks.
After investigation, I found out that the library graphql-dotnet brings comments for scalar types containing the word "scalar" (like this one) or even with closing braces in it (for example the connection type).
So, those comment lines are matched by the regex in function addLineBreaks which then adds unwanted line breaks, resulting in the following invalid schema file (cut for clarity):
Changes proposed in this pull request:
Change breakBrackets regex to match opening braces only on beginning of lines (to add a line break after a type)
Change withLineBreaks regex to match the word 'scalar' only on beginning of lines and make it multiline
I hope my explanations are clear enough, and am looking forward to be able to export a valid SDL schema directly!
Thank you for your great work on this essential tool to develop GraphQL APIs!
I'm pretty sure this fixes the schema tab crashing. I found the offending line break comment in our schema, removed it, and the schema tab stopped crashing
I have been using Playground for a while now with a GraphQL API developed in ASP.NET Core, using the open source library graphql-dotnet.
Everytime I download the SDL schema from Playground, there are several comment lines with line breaks in the middle, which makes the exported file invalid until I manually delete all unwanted line breaks.
After investigation, I found out that the library graphql-dotnet brings comments for scalar types containing the word "scalar" (like this one) or even with closing braces in it (for example the connection type). So, those comment lines are matched by the regex in function
addLineBreaks
which then adds unwanted line breaks, resulting in the following invalid schema file (cut for clarity):Changes proposed in this pull request:
breakBrackets
regex to match opening braces only on beginning of lines (to add a line break after a type)withLineBreaks
regex to match the word 'scalar' only on beginning of lines and make it multilineI hope my explanations are clear enough, and am looking forward to be able to export a valid SDL schema directly! Thank you for your great work on this essential tool to develop GraphQL APIs!