schemars
schemars copied to clipboard
Generate JSON Schema documents from Rust code
For the following code: ```Rust #[derive(Serialize, Deserialize, JsonSchema)] pub struct Team { /// # Users /// A list of users. #[schemars(regex(pattern = r"^(.*)$"))] pub users: Vec } ``` This is...
I was excited to see the new validation arriving in 0.8.4, as I was hoping that I could get rid of some hand-written parts in my own code. But I...
Hi, On my api ( https://github.com/megametres/recettes-api ) after upgrading schemars ( from 0.7.6 to 0.8.3 ), I received the following error: `error[E0277]: the trait bound `model_input_url::InputUrl: rocket_okapi::JsonSchema` is not satisfied...
I'm using the function [`json_schema`](https://docs.rs/schemars/0.8.3/schemars/trait.JsonSchema.html#tymethod.json_schema) and it returns a `$ref` while explicitly stating it should not do this. This happens when `Option` is used. I think this happens [here](https://github.com/GREsau/schemars/blob/55b860428e4526ef34886cb877af58256de6b046/schemars/src/json_schema_impls/core.rs#L38:L44). I'm...
With `#[serde(untagged)]`, variant names to not appear in the JSON Schema. It seems reasonable to include that data in the metadata.
It would be useful to be able to annotate a container with something like `#[schemars(extension = "x-foo-bar")]` and have those values appear in SchemaObject::extensions. I'd be happy to submit a...
I use schemars to generate schema but the generated schema cannot be validated by ajv, https://github.com/ajv-validator/ajv
Currently internally tagged enums are converted to an any_of of all possible variants and each of these variants gets a field for the tag with one possible value. For validation...
Adds a `JsonSchema` implementation for `MacAddress` from the [mac_address crate](https://crates.io/crates/mac_address).
Adds `JsonSchema` implementations for `IpNetwork`, `Ipv4Network` and `Ipv6Network` from the [ipnetwork crate](https://crates.io/crates/ipnetwork).