# @swagger-api/apidom-json-pointer-relative

> Evaluate Relative JSON Pointer expressions against ApiDOM.

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

## Install

```sh
npm install @swagger-api/apidom-json-pointer-relative
pnpm add @swagger-api/apidom-json-pointer-relative
yarn add @swagger-api/apidom-json-pointer-relative
bun add @swagger-api/apidom-json-pointer-relative
```

## 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.12.1 |
| Published | 2026-09-04 |
| First published | 2023-08-22 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 7 |
| Unpacked size | 613.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 100 |
| Author | Vladimír Gorej |
| Maintainers | swagger-api |

## Links

- npm: https://www.npmjs.com/package/@swagger-api/apidom-json-pointer-relative
- Repository: https://github.com/swagger-api/apidom
- Homepage: https://github.com/swagger-api/apidom#readme
- Issues: https://github.com/swagger-api/apidom/issues
- npm.io page: https://npm.io/package/@swagger-api/apidom-json-pointer-relative

## Dependencies (7)

- [ramda](https://npm.io/package/ramda.md) ~0.30.0
- [@types/ramda](https://npm.io/package/@types/ramda.md) ~0.30.0
- [ramda-adjunct](https://npm.io/package/ramda-adjunct.md) ^5.0.0
- [@babel/runtime-corejs3](https://npm.io/package/@babel/runtime-corejs3.md) ^7.26.10
- [@swagger-api/apidom-core](https://npm.io/package/@swagger-api/apidom-core.md) ^1.12.1
- [@swagger-api/apidom-error](https://npm.io/package/@swagger-api/apidom-error.md) ^1.12.1
- [@swagger-api/apidom-json-pointer](https://npm.io/package/@swagger-api/apidom-json-pointer.md) ^1.12.1

## Recent versions

- 1.12.1 (latest) — 2026-09-04
- 1.11.6 (v1.11-maintenance) — 2026-09-16
- 1.11.5 — 2026-09-16
- 1.11.4 — 2026-09-15
- 1.12.0 — 2026-08-03
- 1.11.3 — 2026-06-22
- 1.11.2 — 2026-06-02
- 1.11.1 — 2026-05-12
- 1.11.0 — 2026-04-27
- 1.10.2 — 2026-04-13
- 1.10.1 — 2026-04-07
- 1.10.0 — 2026-04-01
- 1.9.0 — 2026-03-30
- 1.8.0 — 2026-03-20
- 1.7.0 — 2026-03-17
- … 108 more at https://npm.io/package/@swagger-api/apidom-json-pointer-relative/versions

## README

# @swagger-api/apidom-json-pointer-relative

`apidom-json-pointer-relative` is a package that evaluates [Relative JSON Pointer](https://datatracker.ietf.org/doc/html/draft-bhutton-relative-json-pointer-00) against ApiDOM.

## Installation

You can install this package via [npm CLI](https://docs.npmjs.com/cli) by running the following command:

```sh
 $ npm install @swagger-api/apidom-json-pointer-relative
```
## Evaluating

```js
import { ObjectElement } from '@swagger-api/apidom-core';
import { evaluate } from '@swagger-api/apidom-json-pointer-relative';

const root = new ObjectElement({ a: { b: 'c' } });
const current = root.get('a').get('b');
const result =  evaluate('0#', current, root);
// => StringElement('b')
```

## Parsing

Parses Relative JSON Pointer into AST (Abstract Syntax Tree).

```js
import { parse } from '@swagger-api/apidom-json-pointer-relative';

const tokens = parse('2/foo/0');
// => { nonNegativeIntegerPrefix: 2, indexManipulation: undefined, jsonPointerTokens: ['foo', '0'], hashCharacter: false }
```

## Compiling

Compiles AST into Relative JSON Pointer.

```js
import { compile } from '@swagger-api/apidom-json-pointer-relative';

const relativeJsonPointer = compile({
  nonNegativeIntegerPrefix: 2,
  indexManipulation: undefined,
  jsonPointerTokens: ['highly', 'nested', 'objects'],
  hashCharacter: false,
}); // => '2/highly/nested/objects'
```

## Invalid Relative JSON Pointers

If invalid Relative JSON Pointer is supplied to `parse` or `evaluate` functions, `InvalidRelativeJsonPointerError`
is thrown.

```js
import { InvalidRelativeJsonPointerError } from '@swagger-api/apidom-json-pointer-relative';
```

If valid JSON Pointer is supplied to `evaluate` function and the relative pointer cannot be evaluated against
ApiDOM fragment, `EvaluationRelativeJsonPointerError` is thrown.

```js
import { EvaluationRelativeJsonPointerError } from '@swagger-api/apidom-json-pointer-relative';
```

---
_Source: https://npm.io/package/@swagger-api/apidom-json-pointer-relative · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
