-
Notifications
You must be signed in to change notification settings - Fork 73
Add Blockstrings support #65
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
Conversation
First pass at block string support. Not sufficient This doesn’t trim leading indentation (or trailing whitespace) from the lines inside the block string, which is expected and the specific requirements are detailed in the graphql spec. Added the algorithm/notes from the spec and a blockStringValue() empty function to implement this in. Saving this old work because it works other than that.
…tests. add tests for empty string and blockstring. take out trimming of string since that is moving to blockStringValue(rawString:) next. update comment for readString
this commit has the debugging code still in it. next one will remove that.
…ings subtle: swift .split omits blank lines by default. But other issues combined with that.
|
oi. Forgot I was going to go back and try to clean up the test function names… |
|
Hello, @haikusw. Thank you very much for your contribution! Just so you know, the structure of this repo mainly mirrors the structure of the javascript canonical GraphQL implementation. For your next contributions would be valuable to check how the js counterpart implements what you're after. For example: Most of the times a direct "translation" from Typescript do Swift is possible. 🙂 |
Ah, I did not realize this. That does sound like it might have saved some time. Thank you. |
I see that they did what I did initially which was to make a new |
That sounds great! |
|
done: #68 |
This PR addresses #64 "GraphQL doesn't support 'Blockstrings' which are often used in Descriptions".
There are multiple ways to implement this support and I tried to pick one that matches the existing style of lexing/parsing. Lots of tests are included, though I'm sure more could be thought of.
There's one piece that I just noticed is missing: support for escaped Blockstrings
\"""I'm out of time for this project and don't actually need those (yet), so I'm going to punt on that for now. Shouldn't be terribly difficult, but… ¯_(ツ)_/¯.
I hope you find these contributions acceptable in form and substance. Feel free to let me know if there's things you'd prefer to be done differently.
All my work has been done on macOS 10.15.6 using Xcode 12b5, so I will be interested to see if this builds on linux.
Fixes #64