@jentic/arazzo-parser 1.0.0-alpha.17 → 1.0.0-alpha.18
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 +6 -0
- package/README.md +49 -1
- package/dist/jentic-arazzo-parser.browser.js +2 -0
- package/dist/jentic-arazzo-parser.browser.min.js +1 -1
- package/package.json +2 -2
- package/src/parse-arazzo.cjs +1 -0
- package/src/parse-arazzo.mjs +1 -0
- package/src/parse-openapi.cjs +1 -0
- package/src/parse-openapi.mjs +1 -0
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
|
+
# [1.0.0-alpha.18](https://github.com/jentic/jentic-arazzo-tools/compare/v1.0.0-alpha.17...v1.0.0-alpha.18) (2026-02-20)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **parser:** add support for lossless roundtrips ([#91](https://github.com/jentic/jentic-arazzo-tools/issues/91)) ([2cffe4f](https://github.com/jentic/jentic-arazzo-tools/commit/2cffe4f142c4a541126a3f5f2e3634195c906f75))
|
|
11
|
+
|
|
6
12
|
# [1.0.0-alpha.17](https://github.com/jentic/jentic-arazzo-tools/compare/v1.0.0-alpha.16...v1.0.0-alpha.17) (2026-02-20)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -103,6 +103,7 @@ const parseResult = await parseArazzo(source, {
|
|
|
103
103
|
parserOpts: {
|
|
104
104
|
strict: true, // Use strict parsing mode (default: true)
|
|
105
105
|
sourceMap: false, // Include source maps (default: false)
|
|
106
|
+
style: false, // Capture style information for round-trip preservation (default: false)
|
|
106
107
|
},
|
|
107
108
|
},
|
|
108
109
|
});
|
|
@@ -236,10 +237,57 @@ For more details about source maps, see the [SpecLynx ApiDOM Data Model document
|
|
|
236
237
|
// Source maps with objects (requires strict: false)
|
|
237
238
|
// Positions will reference the internally generated JSON string
|
|
238
239
|
await parseArazzo({ arazzo: '1.0.1', ... }, {
|
|
239
|
-
parse: {
|
|
240
|
+
parse: {
|
|
241
|
+
parserOpts: {
|
|
242
|
+
sourceMap: true,
|
|
243
|
+
strict: false
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
});
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Style preservation
|
|
250
|
+
|
|
251
|
+
Style preservation captures format-specific style information for round-trip preservation. When enabled, the parser records formatting details (e.g., YAML quoting styles, flow/block indicators, comments, indentation; JSON indentation, raw number representation) on each parsed element. These details can then be used by [`toYAML`](https://github.com/speclynx/apidom/tree/main/packages/apidom-core#toyaml) and [`toJSON`](https://github.com/speclynx/apidom/tree/main/packages/apidom-core#tojson) from `@speclynx/apidom-core` to reproduce the original formatting.
|
|
252
|
+
|
|
253
|
+
To enable style preservation, set `style: true` and `strict: false` in the parser options:
|
|
254
|
+
|
|
255
|
+
```js
|
|
256
|
+
import { parseArazzo } from '@jentic/arazzo-parser';
|
|
257
|
+
import { toYAML } from '@speclynx/apidom-core';
|
|
258
|
+
|
|
259
|
+
const parseResult = await parseArazzo('/path/to/arazzo.yaml', {
|
|
260
|
+
parse: {
|
|
261
|
+
parserOpts: {
|
|
262
|
+
style: true,
|
|
263
|
+
strict: false,
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
// round-trip back to YAML preserving original formatting
|
|
269
|
+
const yaml = toYAML(parseResult.api, { preserveStyle: true });
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
```js
|
|
273
|
+
import { parseArazzo } from '@jentic/arazzo-parser';
|
|
274
|
+
import { toJSON } from '@speclynx/apidom-core';
|
|
275
|
+
|
|
276
|
+
const parseResult = await parseArazzo('/path/to/arazzo.json', {
|
|
277
|
+
parse: {
|
|
278
|
+
parserOpts: {
|
|
279
|
+
style: true,
|
|
280
|
+
strict: false,
|
|
281
|
+
},
|
|
282
|
+
},
|
|
240
283
|
});
|
|
284
|
+
|
|
285
|
+
// round-trip back to JSON preserving original formatting
|
|
286
|
+
const json = toJSON(parseResult.api, undefined, undefined, { preserveStyle: true });
|
|
241
287
|
```
|
|
242
288
|
|
|
289
|
+
**Note:** Style preservation requires `strict: false`. Both `style` and `sourceMap` can be enabled simultaneously — they are independent features.
|
|
290
|
+
|
|
243
291
|
## Parsing source descriptions
|
|
244
292
|
|
|
245
293
|
Arazzo documents can reference external API specifications (OpenAPI, Arazzo) through [Source Descriptions](https://spec.openapis.org/arazzo/latest.html#source-description-object). The parser can automatically fetch and parse these referenced documents.
|
|
@@ -114,6 +114,7 @@ const defaultOptions = {
|
|
|
114
114
|
})],
|
|
115
115
|
parserOpts: {
|
|
116
116
|
sourceMap: false,
|
|
117
|
+
style: false,
|
|
117
118
|
strict: true,
|
|
118
119
|
sourceDescriptions: false
|
|
119
120
|
}
|
|
@@ -337,6 +338,7 @@ const defaultOptions = {
|
|
|
337
338
|
})],
|
|
338
339
|
parserOpts: {
|
|
339
340
|
sourceMap: false,
|
|
341
|
+
style: false,
|
|
340
342
|
strict: true
|
|
341
343
|
}
|
|
342
344
|
},
|