lumeohq / xsd-parser-rs

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

Improve enum generation #64

Closed victor-soloviev closed 4 years ago

victor-soloviev commented 4 years ago

For XSD types restricted by xs::enumeration either enum of values either String generated, depending on the presense of special characters in the enumeration values.

Turns out that ONVIF contain a lot of enumeration values with a hyphen:

<xs:simpleType name="StreamType">
    <xs:restriction base="xs:string">
        <xs:enumeration value="RTP-Unicast"/>
        <xs:enumeration value="RTP-Multicast"/>
    </xs:restriction>
</xs:simpleType>

Would be nice to have this type as enum (with values sanitiesed of hyphen) rather than just a String.

To achieve it, we need to make our enumeration processing more intelegent.