diff --git a/codegen/templates/templates.go b/codegen/templates/templates.go index d6ae6a95b82..fa3a7507e3a 100644 --- a/codegen/templates/templates.go +++ b/codegen/templates/templates.go @@ -87,7 +87,7 @@ func ToCamel(s string) string { } func rawQuote(s string) string { - return "`" + strings.Replace(s, "'", "`+\"`\"+`", -1) + "`" + return "`" + strings.Replace(s, "`", "`+\"`\"+`", -1) + "`" } func dump(val interface{}) string { diff --git a/example/starwars/generated.go b/example/starwars/generated.go index acd581f32c3..775ae7e56d3 100644 --- a/example/starwars/generated.go +++ b/example/starwars/generated.go @@ -2304,7 +2304,7 @@ type Human implements Character { height(unit: LengthUnit = METER): Float! # Mass in kilograms, or null if unknown mass: Float - # This human` + "`" + `s friends, or an empty list if they have none + # This human's friends, or an empty list if they have none friends: [Character] # The friends of the human exposed as a connection with edges friendsConnection(first: Int, after: ID): FriendsConnection! @@ -2319,27 +2319,27 @@ type Droid implements Character { id: ID! # What others call this droid name: String! - # This droid` + "`" + `s friends, or an empty list if they have none + # This droid's friends, or an empty list if they have none friends: [Character] # The friends of the droid exposed as a connection with edges friendsConnection(first: Int, after: ID): FriendsConnection! # The movies this droid appears in appearsIn: [Episode!]! - # This droid` + "`" + `s primary function + # This droid's primary function primaryFunction: String } -# A connection object for a character` + "`" + `s friends +# A connection object for a character's friends type FriendsConnection { # The total number of friends totalCount: Int! - # The edges for each of the character` + "`" + `s friends. + # The edges for each of the character's friends. edges: [FriendsEdge] # A list of the friends, as a convenience when edges are not needed. friends: [Character] # Information for paginating this connection pageInfo: PageInfo! } -# An edge object for a character` + "`" + `s friends +# An edge object for a character's friends type FriendsEdge { # A cursor used for pagination cursor: ID! diff --git a/test/generated.go b/test/generated.go index de21730f4cb..7967281bbf2 100644 --- a/test/generated.go +++ b/test/generated.go @@ -1225,4 +1225,6 @@ type Query { date(filter: DateFilter!): Boolean! viewer: Viewer } + +// this is a comment with a ` + "`" + `backtick` + "`" + ` `) diff --git a/test/schema.graphql b/test/schema.graphql index 036abdba148..9a2abd836ad 100644 --- a/test/schema.graphql +++ b/test/schema.graphql @@ -30,3 +30,5 @@ type Query { date(filter: DateFilter!): Boolean! viewer: Viewer } + +// this is a comment with a `backtick`