# @sap-ux/odata-annotation-core

> Annotation Core

Latest version **1.0.4** (published 2026-10-16) · Apache-2.0 license · 0 weekly downloads

## Install

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

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2026-10-16 |
| First published | 2023-11-14 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=22.x |
| Dependencies | 2 |
| Unpacked size | 178.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| 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/odata-annotation-core
- Repository: https://github.com/SAP/open-ux-tools
- Issues: https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aodata-annotation-core
- npm.io page: https://npm.io/package/@sap-ux/odata-annotation-core

## Dependencies (2)

- [@sap-ux/text-document-utils](https://npm.io/package/@sap-ux/text-document-utils.md) 1.0.4
- [@sap-ux/odata-annotation-core-types](https://npm.io/package/@sap-ux/odata-annotation-core-types.md) 1.0.4

## Recent versions

- 1.0.4 (latest) — 2026-10-16
- 1.0.3 — 2026-09-22
- 1.0.2 — 2026-08-25
- 1.0.1 — 2026-06-04
- 1.0.0 — 2026-05-30
- 0.3.1 — 2026-05-20
- 0.3.0 — 2026-05-15
- 0.2.18 — 2026-04-30
- 0.2.17 — 2026-03-16
- 0.2.16 — 2026-03-04
- 0.2.15 — 2026-02-23
- 0.2.14 — 2026-02-10
- 0.2.13 — 2026-01-29
- 0.2.12 — 2026-01-09
- 0.2.11 — 2025-12-15
- … 19 more at https://npm.io/package/@sap-ux/odata-annotation-core/versions

## README

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

# [OData Annotation Core](https://github.com/SAP/open-ux-tools/tree/main/packages/odata-annotation-core)

Package containing low level building blocks and utility functions for working with OData annotations.

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

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

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

## Usage

### Parse identifier
#### Term name:
```Typescript
import { parseIdentifier } from '@sap-ux/odata-annotations-core';

const { type, name, namespaceOrAlias } = parseIdentifier('com.sap.vocabularies.UI.v1.LineItem');
// Expected 
// type: 'identifier',
// namespaceOrAlias: 'com.sap.vocabularies.UI.v1',
// name: 'LineItem'

```
#### Function name:
```Typescript
import { parseIdentifier } from '@sap-ux/odata-annotations-core';

const identifier = 'MySchema.MyAction(Collection(MySchema.MyBindingType),Collection(MySchema.MyType))';
const { type, name, namespaceOrAlias, parameters } = parseIdentifier(identifier);
// Expected 
// type: 'action-function',
// namespaceOrAlias: 'MySchema',
// name: 'MyAction'
// parameters: 
//    [
//        {
//            type: 'collection',
//            name: 'MyBindingType',
//            namespaceOrAlias: 'MySchema'
//        },
//        {
//            type: 'collection',
//            name: 'MyType',
//            namespaceOrAlias: 'MySchema'
//        }
//    ]
```

### Conversion to fully qualified name

```Typescript
import type { ParsedName } from '@sap-ux/odata-annotations-core';
import { toFullyQualifiedName } from '@sap-ux/odata-annotations-core';

const aliasMap: { [aliasOrNamespace: string]: string } = {
    UI: 'com.sap.vocabularies.UI.v1',
    'com.sap.vocabularies.UI.v1': 'com.sap.vocabularies.UI.v1'
};
                    
const identifier1: ParsedName = {
    type: 'identifier',
    name: 'LineItem',
    namespaceOrAlias: 'UI'
}

const identifier2: ParsedName = {
    type: 'identifier',
    name: 'FieldGroup',
    namespaceOrAlias: 'com.sap.vocabularies.UI.v1'
}

const identifier3: ParsedName = {
    type: 'identifier',
    name: 'MyEntityType',
}

const currentWorkspace = 'MyNamespace';

const fqName1 = toFullyQualifiedName(aliasMap, currentWorkspace, identifier1);
const fqName2 = toFullyQualifiedName(aliasMap, currentWorkspace, identifier2);
const fqName3 = toFullyQualifiedName(aliasMap, currentWorkspace, identifier3);
// Expected
// fqName1: 'com.sap.vocabularies.UI.v1.LineItem'
// fqName2: 'com.sap.vocabularies.UI.v1.FieldGroup'
// fqName3: 'MyNamespace.MyEntityType

```

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

## Keywords
SAP ODATA annotations

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