xuri / xgen

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

configurable TypeScript generators for specific xml parsers #50

Open bastiion opened 2 years ago

bastiion commented 2 years ago

Is your feature request related to a problem? Please describe.

Typescript generation come in very handy when zou try to deal with XML parsing within a typescript project. XML Parsing is typically handled by a library, which then transforms the XML in a particular JSON-like form or gives accessor functions to the data. unfortunatelly xgen generated types cannot be used out of the box for most of the commonly used parsers, without modifying the source of the xsd to typescript converter.

Describe the solution you'd like

Either separate flavours of the typescript parser could be provided or some configurability would be great in order to get type-definitions for the JS-result of common XML-parser.

Additional context For my use case, which was providing type-definitions for the gnucash XSD I was able to slightly modify the source code of the Typescript converter to get a fully typed view of a gnucash-xml, parsed by the fast-xml-parser . The result of the experiment can be seen here: https://github.com/bastiion/gnucash-xml-typescript-experiment/tree/gnucash/src/gnucash/typescript3 The modified branch of xgen can be found here https://github.com/bastiion/xgen/tree/faster-xml-parser-ts