-
Notifications
You must be signed in to change notification settings - Fork 102
Description
When defining a JSON Schema that combines prefixItems, items: false, and a default value for an array, and referencing it via $ref, the library fails to process the schema.
The schema is valid according to JSON Schema 2020-12, but triggers an internal error in the library.
Removing any one of these three elements prevents the bug.
Steps to Reproduce
Original schema causing the bug: schema_cat.json
Minimal schema that still triggers the bug:
{
"$defs": {
"T": {
"type": "object",
"properties": {
"x": {
"type": "array",
"prefixItems": [
{ "type": "integer" }
],
"items": false,
"default": [0]
}
}
}
},
"$ref": "#/$defs/T"
}This works correctly (no error) when $ref is not used:
{
"type": "object",
"properties": {
"x": {
"type": "array",
"prefixItems": [
{ "type": "integer" }
],
"items": false,
"default": [0]
}
}
}Using typify::import_types! and passing in either schema fails at comptime with error: value does not conform to the given schema.
Expected Behavior
The library should correctly parse the schema and validate default values.
Observed Behavior
The library throws an error or fails to process the schema when all three conditions (prefixItems, items: false, default) are present and used via $ref.
Environment
- typify 0.5.0
- rustc 1.92.0
I think that's all I could find out via my testing, let me know if anything else could be of use in debugging this.