Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement quickxml support #31

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Next Next commit
Convert elements to serde
matzipan committed Dec 21, 2023
commit b44fcba9d5599b654410cedfa0a29c3629c421f4
8 changes: 4 additions & 4 deletions xml_schema_derive/src/xsd/element.rs
Original file line number Diff line number Diff line change
@@ -73,7 +73,7 @@ impl Implementation for Element {

quote! {
#docs
#[derive(Clone, Debug, Default, PartialEq, yaserde_derive::YaDeserialize, yaserde_derive::YaSerialize)]
#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
#namespace_definition
pub struct #struct_name {
#fields
@@ -121,7 +121,7 @@ impl Element {
let name = if multiple { format!("{name}s") } else { name };

let attribute_name = Ident::new(&name, Span::call_site());
let yaserde_rename = &self.name;
let rename = &self.name;

let rust_type = if let Some(complex_type) = &self.complex_type {
complex_type.get_integrated_implementation(&self.name)
@@ -166,7 +166,7 @@ impl Element {
.unwrap_or_default();

quote! {
#[yaserde(rename=#yaserde_rename #prefix_attribute)]
#[serde(rename=#rename #prefix_attribute)]
pub #attribute_name: #module#rust_type,
}
}
@@ -210,7 +210,7 @@ mod tests {
{DOCS}
{DERIVES}
pub struct Volume {{
#[yaserde(flatten)]
#[serde(flatten)]
pub content: xml_schema_types::VolumeType,
}}"#
))