add additional properties support
This commit is contained in:
parent
d9f51681df
commit
cfd12a6306
|
@ -738,6 +738,14 @@ fn create_struct_for_definition(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some(additonal_schema) = &schema.additional_properties {
|
||||||
|
let prop_ty = schema_ref_type_name(spec, additonal_schema)?;
|
||||||
|
fields.push_str("#[serde(flatten)]\n");
|
||||||
|
fields.push_str("pub additional: std::collections::BTreeMap<String, ");
|
||||||
|
fields.push_str(&prop_ty);
|
||||||
|
fields.push_str(">,\n");
|
||||||
|
}
|
||||||
|
|
||||||
let out = format!("{docs}#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]\npub struct {name} {{\n{fields}}}\n\n");
|
let out = format!("{docs}#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]\npub struct {name} {{\n{fields}}}\n\n");
|
||||||
Ok(out)
|
Ok(out)
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,6 +249,7 @@ pub struct Schema {
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
pub _type: Option<SchemaType>,
|
pub _type: Option<SchemaType>,
|
||||||
pub properties: Option<BTreeMap<String, MaybeRef<Schema>>>,
|
pub properties: Option<BTreeMap<String, MaybeRef<Schema>>>,
|
||||||
|
pub additional_properties: Option<Box<MaybeRef<Schema>>>,
|
||||||
pub items: Option<Box<MaybeRef<Schema>>>,
|
pub items: Option<Box<MaybeRef<Schema>>>,
|
||||||
|
|
||||||
pub discriminator: Option<String>,
|
pub discriminator: Option<String>,
|
||||||
|
|
|
@ -7870,7 +7870,10 @@ pub mod structs {
|
||||||
/// required are "content_type" and "url" Required
|
/// required are "content_type" and "url" Required
|
||||||
///
|
///
|
||||||
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
|
||||||
pub struct CreateHookOptionConfig {}
|
pub struct CreateHookOptionConfig {
|
||||||
|
#[serde(flatten)]
|
||||||
|
pub additional: std::collections::BTreeMap<String, String>,
|
||||||
|
}
|
||||||
|
|
||||||
/// CreateIssueCommentOption options for creating a comment on an issue
|
/// CreateIssueCommentOption options for creating a comment on an issue
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in a new issue