xuri / xgen

XSD (XML Schema Definition) parser and Go/C/Java/Rust/TypeScript code generator
BSD 3-Clause "New" or "Revised" License
313 stars 74 forks source link

Rust: "xs:string" being results in a "char" type. #22

Closed abanduch closed 3 years ago

abanduch commented 3 years ago

Thanks for the library, I am looking at using it for Go project and its pretty useful.

Was comparing it with the Rust output, I noticed that a "xs:string" is turned into a char type since String is not in the Rust BuildinTypes pick list. I'd suggest for the time being that String is added here instead, while there may be other option more suited to different performance needs, String would be a good general use case start and not incorrect like char is.

However, this would need some additional logic on your end to map the types since https://github.com/xuri/xgen/blob/master/genRust.go#L152 is just doing a simple bool check.

xuri commented 3 years ago

Thanks for your suggestion, I have update it.