Closed SimonSapin closed 9 months ago
Should we also prefer block strings for single-line descriptions? (As opposed to string Value
s)
It looks like graphql-js:
StringValue
objects can contain a isBLockString
boolean flag… but nothing ever sets it?@IvanGoncharov did I miss something?
Did the new pushes change something or is it just a rebase?
Rebase to make CI pass + removing the obsolete comment
StringValue objects can contain a isBLockString boolean flag… but nothing ever sets it?
@SimonSapin The flag called, block
is isBLockString
just an alias in this particular destruction.
It is set in parser:
https://github.com/graphql/graphql-js/blob/0b7590f0a2b65e6210da2e49be0d8e6c27781af2/src/language/parser.ts#L713
This allows graphql-js to do round-trip where block string is parsed and when printed as block string.
Yes, note that not every string can be printed as block string.
Block string printing has some heuristics to decide whether to add leading/trailing newlines
Yes, in graphql-js we had a bug where by printing string as block string we were loosing some characters so I spend bunch of time figuring out different heuristics that preserved all characters.
New commit to make stylistic choices closer to graphql-js:
"""example"""
, except for trailing characters that would make it incorrect
Fixes https://github.com/apollographql/apollo-rs/issues/664