Given
{
"title": "hello",
"type": "array",
"minItems": 1,
"uniqueItems": true
}
cargo-typify 0.0.13 errors:
% cargo typify other.json
Error:
0: Failed to convert JSON Schema to Rust code
1: Schema conversion failed
2: schema invalid: unhandled array validation ArrayValidation {
items: None,
additional_items: None,
max_items: None,
min_items: Some(
1,
),
unique_items: Some(
true,
),
contains: None,
}
...
In the latest JSON Schema spec (2020-12 Core),
Omitting [items] has the same assertion behavior as an empty schema.
typify does do something reasonable when adding an "items": {} to the schema: it generates a struct like
pub struct Hello(pub Vec<serde_json::Value>);
(arguably the minimum reasonable data structure would be something like a Vec<serde_json::Value>, but not sure if typify should try to be that clever)
Given
{ "title": "hello", "type": "array", "minItems": 1, "uniqueItems": true }cargo-typify 0.0.13 errors:
In the latest JSON Schema spec (2020-12 Core),
typify does do something reasonable when adding an
"items": {}to the schema: it generates a struct like(arguably the minimum reasonable data structure would be something like a
Vec<serde_json::Value>, but not sure if typify should try to be that clever)