Package Exports
- @elevatory/odata-typify-middleware
Readme
OData Typify Middleware
This middleware is used to extract Type information of Metadata-Calls.
Installation
npm install -g @elevatory/odata-typify-middleware
Usage
Include the middleware in the ui5.yaml.
The middleware needs to run before middleware compression
No further configuration is needed
ui5.yaml
add the middleware in the server part under customMiddleware. Example:
server:
customMiddleware:
- name: "@elevatory/odata-typify-middleware"
beforeMiddleware: compressionpackage.json
Remember to also include it in your package.json under the ui5 dependencies
"ui5": {
"dependencies": [
"@elevatory/odata-typify-middleware"
]
}Trigger the middleware
Start your application with ui5 serve.
As soon as the tooling fetches the metadata-document from the server, the types will be parsed and the type files will be created.
If this does not happen, hold ctrl and click on the refresh button in the browser as the metadata-call might be cached and not triggering the middleware.
Types
The types will be created under the project root in a folder /src/types
The naming will be servicename.metadata.ts
Create types on demand
Run the command npx odata-typify to create types on demand.
You need to enter the username and password.
The types will be created based on the odata models provided in manifest.json and url in ui5.yaml for ui5-middleware-route-proxy