Derive JsonSchema_repr (#76)

This commit is contained in:
Graham Esau 2021-03-25 22:36:28 +00:00 committed by GitHub
parent 7de2b2276f
commit 11d95b79e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 225 additions and 18 deletions

View file

@ -0,0 +1,14 @@
use schemars::{schema_for, JsonSchema_repr};
#[derive(JsonSchema_repr)]
#[repr(u8)]
enum SmallPrime {
Two = 2,
Three = 3,
Five = 5,
Seven = 7,
}
fn main() {
let schema = schema_for!(SmallPrime);
println!("{}", serde_json::to_string_pretty(&schema).unwrap());
}