Today, if graphQL schema has circular reference of entities, DAB won't be able to load the schema and die with stackoverflow exception when it tries to traverse the schema.
With JSON data, it can get very complicated to handle all the scenarios with circular reference.
What is this change?
Adding a proper exception during the load, if DAB identifies that schema has circular reference.
If schema is found with circular reference, DAB will throw below exception.
DAB Exception
DataApiBuilderException(
message: $"Circular reference detected in the schema for entity '{entityType}'.",
statusCode: System.Net.HttpStatusCode.InternalServerError,
subStatusCode: DataApiBuilderException.SubStatusCodes.ErrorInInitialization);
Schema with circular reference
type Character {
id : ID,
name : String,
moons: [Moon], // Character has Moon Reference
}
type Planet @model(name:""Planet"") {
id : ID!,
name : String,
character: Character
}
type Moon {
id : ID,
name : String,
details : String,
character: Character // Moon has Character Reference
}
Why make this change?
Today, if graphQL schema has circular reference of entities, DAB won't be able to load the schema and die with stackoverflow exception when it tries to traverse the schema. With JSON data, it can get very complicated to handle all the scenarios with circular reference.
What is this change?
Adding a proper exception during the load, if DAB identifies that schema has circular reference.
If schema is found with circular reference, DAB will throw below exception.
DAB Exception
Schema with circular reference
How was this tested?