Remove usages of gen
identifier (#323)
`gen` is a reserved keyword in rust 2024, making it very awkward to use as a module/variable name.
This commit is contained in:
parent
8142be1ea2
commit
b4f214f6dc
42 changed files with 186 additions and 171 deletions
|
@ -19,8 +19,8 @@ pub struct MyStruct {
|
|||
pub bool_normal: bool,
|
||||
}
|
||||
|
||||
fn make_custom_schema(gen: &mut SchemaGenerator) -> Schema {
|
||||
let mut schema = String::json_schema(gen);
|
||||
fn make_custom_schema(generator: &mut SchemaGenerator) -> Schema {
|
||||
let mut schema = String::json_schema(generator);
|
||||
schema
|
||||
.ensure_object()
|
||||
.insert("format".into(), "boolean".into());
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use schemars::{gen::SchemaSettings, JsonSchema};
|
||||
use schemars::{generate::SchemaSettings, JsonSchema};
|
||||
|
||||
#[derive(JsonSchema)]
|
||||
pub struct MyStruct {
|
||||
|
@ -18,7 +18,7 @@ fn main() {
|
|||
s.option_nullable = true;
|
||||
s.option_add_null_type = false;
|
||||
});
|
||||
let gen = settings.into_generator();
|
||||
let schema = gen.into_root_schema_for::<MyStruct>();
|
||||
let generator = settings.into_generator();
|
||||
let schema = generator.into_root_schema_for::<MyStruct>();
|
||||
println!("{}", serde_json::to_string_pretty(&schema).unwrap());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue