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

[0.12][WIP] Block Strings #238

Closed
wants to merge 2 commits into from
Closed

[0.12][WIP] Block Strings #238

wants to merge 2 commits into from

Conversation

danez
Copy link
Contributor

@danez danez commented Feb 8, 2018

This RFC adds a new form of StringValue, the multi-line string, similar to that found in Python and > Scala.

A multi-line string starts and ends with a triple-quote:

"""This is a triple-quoted string
and it can contain multiple lines"""

Multi-line strings are useful for typing literal bodies of text where new lines should be interpretted literally. In fact, the only escape sequence used is \""" and \ is otherwise allowed unescaped. This is beneficial when writing documentation within strings which may reference the back-slash often:

"""
In a multi-line string \n and C:\\ are unescaped.
"""

The primary value of multi-line strings are to write long-form input directly in query text, in tools like GraphiQL, and as a prerequisite to another pending RFC to allow docstring style documentation in the Schema Definition Language.

Ref: graphql/graphql-js#926
ref: graphql/graphql-js@f9e67c4

@danez danez changed the title RFC: Block String [0.12] Block Strings Feb 8, 2018
@coveralls
Copy link

coveralls commented Feb 8, 2018

Coverage Status

Coverage decreased (-0.08%) to 92.757% when pulling f475cdf on danez:012-block-strings into 94525c0 on webonyx:master.

@danez danez changed the title [0.12] Block Strings [0.12][WIP] Block Strings Feb 8, 2018
This RFC adds a new form of `StringValue`, the multi-line string, similar to that found in Python and Scala.

A multi-line string starts and ends with a triple-quote:

```
"""This is a triple-quoted string
and it can contain multiple lines"""
```

Multi-line strings are useful for typing literal bodies of text where new lines should be interpretted literally. In fact, the only escape sequence used is `\"""` and `\` is otherwise allowed unescaped. This is beneficial when writing documentation within strings which may reference the back-slash often:

```
"""
In a multi-line string \n and C:\\ are unescaped.
"""
```

The primary value of multi-line strings are to write long-form input directly in query text, in tools like GraphiQL, and as a prerequisite to another pending RFC to allow docstring style documentation in the Schema Definition Language.

Ref: graphql/graphql-js#926
ref: graphql/graphql-js#f9e67c403a4667372684ee8c3e82e1f0ba27031b
@danez danez closed this Feb 9, 2018
@danez danez deleted the 012-block-strings branch February 9, 2018 15:51
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 this pull request may close these issues.

2 participants