You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Schema parsed by gqlparser does not consider newlines in the multiline descriptions and thus line numbers are off if there are multi-line descriptions present in the schema.
Code to reproduce the issue
package main
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/vektah/gqlparser/v2/ast"
"github.com/vektah/gqlparser/v2/parser"
)
func TestSchemaParser(t *testing.T) {
t.Run("schema without description", func(t *testing.T) {
schema, parseErr := parser.ParseSchema(&ast.Source{
Input: `type User {
name: String!
}
type query {
me: User!
}
`,
})
assert.Nil(t, parseErr)
assert.Equal(t, schema.Definitions.ForName("query").Position.Line, 4)
})
t.Run("schema with single line description", func(t *testing.T) {
schema, parseErr := parser.ParseSchema(&ast.Source{
Input: `type User {
name: String!
}
"""some description"""
type query {
me: User!
}
`,
})
assert.Nil(t, parseErr)
assert.Equal(t, schema.Definitions.ForName("query").Position.Line, 5)
})
t.Run("schema with multi-line description", func(t *testing.T) {
schema, parseErr := parser.ParseSchema(&ast.Source{
Input: `type User {
name: String!
}
"""
some
description
"""
type query {
me: User!
}
`,
})
assert.Nil(t, parseErr)
assert.Equal(t, schema.Definitions.ForName("query").Position.Line, 8)
})
}
Test schema with multi-line description should not fail.
The text was updated successfully, but these errors were encountered:
Schema parsed by gqlparser does not consider newlines in the multiline descriptions and thus line numbers are off if there are multi-line descriptions present in the schema.
Code to reproduce the issue
Test
schema with multi-line description
should not fail.The text was updated successfully, but these errors were encountered: