I was wondering that how can we handle Runtime polymorphism in Graphql Schema file,
@Data
class Parent {
String libraryName;
}
@Data
class Child extends Parent {
String bookName;
}
Test class=>
class Test {
String id;
Child childObj;
}
Now in normal case Runtime polymorphism will happen and Test.Child will be initialized with Parent class object i.e. Parent prnt = new Child();
e.g. Schema.graphqls
type Test{
id: String!
childObj: Child // Cant assign Parent object
}
// This doesn't work
type Child {
bookName: String
libraryName: String
}
type Parent {
bookName: String
libraryName: String
}
But in GraphQl Schema file how to mention it ?