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

sdl-encoder: fix description encodings #742

Merged
merged 2 commits into from
Aug 17, 2021

Conversation

lrlna
Copy link
Member

@lrlna lrlna commented Aug 17, 2021

This commit introduces Description helper to encode top-level, field-level and input-level descriptions. This helps unify some of the description logic we've had across multiple files.

This commit also checks whether a description string is a block string character or a string character which then determines whether description needs to be multilined.

Fixes #728.

This commit introduces `Description` helper to encode top-level, field-level and input-level descriptions. This helps unify some of the description logic we've had across multiple files.

This commit also checks whether a description string is a block string character or a string character which then determines whether description needs to be multilined.

Fixes #728.
@apollo-cla
Copy link

@lrlna: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/

Comment on lines +32 to +36
if is_block_string_character(description) {
writeln!(f, "\"\"\"\n{}\n\"\"\"", description)?
} else {
writeln!(f, "\"\"\"{}\"\"\"", description)?
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This can be done even more properly, where line 35 actually creates a StringCharacter that would make description look "like this" instead of """like this""". I am keeping it as is to match what Studio has at the moment. This will be aligned directly in apollo-rs encoder.

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

Successfully merging this pull request may close these issues.

introspect drops comment new lines which breaks SDL parsing
4 participants