Came across the below example via a bug report filed by @akashjain971.
Essentially when you alter GraphQL schema via /alter
endpoint, the corresponding types and fields are not kept in-sync.
Example:
Schema:
type Test{
id: ID!
name: String!
marks: Int!
}
type Person{
name: String!
age: Int!
class: String!
}
query – schema { __typename }
Result:
"data": {
"schema": [
{
"predicate": "Person.age"
},
{
"predicate": "Person.class"
},
{
"predicate": "Person.name"
},
{
"predicate": "Test.marks"
},
{
"predicate": "Test.name"
},
],
"types": [
{
"fields": [
{
"name": "Person.name"
},
{
"name": "Person.age"
},
{
"name": "Person.class"
}
],
"name": "Person"
},
{
"fields": [
{
"name": "Test.name"
},
{
"name": "Test.marks"
}
],
"name": "Test"
},
]
},
After dropping via {"drop_attr": "Test.marks"}
on /alter
, schema becomes:
"data": {
"schema": [
{
"predicate": "Person.age"
},
{
"predicate": "Person.class"
},
{
"predicate": "Person.name"
},
{
"predicate": "Test.name"
},
],
"types": [
{
"fields": [
{
"name": "Person.name"
},
{
"name": "Person.age"
},
{
"name": "Person.class"
}
],
"name": "Person"
},
{
"fields": [
{
"name": "Test.name"
},
{
"name": "Test.marks"
}
],
"name": "Test"
},
]
},
After dropping a type in the original schema via {"drop_op": "TYPE", "drop_value": "Person"}
schema becomes:
"data": {
"schema": [
{
"predicate": "Person.age"
},
{
"predicate": "Person.class"
},
{
"predicate": "Person.name"
},
{
"predicate": "Test.marks"
},
{
"predicate": "Test.name"
},
],
"types": [
{
"fields": [
{
"name": "Test.name"
},
{
"name": "Test.marks"
}
],
"name": "Test"
},
]
},