Prevent possibility of infinite loop
This commit is contained in:
parent
b9e9360b5c
commit
d7a214526f
1 changed files with 5 additions and 1 deletions
|
@ -149,7 +149,7 @@ impl SchemaGenerator {
|
|||
}
|
||||
|
||||
pub fn get_schema_object(&self, mut schema: Schema) -> Result<SchemaObject> {
|
||||
loop {
|
||||
for _ in 0..100 {
|
||||
match schema {
|
||||
Schema::Object(obj) => return Ok(obj),
|
||||
Schema::Bool(true) => return Ok(Default::default()),
|
||||
|
@ -189,5 +189,9 @@ impl SchemaGenerator {
|
|||
}
|
||||
}
|
||||
}
|
||||
Err(JsonSchemaError::new(
|
||||
"Failed to dereference schema after 100 iterations - reference may be cyclic.",
|
||||
schema,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue