@speclynx/apidom-datamodel 2.2.3 → 2.4.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 +8 -0
- package/README.md +49 -0
- package/package.json +3 -3
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
|
+
# [2.4.0](https://github.com/speclynx/apidom/compare/v2.3.0...v2.4.0) (2026-01-29)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @speclynx/apidom-datamodel
|
|
9
|
+
|
|
10
|
+
# [2.3.0](https://github.com/speclynx/apidom/compare/v2.2.3...v2.3.0) (2026-01-27)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @speclynx/apidom-datamodel
|
|
13
|
+
|
|
6
14
|
## [2.2.3](https://github.com/speclynx/apidom/compare/v2.2.2...v2.2.3) (2026-01-26)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @speclynx/apidom-datamodel
|
package/README.md
CHANGED
|
@@ -180,6 +180,55 @@ link.relation = 'self';
|
|
|
180
180
|
link.href = 'https://example.com';
|
|
181
181
|
```
|
|
182
182
|
|
|
183
|
+
### ParseResultElement
|
|
184
|
+
|
|
185
|
+
Represents the result of parsing a document. It contains the parsed API element and any annotations (errors, warnings) produced during parsing.
|
|
186
|
+
|
|
187
|
+
```js
|
|
188
|
+
import { ParseResultElement, ObjectElement, AnnotationElement } from '@speclynx/apidom-datamodel';
|
|
189
|
+
import { toValue } from '@speclynx/apidom-core';
|
|
190
|
+
|
|
191
|
+
const parseResult = new ParseResultElement();
|
|
192
|
+
|
|
193
|
+
// Add the parsed result
|
|
194
|
+
const api = new ObjectElement({ openapi: '3.1.0' });
|
|
195
|
+
api.classes.push('result');
|
|
196
|
+
parseResult.push(api);
|
|
197
|
+
|
|
198
|
+
// Add annotations
|
|
199
|
+
const warning = new AnnotationElement('Deprecated feature used');
|
|
200
|
+
warning.classes.push('warning');
|
|
201
|
+
parseResult.push(warning);
|
|
202
|
+
|
|
203
|
+
// Access the result
|
|
204
|
+
parseResult.result; // => ObjectElement
|
|
205
|
+
parseResult.isEmpty; // => false
|
|
206
|
+
|
|
207
|
+
// Iterate over annotations
|
|
208
|
+
for (const annotation of parseResult.annotations) {
|
|
209
|
+
console.log(toValue(annotation));
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### AnnotationElement
|
|
214
|
+
|
|
215
|
+
Represents metadata about the parsing process, such as errors, warnings, or informational messages.
|
|
216
|
+
|
|
217
|
+
```js
|
|
218
|
+
import { AnnotationElement } from '@speclynx/apidom-datamodel';
|
|
219
|
+
|
|
220
|
+
// Create a warning annotation
|
|
221
|
+
const warning = new AnnotationElement('Multiple documents found, using first');
|
|
222
|
+
warning.classes.push('warning');
|
|
223
|
+
|
|
224
|
+
// Create an error annotation
|
|
225
|
+
const error = new AnnotationElement('Invalid syntax at line 10');
|
|
226
|
+
error.classes.push('error');
|
|
227
|
+
|
|
228
|
+
// Annotations can have a code for programmatic identification
|
|
229
|
+
error.code = 'INVALID_SYNTAX';
|
|
230
|
+
```
|
|
231
|
+
|
|
183
232
|
---
|
|
184
233
|
|
|
185
234
|
## Source Maps
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@speclynx/apidom-datamodel",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Data model primitives for ApiDOM.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"license": "Apache-2.0",
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@babel/runtime-corejs3": "^7.28.4",
|
|
42
|
-
"@speclynx/apidom-error": "^2.
|
|
42
|
+
"@speclynx/apidom-error": "^2.4.0",
|
|
43
43
|
"ramda": "~0.32.0"
|
|
44
44
|
},
|
|
45
45
|
"files": [
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"README.md",
|
|
53
53
|
"CHANGELOG.md"
|
|
54
54
|
],
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "f127ee0b98cc108b83a690bf317895e17a32b4d4"
|
|
56
56
|
}
|