graphql-php/tests/Language/kitchen-sink-noloc.ast
Daniel Tschinder 8747ff8954 RFC: Block String
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
2018-02-10 18:43:26 +01:00

651 lines
31 KiB
Plaintext

{
"kind": "Document",
"definitions": [
{
"kind": "OperationDefinition",
"name": {
"kind": "Name",
"value": "queryName"
},
"operation": "query",
"variableDefinitions": [
{
"kind": "VariableDefinition",
"variable": {
"kind": "Variable",
"name": {
"kind": "Name",
"value": "foo"
}
},
"type": {
"kind": "NamedType",
"name": {
"kind": "Name",
"value": "ComplexType"
}
}
},
{
"kind": "VariableDefinition",
"variable": {
"kind": "Variable",
"name": {
"kind": "Name",
"value": "site"
}
},
"type": {
"kind": "NamedType",
"name": {
"kind": "Name",
"value": "Site"
}
},
"defaultValue": {
"kind": "EnumValue",
"value": "MOBILE"
}
}
],
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "node"
},
"alias": {
"kind": "Name",
"value": "whoever123is"
},
"arguments": [
{
"kind": "Argument",
"value": {
"kind": "ListValue",
"values": [
{
"kind": "IntValue",
"value": "123"
},
{
"kind": "IntValue",
"value": "456"
}
]
},
"name": {
"kind": "Name",
"value": "id"
}
}
],
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "id"
},
"arguments": [],
"directives": []
},
{
"kind": "InlineFragment",
"typeCondition": {
"kind": "NamedType",
"name": {
"kind": "Name",
"value": "User"
}
},
"directives": [
{
"kind": "Directive",
"name": {
"kind": "Name",
"value": "defer"
},
"arguments": []
}
],
"selectionSet": {
"kind": "SelectionSet",
"selections": [
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "field2"
},
"arguments": [],
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "id"
},
"arguments": [],
"directives": []
},
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "field1"
},
"alias": {
"kind": "Name",
"value": "alias"
},
"arguments": [
{
"kind": "Argument",
"value": {
"kind": "IntValue",
"value": "10"
},
"name": {
"kind": "Name",
"value": "first"
}
},
{
"kind": "Argument",
"value": {
"kind": "Variable",
"name": {
"kind": "Name",
"value": "foo"
}
},
"name": {
"kind": "Name",
"value": "after"
}
}
],
"directives": [
{
"kind": "Directive",
"name": {
"kind": "Name",
"value": "include"
},
"arguments": [
{
"kind": "Argument",
"value": {
"kind": "Variable",
"name": {
"kind": "Name",
"value": "foo"
}
},
"name": {
"kind": "Name",
"value": "if"
}
}
]
}
],
"selectionSet": {
"kind": "SelectionSet",
"selections": [
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "id"
},
"arguments": [],
"directives": []
},
{
"kind": "FragmentSpread",
"name": {
"kind": "Name",
"value": "frag"
},
"directives": []
}
]
}
}
]
}
}
]
}
},
{
"kind": "InlineFragment",
"directives": [
{
"kind": "Directive",
"name": {
"kind": "Name",
"value": "skip"
},
"arguments": [
{
"kind": "Argument",
"value": {
"kind": "Variable",
"name": {
"kind": "Name",
"value": "foo"
}
},
"name": {
"kind": "Name",
"value": "unless"
}
}
]
}
],
"selectionSet": {
"kind": "SelectionSet",
"selections": [
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "id"
},
"arguments": [],
"directives": []
}
]
}
},
{
"kind": "InlineFragment",
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "id"
},
"arguments": [],
"directives": []
}
]
}
}
]
}
}
]
}
},
{
"kind": "OperationDefinition",
"name": {
"kind": "Name",
"value": "likeStory"
},
"operation": "mutation",
"variableDefinitions": [],
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "like"
},
"arguments": [
{
"kind": "Argument",
"value": {
"kind": "IntValue",
"value": "123"
},
"name": {
"kind": "Name",
"value": "story"
}
}
],
"directives": [
{
"kind": "Directive",
"name": {
"kind": "Name",
"value": "defer"
},
"arguments": []
}
],
"selectionSet": {
"kind": "SelectionSet",
"selections": [
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "story"
},
"arguments": [],
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "id"
},
"arguments": [],
"directives": []
}
]
}
}
]
}
}
]
}
},
{
"kind": "OperationDefinition",
"name": {
"kind": "Name",
"value": "StoryLikeSubscription"
},
"operation": "subscription",
"variableDefinitions": [
{
"kind": "VariableDefinition",
"variable": {
"kind": "Variable",
"name": {
"kind": "Name",
"value": "input"
}
},
"type": {
"kind": "NamedType",
"name": {
"kind": "Name",
"value": "StoryLikeSubscribeInput"
}
}
}
],
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "storyLikeSubscribe"
},
"arguments": [
{
"kind": "Argument",
"value": {
"kind": "Variable",
"name": {
"kind": "Name",
"value": "input"
}
},
"name": {
"kind": "Name",
"value": "input"
}
}
],
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "story"
},
"arguments": [],
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "likers"
},
"arguments": [],
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "count"
},
"arguments": [],
"directives": []
}
]
}
},
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "likeSentence"
},
"arguments": [],
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "text"
},
"arguments": [],
"directives": []
}
]
}
}
]
}
}
]
}
}
]
}
},
{
"kind": "FragmentDefinition",
"name": {
"kind": "Name",
"value": "frag"
},
"typeCondition": {
"kind": "NamedType",
"name": {
"kind": "Name",
"value": "Friend"
}
},
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "foo"
},
"arguments": [
{
"kind": "Argument",
"value": {
"kind": "Variable",
"name": {
"kind": "Name",
"value": "size"
}
},
"name": {
"kind": "Name",
"value": "size"
}
},
{
"kind": "Argument",
"value": {
"kind": "Variable",
"name": {
"kind": "Name",
"value": "b"
}
},
"name": {
"kind": "Name",
"value": "bar"
}
},
{
"kind": "Argument",
"value": {
"kind": "ObjectValue",
"fields": [
{
"kind": "ObjectField",
"name": {
"kind": "Name",
"value": "key"
},
"value": {
"kind": "StringValue",
"value": "value",
"block": false
}
},
{
"kind": "ObjectField",
"name": {
"kind": "Name",
"value": "block"
},
"value": {
"kind": "StringValue",
"value": "block string uses \"\"\"",
"block": true
}
}
]
},
"name": {
"kind": "Name",
"value": "obj"
}
}
],
"directives": []
}
]
}
},
{
"kind": "OperationDefinition",
"operation": "query",
"variableDefinitions": [],
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "unnamed"
},
"arguments": [
{
"kind": "Argument",
"value": {
"kind": "BooleanValue",
"value": true
},
"name": {
"kind": "Name",
"value": "truthy"
}
},
{
"kind": "Argument",
"value": {
"kind": "BooleanValue",
"value": false
},
"name": {
"kind": "Name",
"value": "falsey"
}
},
{
"kind": "Argument",
"value": {
"kind": "NullValue"
},
"name": {
"kind": "Name",
"value": "nullish"
}
}
],
"directives": []
},
{
"kind": "Field",
"name": {
"kind": "Name",
"value": "query"
},
"arguments": [],
"directives": []
}
]
}
}
]
}