@sap-ux/odata-annotation-core-types
TypeScript icon, indicating that this package has built-in type declarations

0.3.1 • Public • Published

OData Annotation Core Types

Package containing common types for working with OData annotations.

Installation

Npm npm install --save @sap-ux/odata-annotation-core-types

Yarn yarn add @sap-ux/odata-annotation-core-types

Pnpm pnpm add @sap-ux/odata-annotation-core-types

Usage

Annotation file creation

import {
    createElementNode,
    createTarget,
    createReference,
    createNamespace,
    AnnotationFile,
    Target,
    Reference,
    Element
} from '@sap-ux/odata-annotations-core-types';

const file: AnnotationFile = {
    uri: 'annotations.xml',
    type: 'annotation-file',
    namespace: createNamespace('MyNameSpace'),
    references: [],
    targets: []
};

const reference: Reference = createReference(
    'com.sap.vocabularies.UI.v1',
    'UI',
    'https://sap.github.io/odata-vocabularies/vocabularies/UI.xml'
);
file.references.push(reference);

const target: Target = createTarget('MyNamespace.MyEntityType');

const term: Element = createElementNode({
    name: 'UI.LineItem',
    attributes: {
        Qualifier: {
            name: 'Qualifier',
            type: 'attribute',
            value: 'mainList'
        }
    },
    content: [{ type: 'element', name: 'Collection', attributes: {}, content: [] }]
});
target.terms.push(term);
file.targets.push(target);

For other usage examples see unit tests in odata-annotation-core-types/test.

Keywords

SAP ODATA annotations

Readme

Keywords

none

Package Sidebar

Install

npm i @sap-ux/odata-annotation-core-types

Weekly Downloads

2

Version

0.3.1

License

Apache-2.0

Unpacked Size

99.7 kB

Total Files

59

Last publish

Collaborators

  • sap_extncrepos
  • kranthie.sap
  • tqueck