Closed JakkuSakura closed 2 months ago
That schema doesn't seem to correspond to those type definitions at all.
Sorry. I pasted the wrong rust type. I've updated the example
Fwiw, it looks like a workaround for now is to add #[schemars(deny_unknown_fields)]
to MyStruct
.
This is fixed in schemars 1.0.0-alpha.6 (and I think earlier alphas) - the output from the repro is now:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "MyStruct",
"type": "object",
"properties": {
"values": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"additionalProperties": {
"type": "string"
},
"required": [
"values"
]
}