Print description of enum and input for GraphQL (#3633)

master
Lucas Duailibe 2018-01-03 01:29:11 -03:00 committed by GitHub
parent 5356db0e69
commit 6a953e47b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 72 additions and 0 deletions

View File

@ -374,6 +374,8 @@ function genericPrint(path, options, print) {
case "EnumValueDefinition": {
return concat([
path.call(print, "description"),
n.description ? hardline : "",
path.call(print, "name"),
printDirectives(path, print, n)
]);
@ -381,6 +383,8 @@ function genericPrint(path, options, print) {
case "InputValueDefinition": {
return concat([
path.call(print, "description"),
n.description ? (n.description.block ? hardline : line) : "",
path.call(print, "name"),
": ",
path.call(print, "type"),

View File

@ -29,6 +29,26 @@ of the \`one\` field.
"""
one: Type
}
type Foo {
q("docs" field: String): Type
q("A long string of description of the field parameter to make this break" field: String): Type
q("""docs""" field: String): Type
}
enum Enum {
"""
Description of \`one\`
"""
one
}
input Input {
"""
Description of \`one\`
"""
one: string
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
query X($a: Int) @relay(meta: "{\\"lowPri\\": true}") {
a
@ -65,4 +85,32 @@ type Foo {
one: Type
}
type Foo {
q("docs" field: String): Type
q(
"A long string of description of the field parameter to make this break"
field: String
): Type
q(
"""
docs
"""
field: String
): Type
}
enum Enum {
"""
Description of \`one\`
"""
one
}
input Input {
"""
Description of \`one\`
"""
one: string
}
`;

View File

@ -26,3 +26,23 @@ of the `one` field.
"""
one: Type
}
type Foo {
q("docs" field: String): Type
q("A long string of description of the field parameter to make this break" field: String): Type
q("""docs""" field: String): Type
}
enum Enum {
"""
Description of `one`
"""
one
}
input Input {
"""
Description of `one`
"""
one: string
}