JayData.org

JayStack OData V4 Server – Type Definitions and Enums

Author: Viktor Lazar September 5th, 2017


In the brand new version of odata-v4-server (0.2.0) OData standard Type Definitions and Enums are now supported. Type Definitions are type aliases which are mapping your custom type implementations to standard OData Edm types. The best use case currently are MongoDB ObjectIDs. You can specify, that if you use the ObjectID type, then the client will understand, that it should treat ObjectID as an Edm.String. Enums are supported through the standard TypeScript way, just by using enum definitions. To use type definitions or enums, you have to define an Edm.Container class. Let’s see how to use those new major features in details.