# @sap-ux/cds-odata-annotation-converter

> Converter for OData annotations in CDS format.

Latest version **1.1.0** (published 2026-09-22) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @sap-ux/cds-odata-annotation-converter
pnpm add @sap-ux/cds-odata-annotation-converter
yarn add @sap-ux/cds-odata-annotation-converter
bun add @sap-ux/cds-odata-annotation-converter
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2026-09-22 |
| First published | 2024-01-26 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 158 |
| Author | SAP SE |
| Maintainers | tqueck, kranthie.sap, sap_extncrepos, sap-ospo-admin, devinea |

## Links

- npm: https://www.npmjs.com/package/@sap-ux/cds-odata-annotation-converter
- Repository: https://github.com/SAP/open-ux-tools
- npm.io page: https://npm.io/package/@sap-ux/cds-odata-annotation-converter

## Recent versions

- 1.1.0 (latest) — 2026-09-22
- 1.0.11 — 2026-08-27
- 1.0.10 — 2026-08-25
- 1.0.9 — 2026-08-06
- 1.0.8 — 2026-07-23
- 1.0.7 — 2026-07-22
- 1.0.6 — 2026-07-06
- 1.0.5 — 2026-07-03
- 1.0.4 — 2026-07-03
- 1.0.3 — 2026-06-23
- 1.0.2 — 2026-06-09
- 1.0.1 — 2026-06-04
- 1.0.0 — 2026-05-30
- 0.8.1 — 2026-05-20
- 0.8.0 — 2026-05-15
- … 70 more at https://npm.io/package/@sap-ux/cds-odata-annotation-converter/versions

## README

[![Changelog](https://img.shields.io/badge/changelog-8A2BE2)](https://github.com/SAP/open-ux-tools/blob/main/packages/cds-odata-annotation-converter/CHANGELOG.md) [![Github repo](https://img.shields.io/badge/github-repo-blue)](https://github.com/SAP/open-ux-tools/tree/main/packages/cds-odata-annotation-converter)

# [CDS OData Annotation Converter](https://github.com/SAP/open-ux-tools/tree/main/packages/cds-odata-annotation-converter)

## Installation
Npm
`npm install --save @sap-ux/cds-odata-annotation-converter`

Yarn
`yarn add @sap-ux/cds-odata-annotation-converter`

Pnpm
`pnpm add @sap-ux/cds-odata-annotation-converter`

## Usage

Convert CDS `annotationAstNodes` to annotation file format from `@sap-ux/odata-annotation-core-types`.

```Typescript
import { createCdsCompilerFacade, createMetadataCollector } from '@sap/ux-cds-compiler-facade';
import { toAnnotationFile, toTargetMap  } from '@sap-ux/cds-odata-annotation-converter';
import { VocabularyService } from '@sap-ux/odata-vocabularies';

const uri = 'file://my-service.cds';
const vocabularyService = new VocabularyService(true);
const facade = createCdsCompilerFacade(compileModel);
const cdsAnnotationFile = toTargetMap(fileIndex, uri, vocabularyService, facade);
const metadataElementMap = new Map();
const metadataCollector = createMetadataCollector(metadataElementMap, facade);
const { file: annotationFile } = toAnnotationFile(
    uri,
    vocabularyService,
    cdsAnnotationFile,
    metadataCollector
);
```

Generate CDS annotation text fragment. 

```Typescript
import { print } from '@sap-ux/cds-odata-annotation-converter';
import { Edm, createElementNode, createAttributeNode } from '@sap-ux/odata-annotation-core-types';

const element = createElementNode({
    name: Edm.PropertyValue,
    attributes: {
        [Edm.Property]: createAttributeNode(Edm.Property, 'Target'),
        [Edm.AnnotationPath]: createAttributeNode(Edm.AnnotationPath, '$0')
    },
});

// "Target : '$0'"
const text = print(element);
```

## Keywords
OData CAP CDS annotations

---
_Source: https://npm.io/package/@sap-ux/cds-odata-annotation-converter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
