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

[BUG] Printer fails with string blocks #453

Open
sh1l0n opened this issue Apr 3, 2024 · 5 comments · May be fixed by #454
Open

[BUG] Printer fails with string blocks #453

sh1l0n opened this issue Apr 3, 2024 · 5 comments · May be fixed by #454

Comments

@sh1l0n
Copy link

sh1l0n commented Apr 3, 2024

When a String is on format

"Lore ipsum
One
Two"

The query execution should valid due to "Invalid character on string literal" error appear, for fixing it the function visitStringValueNode should return the string in the right format like:

"Lore ipsum\nOne\nTwo"
@sh1l0n sh1l0n linked a pull request Apr 3, 2024 that will close this issue
@sh1l0n sh1l0n changed the title Printer fails with string blocks [BUG] Printer fails with string blocks Apr 3, 2024
@knaeckeKami
Copy link
Collaborator

knaeckeKami commented Apr 3, 2024

According to https://spec.graphql.org/June2018/#sec-String-Value
A multiline like

"Lore ipsum
One
Two"

is not allowed, for multiline strings, block strings (with triple quotes) are required.

Does this still fail for proper block strings?

@sh1l0n
Copy link
Author

sh1l0n commented Apr 4, 2024

According to https://spec.graphql.org/June2018/#sec-String-Value A multiline like

"Lore ipsum
One
Two"

is not allowed, for multiline strings, block strings (with triple quotes) are required.

Does this still fail for proper block strings?

About the documentation thx a lot, now are integrated all the escaped characters in ae3d44c #454

I will show you with an example

  1. The stringValueNode parameter contains this text: "Lore ipsum\nOne\nTwo";
  2. stringValueNode.isBlock will return false since is not """
  3. When printNode is called, stringValueNode will be displayed as
"Lore ipsum
One
Two"

causing a problem when encoding the query with the gql_link RequestSerializer

"query": printNode(request.operation.document),

@sh1l0n
Copy link
Author

sh1l0n commented Apr 4, 2024

According to https://spec.graphql.org/June2018/#sec-String-Value A multiline like

"Lore ipsum
One
Two"

is not allowed, for multiline strings, block strings (with triple quotes) are required.

Does this still fail for proper block strings?

Is is possible also that the Token is not computing the strings correctly?

String _getValue() {

@knaeckeKami
Copy link
Collaborator

Is is possible also that the Token is not computing the strings correctly?

If you point me to any nontrivial piece of code and ask me "is it possible that there is a bug" I'll always say yes ;)

Do you have any specific lead to a potential issue?

@knaeckeKami
Copy link
Collaborator

According to https://spec.graphql.org/June2018/#sec-String-Value A multiline like

"Lore ipsum
One
Two"

is not allowed, for multiline strings, block strings (with triple quotes) are required.
Does this still fail for proper block strings?

About the documentation thx a lot, now are integrated all the escaped characters in ae3d44c #454

I will show you with an example

  1. The stringValueNode parameter contains this text: "Lore ipsum\nOne\nTwo";
  2. stringValueNode.isBlock will return false since is not """
  3. When printNode is called, stringValueNode will be displayed as
"Lore ipsum
One
Two"

causing a problem when encoding the query with the gql_link RequestSerializer

"query": printNode(request.operation.document),

Yes, that's true; There is an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants