-
Notifications
You must be signed in to change notification settings - Fork 132
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
fix: JSON block string encoding #843
fix: JSON block string encoding #843
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
And now, after checking the relevant part of the GraphQL spec, I also realize that block quote indentation is not being handled correctly. For example: query {
foo(bar:
"""
abc
def
""")
} and query {
foo(bar:
"""
abc
def
""")
} ... should be treated equivalently. Currently, the latter includes extraneous whitespace on the second line. Update forthcoming... |
Block indentation has been fixed, with passing tests. BTW, I tried figuring out how to fix it in the lexer, but ran into problems because the resulting tokens are always just start/end pointers back to the original raw text. For the indentation parsing algorithm to work correctly, it has to be able to exclude data from the middle of a character sequence. So instead, I just wrote functions to find the original raw block string, and then parsed it according to the spec. Hope that works for y'all. |
@mattjohnsonpint thank you! |
Fixes #839
Note, I considered using
gjson.AppendJSONString
for better performance, but it currently doesn't have an option to disable escaping of HTML characters - which I think would be undesirable here. See tidwall/gjson#362