parent
7ecaa7feab
commit
a9a9c7e8ed
3 changed files with 9 additions and 1 deletions
|
@ -161,7 +161,7 @@ pub mod metadata {
|
|||
add_metadata_fn!(add_deprecated, deprecated, bool);
|
||||
add_metadata_fn!(add_read_only, read_only, bool);
|
||||
add_metadata_fn!(add_write_only, write_only, bool);
|
||||
add_metadata_fn!(add_default, default, Value);
|
||||
add_metadata_fn!(add_default, default, Option<Value>);
|
||||
|
||||
pub fn add_examples<I: IntoIterator<Item = Value>>(schema: Schema, examples: I) -> Schema {
|
||||
let mut schema_obj = schema.into_object();
|
||||
|
|
|
@ -30,6 +30,7 @@ where
|
|||
struct MyStruct {
|
||||
my_int: i32,
|
||||
my_bool: bool,
|
||||
my_optional_string: Option<String>,
|
||||
#[serde(serialize_with = "custom_serialize")]
|
||||
my_struct2: MyStruct2,
|
||||
#[serde(
|
||||
|
|
|
@ -12,6 +12,13 @@
|
|||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"my_optional_string": {
|
||||
"default": null,
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"my_struct2": {
|
||||
"default": "i:0 b:false",
|
||||
"allOf": [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue