schemars
schemars copied to clipboard
Generate JSON Schema documents from Rust code
Consider the below code: ```rust #[macro_use] extern crate validator_derive; extern crate validator; #[macro_use] extern crate serde_derive; extern crate serde_json; use schemars::{schema_for, JsonSchema}; #[derive(Debug, Validate, Deserialize, Default, JsonSchema)] #[serde(default)] struct Preference...
Supersedes https://github.com/GREsau/schemars/pull/162 Docs still need updating
progenitor is a rust based tool to generate clients from openapi specifications The problem is when a struct has a field like this: ``` #[schemars(range(min = 400, max = 599))]...
Sometimes user wants not to override schema generation, but to post-process it. One possible case is to add non-standard extensions, e.g. `x-kubernetes-validations` extension can be used to CustomResourceDefinition-s to add...
serde(into=AnotherType) makes serde converts the type to AnotherType and then serializes AnotherType. Currently, schemars basically ignores that attribute and emits a schema matching the original type. This is the behavior...
Would it be possible to add support for the smartstring types ? https://docs.rs/smartstring/latest/smartstring/
Signed-off-by: Randy Barlow
Depends on https://github.com/GREsau/schemars/issues/168
Ideally, this should compile as-is, but it currently requires a `#[schemars(bound = "T::Item: JsonSchema")]` attribute: ```rust struct MyIterator; impl Iterator for MyIterator { type Item = String; fn next(&mut self)...
This updates schemars_derive to use syn 2.0 and serde_derive_internals as much of crate ecosystem has moved from syn 1.0 and it's best to avoid duplicate dependencies, especially in proc macros....