0.99.2 • Published 2 days ago

@swagger-api/apidom-json-pointer v0.99.2

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 days ago

@swagger-api/apidom-json-pointer

apidom-json-pointer is a package that evaluates JSON Pointer against ApiDOM.

Installation

You can install this package via npm CLI by running the following command:

 $ npm install @swagger-api/apidom-json-pointer

Evaluating

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

const apidom = new ObjectElement({ a: { b: 'c' } });
const result =  evaluate('/a/b', apidom);
// => StringElement('c')

Parsing

Parses JSON Pointer into list of tokens.

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

const tokens = parse('/a/b'); // => ['a', 'b']

Compiling

Compiles list of tokens into JSON Pointer.

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

const jsonPointer = compile(['a', 'b']); // => '/a/b'

Escaping

Escapes/unescapes tokens of JSON Pointer.

import { escape, unescape } from '@swagger-api/apidom-json-pointer';

escape('~a/'); // => '~0a~1'
unescape('~0a~1'); // => '~a/'

Transforming URI to JSON Pointer

Handles case of URI Fragment Identifier Representation.

import { uriToPointer } from '@swagger-api/apidom-json-pointer';

uriToPointer('https://example.com/path/#/a/b'); // => '/a/b'

Invalid JSON Pointers

If invalid JSON Pointer is supplied to parse or evaluate functions, InvalidJsonPointerError is thrown.

import { InvalidJsonPointerError } from '@swagger-api/apidom-json-pointer';

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

import { EvaluationJsonPointerError } from '@swagger-api/apidom-json-pointer';
0.99.2

2 days ago

0.99.1

27 days ago

0.99.0

29 days ago

0.97.0

2 months ago

0.98.0

1 month ago

0.96.0

2 months ago

0.95.0

3 months ago

0.94.0

3 months ago

0.93.0

3 months ago

0.92.0

4 months ago

0.91.0

4 months ago

0.90.0

4 months ago

0.89.0

4 months ago

0.88.0

5 months ago

0.87.0

5 months ago

0.86.0

5 months ago

0.84.0

5 months ago

0.85.0

5 months ago

0.82.2

6 months ago

0.80.0

6 months ago

0.81.0

6 months ago

0.82.0

6 months ago

0.83.0

6 months ago

0.82.1

6 months ago

0.78.0

7 months ago

0.76.2

8 months ago

0.77.0

7 months ago

0.76.1

8 months ago

0.79.0

6 months ago

0.74.0

9 months ago

0.73.0

10 months ago

0.76.0

8 months ago

0.75.0

8 months ago

0.74.1

9 months ago

0.72.0

10 months ago

0.71.0

10 months ago

0.70.1

11 months ago

0.70.0

11 months ago

0.69.2

1 year ago

0.69.1

1 year ago

0.69.3

1 year ago

0.69.0

1 year ago

0.68.1

1 year ago