@swagger-api/apidom-parser-adapter-json 1.0.0-rc.2 → 1.0.0-rc.4
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 +8 -0
- package/README.md +8 -8
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
# [1.0.0-rc.4](https://github.com/swagger-api/apidom/compare/v1.0.0-rc.3...v1.0.0-rc.4) (2025-11-25)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @swagger-api/apidom-parser-adapter-json
|
|
9
|
+
|
|
10
|
+
# [1.0.0-rc.3](https://github.com/swagger-api/apidom/compare/v1.0.0-rc.2...v1.0.0-rc.3) (2025-11-07)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @swagger-api/apidom-parser-adapter-json
|
|
13
|
+
|
|
6
14
|
# [1.0.0-rc.2](https://github.com/swagger-api/apidom/compare/v1.0.0-rc.1...v1.0.0-rc.2) (2025-11-07)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @swagger-api/apidom-parser-adapter-json
|
package/README.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
`@swagger-api/apidom-parser-adapter-json` is a parser adapter for the [JSON format](https://www.json.org/json-en.html).
|
|
4
4
|
|
|
5
|
-
[CST](https://tree-sitter.github.io/tree-sitter/using-parsers#syntax-nodes) produced by lexical analysis is [syntactically analyzed](https://github.com/swagger-api/apidom/blob/main/packages/apidom-parser-adapter-json/src/syntactic-analysis) and
|
|
6
|
-
ApiDOM structure using [base ApiDOM namespace](https://github.com/swagger-api/apidom/tree/main/packages/apidom#base-namespace) is produced.
|
|
5
|
+
[CST](https://tree-sitter.github.io/tree-sitter/using-parsers/2-basic-parsing.html#syntax-nodes) produced by lexical analysis is [syntactically analyzed](https://github.com/swagger-api/apidom/blob/main/packages/apidom-parser-adapter-json/src/syntactic-analysis) and
|
|
6
|
+
ApiDOM structure using [base ApiDOM namespace](https://github.com/swagger-api/apidom/tree/main/packages/apidom-core#base-namespace) is produced.
|
|
7
7
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
@@ -16,7 +16,7 @@ via [npm CLI](https://docs.npmjs.com/cli) by running the following command:
|
|
|
16
16
|
|
|
17
17
|
## Parse phases
|
|
18
18
|
|
|
19
|
-
The parse stage takes JSON string and produces ApiDOM structure using [base ApiDOM namespace](https://github.com/swagger-api/apidom/tree/main/packages/apidom#base-namespace).
|
|
19
|
+
The parse stage takes JSON string and produces ApiDOM structure using [base ApiDOM namespace](https://github.com/swagger-api/apidom/tree/main/packages/apidom-core#base-namespace).
|
|
20
20
|
There are two phases of parsing: **Lexical Analysis** and **Syntactic Analysis**.
|
|
21
21
|
|
|
22
22
|
### Lexical Analysis
|
|
@@ -27,8 +27,8 @@ Lexical Analysis will take a JSON string and turn it into a stream of tokens.
|
|
|
27
27
|
### Syntactic Analysis
|
|
28
28
|
|
|
29
29
|
Syntactic Analysis will take a stream of tokens and turn it into an ApiDOM representation.
|
|
30
|
-
[CST](https://tree-sitter.github.io/tree-sitter/using-parsers#syntax-nodes) produced by lexical analysis is [syntactically analyzed](https://github.com/swagger-api/apidom/blob/main/packages/apidom-parser-adapter-json/src/syntactic-analysis)
|
|
31
|
-
and ApiDOM structure using [base ApiDOM namespace](https://github.com/swagger-api/apidom/tree/main/packages/apidom#base-namespace) is produced.
|
|
30
|
+
[CST](https://tree-sitter.github.io/tree-sitter/using-parsers/2-basic-parsing.html#syntax-nodes) produced by lexical analysis is [syntactically analyzed](https://github.com/swagger-api/apidom/blob/main/packages/apidom-parser-adapter-json/src/syntactic-analysis)
|
|
31
|
+
and ApiDOM structure using [base ApiDOM namespace](https://github.com/swagger-api/apidom/tree/main/packages/apidom-core#base-namespace) is produced.
|
|
32
32
|
|
|
33
33
|
#### [Direct Syntactical analysis](https://github.com/swagger-api/apidom/blob/main/packages/apidom-parser-adapter-json/src/syntactic-analysis/direct)
|
|
34
34
|
|
|
@@ -43,7 +43,7 @@ const parseResult = await parse('{"prop": "value"}', {
|
|
|
43
43
|
});
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
#### [Indirect Syntactic analysis](
|
|
46
|
+
#### [Indirect Syntactic analysis](https://github.com/swagger-api/apidom/blob/main/packages/apidom-parser-adapter-json/src/syntactic-analysis/indirect)
|
|
47
47
|
|
|
48
48
|
This analysis turns trees-sitter CST into [JSON AST](https://github.com/swagger-api/apidom/tree/main/packages/apidom-ast#json-ast-nodes) representation.
|
|
49
49
|
Then JSON AST is turned into ApiDOM. Two traversals are required, which makes indirect analysis less performant than direct one.
|
|
@@ -72,11 +72,11 @@ Defines list of media types that this parser adapter recognizes.
|
|
|
72
72
|
|
|
73
73
|
### detect
|
|
74
74
|
|
|
75
|
-
[Detection](https://github.com/swagger-api/apidom/blob/main/packages/apidom-parser-adapter-json/src/adapter.ts#
|
|
75
|
+
[Detection](https://github.com/swagger-api/apidom/blob/main/packages/apidom-parser-adapter-json/src/adapter-node.ts#L23) is based on a regular expression matching valid JSON data types to indicate whether the provided source string is or isn't JSON string.
|
|
76
76
|
|
|
77
77
|
### namespace
|
|
78
78
|
|
|
79
|
-
This adapter exposes an instance of [base ApiDOM namespace](https://github.com/swagger-api/apidom/tree/main/packages/apidom#base-namespace).
|
|
79
|
+
This adapter exposes an instance of [base ApiDOM namespace](https://github.com/swagger-api/apidom/tree/main/packages/apidom-core#base-namespace).
|
|
80
80
|
|
|
81
81
|
### parse
|
|
82
82
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swagger-api/apidom-parser-adapter-json",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.4",
|
|
4
4
|
"description": "Parser adapter for parsing JSON documents into base namespace.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"license": "Apache-2.0",
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@babel/runtime-corejs3": "^7.26.10",
|
|
56
|
-
"@swagger-api/apidom-ast": "^1.0.0-rc.
|
|
57
|
-
"@swagger-api/apidom-core": "^1.0.0-rc.
|
|
58
|
-
"@swagger-api/apidom-error": "^1.0.0-rc.
|
|
56
|
+
"@swagger-api/apidom-ast": "^1.0.0-rc.4",
|
|
57
|
+
"@swagger-api/apidom-core": "^1.0.0-rc.4",
|
|
58
|
+
"@swagger-api/apidom-error": "^1.0.0-rc.4",
|
|
59
59
|
"@types/ramda": "~0.30.0",
|
|
60
60
|
"ramda": "~0.30.0",
|
|
61
61
|
"ramda-adjunct": "^5.0.0",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"README.md",
|
|
78
78
|
"CHANGELOG.md"
|
|
79
79
|
],
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "ee774281a884eedf1445699d8f2b0092e50db432"
|
|
81
81
|
}
|