add additional properties support
This commit is contained in:
		
							parent
							
								
									d9f51681df
								
							
						
					
					
						commit
						cfd12a6306
					
				
					 3 changed files with 13 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -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");
 | 
			
		||||
    Ok(out)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -249,6 +249,7 @@ pub struct Schema {
 | 
			
		|||
    #[serde(rename = "type")]
 | 
			
		||||
    pub _type: Option<SchemaType>,
 | 
			
		||||
    pub properties: Option<BTreeMap<String, MaybeRef<Schema>>>,
 | 
			
		||||
    pub additional_properties: Option<Box<MaybeRef<Schema>>>,
 | 
			
		||||
    pub items: Option<Box<MaybeRef<Schema>>>,
 | 
			
		||||
 | 
			
		||||
    pub discriminator: Option<String>,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7870,7 +7870,10 @@ pub mod structs {
 | 
			
		|||
    /// required are "content_type" and "url" Required
 | 
			
		||||
    ///
 | 
			
		||||
    #[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
 | 
			
		||||
    ///
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue