Custom keywords
JSONSchema allows users to define custom keywords. Would it be possible to add support for it to schemars? e.g.
#[derive(JsonSchema)]
pub struct MyStruct {
#[schemars(custom_keyword(name = "myKeyword", value = "some custom metadata"))]
pub my_int: i32,
}
would generate:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "MyStruct",
"type": "object",
"required": [
"my_int"
],
"properties": {
"my_int": {
"type": "integer",
"format": "int32",
"myKeyword": "some custom metadata")
},
},
}
This is currently possible though manual implementation. Not though the macro.
Manual implementation of struct example: #119
Use the extensions field in the SchemaObject.
Adding support for it though macros might be added, but not any time soon I expect.
I'm looking to add custom metadata to properties as well, ideally in-line with the type definition through an attribute. I'm building a configuration tool on top of json schemas and want to indicate for various properties whether they should be visible by default or only for advanced users.