@swagger-api/apidom-parser-adapter-json 0.92.0 → 0.93.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 +4 -0
- package/cjs/syntactic-analysis/indirect/visitors/CstVisitor.cjs +19 -19
- package/dist/apidom-parser-adapter-json.browser.js +213 -342
- package/dist/apidom-parser-adapter-json.browser.min.js +1 -1
- package/es/syntactic-analysis/indirect/visitors/CstVisitor.mjs +19 -19
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
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
|
+
# [0.93.0](https://github.com/swagger-api/apidom/compare/v0.92.0...v0.93.0) (2024-01-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @swagger-api/apidom-parser-adapter-json
|
|
9
|
+
|
|
6
10
|
# [0.92.0](https://github.com/swagger-api/apidom/compare/v0.91.0...v0.92.0) (2024-01-12)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @swagger-api/apidom-parser-adapter-json
|
|
@@ -19,17 +19,17 @@ const keyMap = exports.keyMap = {
|
|
|
19
19
|
|
|
20
20
|
class CstVisitor {
|
|
21
21
|
static toPosition(node) {
|
|
22
|
-
const start =
|
|
22
|
+
const start = new _apidomAst.Point({
|
|
23
23
|
row: node.startPosition.row,
|
|
24
24
|
column: node.startPosition.column,
|
|
25
25
|
char: node.startIndex
|
|
26
26
|
});
|
|
27
|
-
const end =
|
|
27
|
+
const end = new _apidomAst.Point({
|
|
28
28
|
row: node.endPosition.row,
|
|
29
29
|
column: node.endPosition.column,
|
|
30
30
|
char: node.endIndex
|
|
31
31
|
});
|
|
32
|
-
return
|
|
32
|
+
return new _apidomAst.Position({
|
|
33
33
|
start,
|
|
34
34
|
end
|
|
35
35
|
});
|
|
@@ -37,14 +37,14 @@ class CstVisitor {
|
|
|
37
37
|
document = {
|
|
38
38
|
enter: node => {
|
|
39
39
|
const position = CstVisitor.toPosition(node);
|
|
40
|
-
return
|
|
40
|
+
return new _apidomAst.JsonDocument({
|
|
41
41
|
children: node.children,
|
|
42
42
|
position,
|
|
43
43
|
isMissing: node.isMissing
|
|
44
44
|
});
|
|
45
45
|
},
|
|
46
46
|
leave: document => {
|
|
47
|
-
return
|
|
47
|
+
return new _apidomAst.ParseResult({
|
|
48
48
|
children: [document]
|
|
49
49
|
});
|
|
50
50
|
}
|
|
@@ -57,7 +57,7 @@ class CstVisitor {
|
|
|
57
57
|
const {
|
|
58
58
|
isMissing
|
|
59
59
|
} = node;
|
|
60
|
-
return
|
|
60
|
+
return new _apidomAst.Literal({
|
|
61
61
|
value,
|
|
62
62
|
position,
|
|
63
63
|
isMissing
|
|
@@ -67,7 +67,7 @@ class CstVisitor {
|
|
|
67
67
|
}
|
|
68
68
|
object(node) {
|
|
69
69
|
const position = CstVisitor.toPosition(node);
|
|
70
|
-
return
|
|
70
|
+
return new _apidomAst.JsonObject({
|
|
71
71
|
children: node.children,
|
|
72
72
|
position,
|
|
73
73
|
isMissing: node.isMissing
|
|
@@ -79,12 +79,12 @@ class CstVisitor {
|
|
|
79
79
|
const {
|
|
80
80
|
keyNode
|
|
81
81
|
} = node;
|
|
82
|
-
const key =
|
|
82
|
+
const key = new _apidomAst.JsonKey({
|
|
83
83
|
children: (keyNode == null ? void 0 : keyNode.children) || [],
|
|
84
|
-
position: keyNode != null ? CstVisitor.toPosition(keyNode) :
|
|
84
|
+
position: keyNode != null ? CstVisitor.toPosition(keyNode) : undefined,
|
|
85
85
|
isMissing: keyNode != null ? keyNode.isMissing : false
|
|
86
86
|
});
|
|
87
|
-
return
|
|
87
|
+
return new _apidomAst.JsonProperty({
|
|
88
88
|
children: [key, ...children],
|
|
89
89
|
position,
|
|
90
90
|
isMissing: node.isMissing
|
|
@@ -92,7 +92,7 @@ class CstVisitor {
|
|
|
92
92
|
}
|
|
93
93
|
array(node) {
|
|
94
94
|
const position = CstVisitor.toPosition(node);
|
|
95
|
-
return
|
|
95
|
+
return new _apidomAst.JsonArray({
|
|
96
96
|
children: node.children,
|
|
97
97
|
position,
|
|
98
98
|
isMissing: node.isMissing
|
|
@@ -100,10 +100,10 @@ class CstVisitor {
|
|
|
100
100
|
}
|
|
101
101
|
string(node) {
|
|
102
102
|
const position = CstVisitor.toPosition(node);
|
|
103
|
-
const content =
|
|
103
|
+
const content = new _apidomAst.JsonStringContent({
|
|
104
104
|
value: JSON.parse(node.text)
|
|
105
105
|
});
|
|
106
|
-
return
|
|
106
|
+
return new _apidomAst.JsonString({
|
|
107
107
|
children: [content],
|
|
108
108
|
position,
|
|
109
109
|
isMissing: node.isMissing
|
|
@@ -112,7 +112,7 @@ class CstVisitor {
|
|
|
112
112
|
number(node) {
|
|
113
113
|
const position = CstVisitor.toPosition(node);
|
|
114
114
|
const value = node.text;
|
|
115
|
-
return
|
|
115
|
+
return new _apidomAst.JsonNumber({
|
|
116
116
|
value,
|
|
117
117
|
position,
|
|
118
118
|
isMissing: node.isMissing
|
|
@@ -123,7 +123,7 @@ class CstVisitor {
|
|
|
123
123
|
null(node) {
|
|
124
124
|
const position = CstVisitor.toPosition(node);
|
|
125
125
|
const value = node.text;
|
|
126
|
-
return
|
|
126
|
+
return new _apidomAst.JsonNull({
|
|
127
127
|
value,
|
|
128
128
|
position,
|
|
129
129
|
isMissing: node.isMissing
|
|
@@ -134,7 +134,7 @@ class CstVisitor {
|
|
|
134
134
|
true(node) {
|
|
135
135
|
const position = CstVisitor.toPosition(node);
|
|
136
136
|
const value = node.text;
|
|
137
|
-
return
|
|
137
|
+
return new _apidomAst.JsonTrue({
|
|
138
138
|
value,
|
|
139
139
|
position,
|
|
140
140
|
isMissing: node.isMissing
|
|
@@ -145,7 +145,7 @@ class CstVisitor {
|
|
|
145
145
|
false(node) {
|
|
146
146
|
const position = CstVisitor.toPosition(node);
|
|
147
147
|
const value = node.text;
|
|
148
|
-
return
|
|
148
|
+
return new _apidomAst.JsonFalse({
|
|
149
149
|
value,
|
|
150
150
|
position,
|
|
151
151
|
isMissing: node.isMissing
|
|
@@ -153,7 +153,7 @@ class CstVisitor {
|
|
|
153
153
|
}
|
|
154
154
|
ERROR(node, key, parent, path) {
|
|
155
155
|
const position = CstVisitor.toPosition(node);
|
|
156
|
-
const errorNode =
|
|
156
|
+
const errorNode = new _apidomAst.Error({
|
|
157
157
|
children: node.children,
|
|
158
158
|
position,
|
|
159
159
|
isUnexpected: !node.hasError,
|
|
@@ -161,7 +161,7 @@ class CstVisitor {
|
|
|
161
161
|
value: node.text
|
|
162
162
|
});
|
|
163
163
|
if (path.length === 0) {
|
|
164
|
-
return
|
|
164
|
+
return new _apidomAst.ParseResult({
|
|
165
165
|
children: [errorNode]
|
|
166
166
|
});
|
|
167
167
|
}
|