0.2.12 • Published 8 months ago

@sap-ux/annotation-generator v0.2.12

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
8 months ago

Fiori Annotation Generator API

Reads annotations for a service in a SAP Fiori Elements project with local metadata. Allows generation of annotations for generation of new Fiori Elements apps.

Installation

Npm
npm install --save @sap-ux/annotation-generator

Yarn
yarn add @sap-ux/annotation-generator

Pnpm
pnpm add @sap-ux/annotation-generator

Usage

Annotation generation example with SAP CAP CDS project:

import { join } from 'path';
import { create as createStore } from 'mem-fs';
import { create as createEditor } from 'mem-fs-editor';
import type { Editor } from 'mem-fs-editor';

import { getProject } from '@sap-ux/project-access';

import type { AnnotationServiceParameters, GenerateAnnotationsOptions } from '@sap-ux/annotation-generator';
import { generateAnnotations} from '@sap-ux/annotation-generator';

const project = await getProject(projectRootFolder);
const fs = createEditor(createStore());

const appName = 'app/project1';
const serviceParameters: AnnotationServiceParameters = {
    project,
    serviceName: 'MainService',
    appName
};

const options: GenerateAnnotationsOptions = {
    entitySetName: 'Capex',
    annotationFilePath: join(appName, 'annotations.cds'),
    addValueHelps: true,
    addFacets: true,
    addLineItems: true
};
await generateAnnotations(fs, serviceParameters, options);

Annotation generation example with standalone UI project and OData backend:

import { join } from 'path';
import { create as createStore } from 'mem-fs';
import { create as createEditor } from 'mem-fs-editor';
import type { Editor } from 'mem-fs-editor';

import { getProject } from '@sap-ux/project-access';

import type { AnnotationServiceParameters, GenerateAnnotationsOptions } from '@sap-ux/annotation-generator';
import { generateAnnotations} from '@sap-ux/annotation-generator';

const project = await getProject(projectRootFolder);
const fs = createEditor(createStore());

const serviceParameters: AnnotationServiceParameters = {
    project,
    serviceName: 'mainService',
};

const options: GenerateAnnotationsOptions = {
    entitySetName: 'Individual',
    annotationFilePath: join('webapp', 'annotations', 'annotation.xml'),
    addValueHelps: true,
    addFacets: true,
    addLineItems: true
};
await generateAnnotations(fs, serviceParameters, options);

Keywords

OData annotations, app generation

0.2.12

8 months ago

0.2.11

8 months ago

0.2.10

8 months ago

0.2.9

8 months ago

0.2.8

8 months ago

0.2.7

8 months ago

0.2.6

8 months ago

0.2.5

9 months ago

0.2.3

9 months ago

0.2.4

9 months ago

0.1.31

9 months ago

0.2.1

9 months ago

0.2.0

9 months ago

0.2.2

9 months ago

0.1.30

9 months ago

0.1.28

10 months ago

0.1.29

10 months ago

0.1.27

10 months ago

0.1.26

10 months ago

0.1.25

10 months ago

0.1.24

10 months ago

0.1.23

10 months ago

0.1.22

10 months ago

0.1.21

10 months ago

0.1.20

11 months ago

0.1.18

11 months ago

0.1.17

11 months ago

0.1.15

11 months ago

0.1.14

11 months ago

0.1.13

11 months ago

0.1.12

11 months ago

0.1.11

11 months ago

0.1.10

11 months ago

0.1.9

11 months ago

0.1.7

11 months ago

0.1.6

11 months ago

0.1.5

11 months ago

0.1.4

11 months ago

0.1.2

11 months ago

0.1.1

12 months ago

0.1.0

12 months ago