@sap-ux/annotation-converter
@sap-ux/annotation-converter
npm i @sap-ux/annotation-converter
@sap-ux/annotation-converter

@sap-ux/annotation-converter

Enable community collaboration to jointly promote and facilitate best in class framework and tooling capabilities when working with OData services.

by SAP

0.5.20 (see all)License:Apache-2.0TypeScript:Built-In
npm i @sap-ux/annotation-converter
Readme

@sap-ux/annotation-converter

Provides a way to convert a raw metadata document object into a convenient structure where path are resolved already for you.

The goal of this module is to provide an object that is ready to use and should cover most of the needs one can have when it comes to manipulating an odata service and its annotation.

All the object defined by this will be compatible with the @sap-ux/vocabularies-types providing an easy way to evaluate annotations.

Installation

npm npm install --save-dev @sap-ux/annotation-converter

yarn yarn add @sap-ux/annotation-converter --dev

pnpm pnpm add @sap-ux/annotation-converter --dev

Usage

Import the convert method from the module

import { convert } from '@sap-ux/annotation-converter';

Use it on a raw metadata generated from @sap-ux/edmx-parser or complying to the same structure

const myRawMetadata = ... 

const myConvertedMetadata = convert(myRawMetadata);
const isDraftEnabled = myConvertedMetadata.entityTypes[0].annotations.Common?.DraftRoot || myConvertedMetadata.entityTypes[0].annotations.Common?.DraftNode;
const myLabel = myConvertedMetadata.entityTypes[0].properties[0].annotations?.Common?.Text?.$target?.name // Property name of the text annotation if it exists

Keywords

Annotation Converter

Downloads/wk

7.1K

GitHub Stars

20

LAST COMMIT

7mos ago

MAINTAINERS

3

CONTRIBUTORS

5

OPEN ISSUES

3

OPEN PRs

9
VersionTagPublished
0.5.20
latest
2mos ago
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate