MCPcopy Create free account
hub / github.com/vektah/gqlparser / TestExtendingNonExistantTypes

Function TestExtendingNonExistantTypes

validator/validator_test.go:15–45  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13)
14
15func TestExtendingNonExistantTypes(t *testing.T) {
16 s := gqlparser.MustLoadSchema(
17 &ast.Source{Name: "graph/schema.graphqls", Input: `
18extend type User {
19 id: ID!
20}
21
22extend type Product {
23 upc: String!
24}
25
26union _Entity = Product | User
27
28extend type Query {
29 entity: _Entity
30}
31`, BuiltIn: false},
32 )
33
34 q, err := parser.ParseQuery(&ast.Source{Name: "ff", Input: `{
35 entity {
36 ... on User {
37 id
38 }
39 }
40 }`})
41 require.NoError(t, err)
42
43 require.Nil(t, validator.Validate(s, q))
44 require.Nil(t, validator.ValidateWithRules(s, q, nil))
45}
46
47func TestValidationRulesAreIndependent(t *testing.T) {
48 s := gqlparser.MustLoadSchema(

Callers

nothing calls this directly

Calls 3

ParseQueryFunction · 0.92
ValidateFunction · 0.92
ValidateWithRulesFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…