lumeohq / xsd-parser-rs

A xsd/wsdl => rust code generator written in rust
Apache License 2.0
96 stars 34 forks source link

Unclear where to import xsd module from #146

Open torkleyy opened 1 year ago

torkleyy commented 1 year ago
#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)]
#[yaserde()]
pub struct Example {
    #[yaserde(attribute, rename = "Version")]
    pub version: xsd::UnsignedInt,

    #[yaserde(attribute, rename = "PlatformType")]
    pub platform_type: xsd::String,
}

I assumed these are the correct imports:

use xsd_parser::generator::validator::Validate;
use xsd_types::types as xsd;

However, the generated are not in xsd_types. Where am I supposed to import xsd from? Thank you.

lkirkwood commented 5 months ago

What was your input XSD?

Just guessing at your issue, if you had something like

<xsd:complexType name="Example">
  <xsd:element name="version" type="xsd:UnsignedInt"/>
  <xsd:element name="platform_type" type="xsd:String"/>
</xsd:complexType>

as opposed to using the built-in numeric types

<xsd:complexType name="Example">
  <xsd:element name="version" type="xsd:unsignedInt"/>
  <xsd:element name="platform_type" type="xsd:string"/>
</xsd:complexType>

then this would be the expected behaviour (I believe).