-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
During some testing on the lib we've faced 2 problems:
Schema example:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="ComplexElement">
<xs:sequence>
<xs:element name="Element" minOccurs="0">
<xs:annotation>
<xs:documentation>Some annotation</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="info" type="xs:string" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="attrib" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
The first problem is compilation errors for the above schema:
error: proc-macro derive panicked
--> src/main.rs:11:17
|
11 | #[derive(Debug, XmlSchema)]
| ^^^^^^^^^
|
= help: message: not implemented
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `Element: YaDeserialize` is not satisfied
--> src/main.rs:11:17
|
11 | #[derive(Debug, XmlSchema)]
| ^^^^^^^^^ the trait `YaDeserialize` is not implemented for `Element`
|
|
101 | fn deserialize<R: Read>(reader: &mut de::Deserializer<R>) -> Result<Self, String>;
| ---- required by this bound in `deserialize`
|
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
Another problem seems it ignores attributes for complex types. For the schema above if I set store_generated_code
, I see the following output:
#[derive(Clone, Debug, Default, PartialEq, YaDeserialize, YaSerialize)]
pub struct ComplexElement
{
#[yaserde(rename = "Element")]
pub element : Option < Element >,
}
#[doc = "Some annotation"]
#[derive(Clone, Debug, Default, PartialEq, YaDeserialize, YaSerialize)]
pub struct Element
{
#[yaserde(rename = "info")]
pub infos : Option < Vec < String > >,
}
There is no attribute attrib
in Element
.
Also, I've found this problem in the existing test (https://github.com/media-io/xml-schema/blob/master/xml_schema/tests/complex_type.rs): attribute scope
is missing.
Metadata
Metadata
Assignees
Labels
No labels