Skip to content

Conversation

@trevor-scheer
Copy link
Contributor

@trevor-scheer trevor-scheer commented Feb 25, 2020

printFederatedSchema has a bug where descriptions that use double quotes as part of the description itself (note, this REQUIRES a multi-line description - triple double-quotes - to work) can be transformed into a single-line description with double-quotes which is unparseable!

The additional test case demonstrates the bug well, and the fix is straightforward. If a description contains a double quote, force a multi-line description to be printed regardless of the length.

Fixes #3864.

Comment on lines +351 to +355
// If a description uses the double quote character, it absolutely must use
// a multi-line comment.
const requireMultiline = lines.some(line => line.includes('"'));

if (lines.length === 1 && !requireMultiline) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Escaped quotes (i.e. \") are valid in non-block'd def.description.values in a schema's AST, so the comment here is not quite correct. Further, I believe by using this implementation we'd be applying/requiring this transformation unnecessarily.

Perhaps we might consider downstreaming some of the changes in graphql's printSchema which seems to have a more current version of the printDescription method which I believe we cargo cult-ed at one point.

Generally, except for where we leverage specific overrides, I'd have a preference for a more exact copy of that implementation.

Base automatically changed from master to main June 24, 2020 18:17
@trevor-scheer
Copy link
Contributor Author

Fixed in #4405

@trevor-scheer trevor-scheer deleted the trevor/federation-description-bug branch July 28, 2020 19:02
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

printFederatedSchema produces invalid syntax when field description contains double quotes

3 participants