@speclynx/apidom-json-path 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.2.0](https://github.com/speclynx/apidom/compare/v2.1.0...v2.2.0) (2026-01-19)
7
+
8
+ ### Features
9
+
10
+ - **json-path:** integrate @swaggerexpert/jsonpath as JSONPath engine ([#25](https://github.com/speclynx/apidom/issues/25)) ([40f9279](https://github.com/speclynx/apidom/commit/40f92793ab9d2ab82ba5a4431f82c186031b661f))
11
+
6
12
  # [2.1.0](https://github.com/speclynx/apidom/compare/v2.0.1...v2.1.0) (2026-01-17)
7
13
 
8
14
  **Note:** Version bump only for package @speclynx/apidom-json-path
package/README.md CHANGED
@@ -10,67 +10,12 @@ You can install this package via [npm CLI](https://docs.npmjs.com/cli) by runnin
10
10
  $ npm install @speclynx/apidom-json-path
11
11
  ```
12
12
 
13
- ## Evaluating
13
+ The API of this package is fully compliant with [RFC 9535](https://www.rfc-editor.org/rfc/rfc9535.html) and supports all aspects of JSONPath.
14
+ Uses [@swaggerexpert/jsonpath](https://www.npmjs.com/package/@swaggerexpert/jsonpath) under the hood and fully reflects its API.
14
15
 
15
- Package contains JSONPath evaluation functions for evaluating single or multiple JSONPath expression.
16
-
17
- ### Evaluating single JSONPath expression
18
-
19
- Suited for evaluating single JSONPath expression against ApiDOM.
20
-
21
- ```js
22
- import { ObjectElement } from '@speclynx/apidom-core';
23
- import { evaluate } from '@speclynx/apidom-json-path';
24
-
25
- const apidom = new ObjectElement({
26
- a: {
27
- b: [100, 1, 2],
28
- },
29
- });
30
- const result = evaluate('$.a.b[?(@ < 10)]', apidom);
31
- // =>
32
- // [
33
- // NumberElement(1),
34
- // NumberElement(2),
35
- // ]
36
- ```
37
- ### Evaluating multiple JSONPath expressions
38
-
39
- Suited for evaluating multiple JSONPath expression against the same ApiDOM.
40
- Use this function in cases when you have multiple JSONPath expressions that need
41
- to be evaluated against single ApiDOM fragment.
16
+ Evaluation is contextual to ApiDOM realm (`ApiDOMEvaluationRealm`) - meaning `evaluate` function
17
+ expects only ApiDOM as the first argument.
42
18
 
43
19
  ```js
44
- import { ObjectElement } from '@speclynx/apidom-core';
45
- import { evaluateMulti } from '@speclynx/apidom-json-path';
46
-
47
- const apidom = new ObjectElement({
48
- a: {
49
- b: [100, 1, 2],
50
- },
51
- });
52
- const resultMulti = evaluateMulti(['$.a.b[?(@ < 10)]', '$.a.b[?(@ > 10)]'], apidom);
53
- // => returns list of tuples which represents mappings between paths and end point values
54
- // [
55
- // ['$.a.b[?(@ < 10)]', [NumberElement(1), NumberElement(2)]],
56
- // ['$.a.b[?(@ > 10)]', [NUmberElement(100)]],
57
- // ]
58
- ```
59
-
60
- ## Invalid JSONPath expression
61
-
62
- If either `evaluate` or `evaluateMulti` functions are provided with invalid JSONPath expressions,
63
- they don't throw errors, but they rather return empty list of end point values.
64
-
65
- ```js
66
- import { ObjectElement } from '@speclynx/apidom-core';
67
- import { evaluate, evaluateMulti } from '@speclynx/apidom-json-path';
68
-
69
- const apidom = new ObjectElement({
70
- a: {
71
- b: [100, 1, 2],
72
- },
73
- });
74
- const result = evaluate('%~!@U@IU$@', apidom); // => []
75
- const resultMulti = evaluateMulti(['%~!@U@IU$@', 'd*AS&*)(&YR3R'], apidom); // => []
20
+ import { evaluate, ApiDOMEvaluationRealm } from '@speclynx/apidom-json-path';
76
21
  ```