Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion fixtures/directiveSchemas/baseTypes.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ enum Bar {
input Input {
field: String @nullArg(stringArg: "string")
oldAttribute: String! @deprecated(reason: "reason")
}
fieldWithEscapeString: String @escapedStringArg(escapedString: "\b,\f,\n,\r,\t,...,\\,{,}")
}
3 changes: 3 additions & 0 deletions fixtures/directiveSchemas/directives.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ directive @nullArg(stringArg: String) on ENUM_VALUE | FIELD_DEFINITION | INPUT_F
"""The directives decorates unions."""
directive @nestedFooUnion on UNION
union NestedFooUnion @nestedFooUnion = NestedFoo

"""The directive accepts escaped string."""
directive @escapedStringArg(escapedString: String) on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ directive @nullArg(stringArg: String) on ENUM_VALUE | FIELD_DEFINITION | INPUT_F
"""The directives decorates unions."""
directive @nestedFooUnion on UNION

"""The directive accepts escaped string."""
directive @escapedStringArg(escapedString: String) on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION

interface BarInterface {
bar: String!
}
Expand Down Expand Up @@ -40,6 +43,7 @@ enum Bar {
input Input {
field: String
oldAttribute: String! @deprecated(reason: "reason")
fieldWithEscapeString: String
}

union NestedFooUnion = NestedFoo
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ directive @nullArg(stringArg: String) on ENUM_VALUE | FIELD_DEFINITION | INPUT_F
"""The directives decorates unions."""
directive @nestedFooUnion on UNION

"""The directive accepts escaped string."""
directive @escapedStringArg(escapedString: String) on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION

enum Bar {
MORE @multiArgAndType(stringArg: "string", booleanArg: true, intArg: 314, floatArg: 3.14, listArg: ["string"], enumArg: VALUES)
VALUES
Expand All @@ -33,6 +36,7 @@ interface FooInterface implements BarInterface {
input Input {
field: String @nullArg(stringArg: "string")
oldAttribute: String! @deprecated(reason: "reason")
fieldWithEscapeString: String @escapedStringArg(escapedString: "\b,\f,\n,\r,\t,...,\\,{,}")
}

type NestedFoo {
Expand Down
2 changes: 1 addition & 1 deletion src/printers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ function printLiteralArgumentValueNode(node: IntValueNode | FloatValueNode | Boo
}

function printStringValueNode(node: StringValueNode) {
return '"' + node.value + '"';
return JSON.stringify(node.value);
}

function printNullValueNode(node: NullValueNode) {
Expand Down