odata2ts
If you use TypeScript and need to interact with an OData service, then odata2ts might
be for you. It centers around the generation of TypeScript artefacts
out of readily available metadata descriptions of given OData services.
With the help of odata2ts you can:
- generate tailor-made TypeScript model interfaces for entities, complex types and what not
- generate a full-fledged, domain-savvy OData client supporting type-safe queries, CRUD operations and more
- support for OData V2 and V4
- generation of compiled JS / DTS or (prettified) TypeScript files
- allows for handling multiple OData services
- TypeScript based configuration file
- powerful, type-safe and fluent query builder
- use existing or own converters to interact with data types of your choice
- allows for name mappings of attributes
Documentation
Main documentation for the odata2ts eco system: https://odata2ts.github.io
Testing Strategy
- Unit tests cover the generator and the runtime packages themselves
int-test/clicovers the generation run: argument parsing, config discovery, service selectionint-test/config-variantsgenerates the same model under a set of configurations and type-checks the resultint-test/asp-net,int-test/capandint-test/olingo-v2run generated clients against real OData servers
odata2ts has quite some few configuration options, it becomes relevant to distinguish between 3 (cheap)
and 4 (expensive) and where an option takes effect is the decisive factor of how it is tested:
- options that only shape the generated code are type checked only
- options that rename properties, change the value (type converter), URL or payload, are tested against a running server
- ASP.NET Core: Feature rich, probably most spec compliant, Microsoft backed and V4 only
- SAP CAP: Feature rich, with fast development cycles, v4 based, diverges from OData spec, especially composition over inheritance
- Apache Olingo 2: Stable and actually archived already, but maybe the only viable V2 server to be easily containerizeds
Support, Feedback, Contributing
This project is open to bug reports and feature requests via GitHub issues. For suggestions, usage questions and everything else via GitHub Discussions.
Contributions and feedback are welcome.
See the contribution guidelines for further information.
Spirit
This project has been created and is maintained in the following spirit:
- abstract away OData implementation details where possible
- must be easy to use
- strive for the same API regarding V2 and V4 while favouring the latter
- adhere to the OData specification as much as possible
- stability matters
License
MIT - see License.