@jentic/arazzo-parser 1.0.0-alpha.6 → 1.0.0-alpha.7
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 +42 -29
- package/dist/jentic-arazzo-parser.browser.js +348 -68
- package/dist/jentic-arazzo-parser.browser.min.js +1 -1
- package/package.json +15 -9
- package/src/index.cjs +5 -2
- package/src/index.mjs +2 -1
- package/src/parse-arazzo.cjs +5 -14
- package/src/parse-arazzo.mjs +6 -15
- package/src/parse-openapi.cjs +239 -0
- package/src/parse-openapi.mjs +232 -0
- package/src/resolve/resolvers/memory/index.cjs +2 -2
- package/src/resolve/resolvers/memory/index.mjs +2 -2
- package/types/arazzo-parser.d.ts +37 -5
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.7](https://github.com/jentic/jentic-arazzo-tools/compare/v1.0.0-alpha.6...v1.0.0-alpha.7) (2026-02-04)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **parser:** add support for parsing OpenAPI Documents ([#35](https://github.com/jentic/jentic-arazzo-tools/issues/35)) ([4c2615e](https://github.com/jentic/jentic-arazzo-tools/commit/4c2615e07c3b74ea7fe74b91b977c8c7123a2188))
|
|
11
|
+
|
|
6
12
|
# [1.0.0-alpha.6](https://github.com/jentic/jentic-arazzo-tools/compare/v1.0.0-alpha.5...v1.0.0-alpha.6) (2026-02-04)
|
|
7
13
|
|
|
8
14
|
### Features
|
package/README.md
CHANGED
|
@@ -139,31 +139,6 @@ try {
|
|
|
139
139
|
}
|
|
140
140
|
```
|
|
141
141
|
|
|
142
|
-
### Non-Arazzo documents
|
|
143
|
-
|
|
144
|
-
When a valid document is parsed but it's not an Arazzo specification (e.g., an OpenAPI document), the parser does not throw. Instead, it returns a `ParseResultElement` with:
|
|
145
|
-
|
|
146
|
-
- An error annotation explaining the issue
|
|
147
|
-
- `.api` returns `undefined`
|
|
148
|
-
- The parsed document remains accessible in the parse result
|
|
149
|
-
|
|
150
|
-
```js
|
|
151
|
-
import { parseArazzo } from '@jentic/arazzo-parser';
|
|
152
|
-
|
|
153
|
-
const openApiDoc = {
|
|
154
|
-
openapi: '3.1.0',
|
|
155
|
-
info: { title: 'My API', version: '1.0.0' },
|
|
156
|
-
paths: {},
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
const result = await parseArazzo(openApiDoc);
|
|
160
|
-
|
|
161
|
-
result.api; // undefined
|
|
162
|
-
result.errors.length; // 1
|
|
163
|
-
result.errors.get(0).toValue();
|
|
164
|
-
// 'Document is not a valid Arazzo specification...'
|
|
165
|
-
```
|
|
166
|
-
|
|
167
142
|
## Working with the result
|
|
168
143
|
|
|
169
144
|
The `parseArazzo` function returns a [ParseResultElement](https://github.com/speclynx/apidom/blob/main/packages/apidom-datamodel/README.md#parseresultelement) representing the result of the parsing operation.
|
|
@@ -311,10 +286,10 @@ When source descriptions are parsed, each parsed document that is a *direct* sou
|
|
|
311
286
|
|
|
312
287
|
Source descriptions are parsed into their appropriate SpecLynx ApiDOM namespace data models based on document type:
|
|
313
288
|
|
|
314
|
-
-
|
|
315
|
-
-
|
|
316
|
-
-
|
|
317
|
-
-
|
|
289
|
+
- [Arazzo 1.x](https://spec.openapis.org/arazzo/latest.html) → [@speclynx/apidom-ns-arazzo-1](https://github.com/speclynx/apidom/tree/main/packages/apidom-ns-arazzo-1)
|
|
290
|
+
- [OpenAPI 2.0 (Swagger)](https://spec.openapis.org/oas/v2.0) → [@speclynx/apidom-ns-openapi-2](https://github.com/speclynx/apidom/tree/main/packages/apidom-ns-openapi-2)
|
|
291
|
+
- [OpenAPI 3.0.x](https://spec.openapis.org/oas/v3.0.4) → [@speclynx/apidom-ns-openapi-3-0](https://github.com/speclynx/apidom/tree/main/packages/apidom-ns-openapi-3-0)
|
|
292
|
+
- [OpenAPI 3.1.x](https://spec.openapis.org/oas/v3.1.1) → [@speclynx/apidom-ns-openapi-3-1](https://github.com/speclynx/apidom/tree/main/packages/apidom-ns-openapi-3-1)
|
|
318
293
|
|
|
319
294
|
```mermaid
|
|
320
295
|
graph TD
|
|
@@ -448,6 +423,44 @@ for (let i = 0; i < parseResult.length; i++) {
|
|
|
448
423
|
}
|
|
449
424
|
```
|
|
450
425
|
|
|
426
|
+
## Parsing OpenAPI Documents
|
|
427
|
+
|
|
428
|
+
The `parseOpenAPI` function provides complete control for parsing OpenAPI documents manually.
|
|
429
|
+
This is useful when you need to parse source descriptions independently or implement custom source description resolution logic.
|
|
430
|
+
|
|
431
|
+
The function accepts the same input types as `parseArazzo`:
|
|
432
|
+
|
|
433
|
+
1. **Plain JavaScript object** - converts to JSON and parses
|
|
434
|
+
2. **String content** - detects OpenAPI content and parses inline JSON or YAML
|
|
435
|
+
3. **File system path** - resolves and parses local OpenAPI Documents
|
|
436
|
+
4. **HTTP(S) URL** - fetches and parses remote OpenAPI Documents
|
|
437
|
+
|
|
438
|
+
Documents are parsed into their appropriate SpecLynx ApiDOM namespace data models:
|
|
439
|
+
|
|
440
|
+
- [OpenAPI 2.0 (Swagger)](https://spec.openapis.org/oas/v2.0) → [@speclynx/apidom-ns-openapi-2](https://github.com/speclynx/apidom/tree/main/packages/apidom-ns-openapi-2)
|
|
441
|
+
- [OpenAPI 3.0.x](https://spec.openapis.org/oas/v3.0.4) → [@speclynx/apidom-ns-openapi-3-0](https://github.com/speclynx/apidom/tree/main/packages/apidom-ns-openapi-3-0)
|
|
442
|
+
- [OpenAPI 3.1.x](https://spec.openapis.org/oas/v3.1.1) → [@speclynx/apidom-ns-openapi-3-1](https://github.com/speclynx/apidom/tree/main/packages/apidom-ns-openapi-3-1)
|
|
443
|
+
|
|
444
|
+
```js
|
|
445
|
+
import { parseOpenAPI } from '@jentic/arazzo-parser';
|
|
446
|
+
|
|
447
|
+
// From object
|
|
448
|
+
const parseResult = await parseOpenAPI({
|
|
449
|
+
openapi: '3.1.0',
|
|
450
|
+
info: { title: 'My API', version: '1.0.0' },
|
|
451
|
+
paths: {},
|
|
452
|
+
});
|
|
453
|
+
|
|
454
|
+
// From string
|
|
455
|
+
const parseResult = await parseOpenAPI('{"openapi": "3.1.0", ...}');
|
|
456
|
+
|
|
457
|
+
// From file
|
|
458
|
+
const parseResult = await parseOpenAPI('/path/to/openapi.json');
|
|
459
|
+
|
|
460
|
+
// From URL
|
|
461
|
+
const parseResult = await parseOpenAPI('https://example.com/openapi.yaml');
|
|
462
|
+
```
|
|
463
|
+
|
|
451
464
|
## SpecLynx ApiDOM tooling
|
|
452
465
|
|
|
453
466
|
Since `@jentic/arazzo-parser` produces a SpecLynx ApiDOM data model, you have access to the full suite of ApiDOM tools for manipulating, traversing, and transforming the parsed document.
|