@swagger-api/apidom-parser-adapter-arazzo-json-1 1.0.0-beta.30

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/NOTICE ADDED
@@ -0,0 +1,83 @@
1
+ ApiDOM
2
+ Copyright 2020 SmartBear Software Inc.
3
+ ApiDOM is licensed under Apache 2.0 license.
4
+ Copy of the Apache 2.0 license can be found in `LICENSES/Apache-2.0.txt` file.
5
+
6
+ json-schema-ref-parser
7
+ Copyright (c) 2015 James Messinger
8
+ File packages/apidom-reference/src/util/url.ts (the file) was originally created under MIT license in https://github.com/APIDevTools/json-schema-ref-parser repository.
9
+ The file has been copied into this project and modified. All modifications are licensed under Apache 2.0 License.
10
+ Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
11
+
12
+ graphql-js
13
+ Copyright (c) GraphQL Contributors
14
+ File packages/apidom-ast/src/traversal/visitor.ts (the file) was originally created under MIT license in https://github.com/graphql/graphql-js repository.
15
+ The file has been copied into this project and modified. All modifications are licensed under Apache 2.0 License.
16
+ Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
17
+
18
+ babel-plugin-add-import-extension
19
+ Copyright (c) 2019 Karl Prieb
20
+ File scripts/babel-plugin-add-import-extension.cjs (the file) was originally created under MIT license in https://codeberg.org/karl/babel-plugin-add-import-extension.
21
+ The file has been copied into this project and modified. All modifications are licensed under Apache 2.0 License.
22
+ Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
23
+
24
+ refract-spec
25
+ Copyright (c) 2015 refractproject
26
+ Specific texts in README.md (the file) were originally created under MIT license in https://github.com/refractproject/refract-spec repository.
27
+ Specific texts have been copied into this project and modified. All modifications are licensed under Apache 2.0 License.
28
+ Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
29
+
30
+ api-elements
31
+ Copyright (c) 2015 Apiary Inc.
32
+ Specific texts in README.md (the file) were originally created under MIT license in https://github.com/refractproject/refract-spec repository.
33
+ Specific texts have been copied into this project and modified. All modifications are licensed under Apache 2.0 License.
34
+ Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
35
+
36
+ deepmerge
37
+ Copyright (c) 2012 James Halliday, Josh Duff, and other contributors
38
+ - File packages/apidom-core/src/deepmerge.ts contains algorithms that we originally created
39
+ in https://github.com/TehShrike/deepmerge/blob/master/index.js to handle deep merging of JavaScript Objects and Arrays.
40
+ These algorithms have been reverse engineered and adapted to support deep merging of ApiDOM structures.
41
+ - File packages/apidom-core/test/deepmerge.ts contains tests and fixtures that were originally created
42
+ in https://github.com/TehShrike/deepmerge/blob/master/test/merge.js to test deep merging of JavaScript Objects and Arrays.
43
+ These tests have been adapted to support testing deep merging of ApiDOM structures.
44
+ - File packages/apidom-core/README.md contains text fragments that were originally created
45
+ in https://github.com/TehShrike/deepmerge/blob/master/readme.md to document deepmerge library.
46
+ These text fragments have been amended to describe merging of ApiDOM structures.
47
+ Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
48
+ All modifications are licensed under Apache 2.0 License.
49
+
50
+ OpenAPI Specification 2.0
51
+ Copyright The Linux Foundation
52
+ Fragments of the specification text are embedded in packages/apidom-ls/src/config/openapi.
53
+ Copy of the Apache 2.0 license can be found in `LICENSES/Apache-2.0.txt` file.
54
+
55
+ OpenAPI Specification 3.0.x
56
+ Copyright The Linux Foundation
57
+ Fragments of the specification text are embedded in packages/apidom-ls/src/config/openapi.
58
+ Copy of the Apache 2.0 license can be found in `LICENSES/Apache-2.0.txt` file.
59
+
60
+ OpenAPI Specification 3.1.x
61
+ Copyright The Linux Foundation
62
+ Fragments of the specification text are embedded in packages/apidom-ls/src/config/openapi.
63
+ Copy of the Apache 2.0 license can be found in `LICENSES/Apache-2.0.txt` file.
64
+
65
+ AsyncAPI Specification 2.x / AsyncAPI Initiative
66
+ Copyright The Linux Foundation
67
+ Fragments of the specification text are embedded in packages/apidom-ls/src/config/asyncapi.
68
+ Copy of the Apache 2.0 license can be found in `LICENSES/Apache-2.0.txt` file.
69
+
70
+ JSON Schema Specification (Draft 4/5 -> 2020-12)
71
+ Copyright (c) 2022 JSON Schema Specification Authors
72
+ Fragments of the specification text are embedded in packages/apidom-ls/src/config/common.
73
+ Copy of the BSD 3-Clause "New" or "Revised" License can be found in `LICENSES/BSD-3-Clause.txt` file.
74
+ Copy of the Academic Free License v3.0 can be found in `LICENSES/AFL-3.0.txt` file.
75
+
76
+ ---
77
+
78
+ If the SPDX-FileCopyrightText and SPDX-License-Identifier tags are not present in the file,
79
+ it is assumed that these tags have following implicit value:
80
+
81
+ SPDX-FileCopyrightText: Copyright 2020-2021 SmartBear Software Inc.
82
+ SPDX-License-Identifier: Apache-2.0
83
+
package/README.md ADDED
@@ -0,0 +1,88 @@
1
+ # @swagger-api/apidom-parser-adapter-arazzo-json-1
2
+
3
+ `@swagger-api/apidom-parser-adapter-arazzo-json-1-0` is a parser adapter for the [Arazzo 1.0.1 specification](https://spec.openapis.org/arazzo/latest.html#version-1-0-1) in [JSON format](https://www.json.org/json-en.html).
4
+ Under the hood this adapter uses [apidom-parser-adapter-json](https://github.com/swagger-api/apidom/tree/main/packages/apidom-parser-adapter-json)
5
+ to parse a source string into generic ApiDOM in [base ApiDOM namespace](https://github.com/swagger-api/apidom/tree/main/packages/apidom#base-namespace)
6
+ which is then refracted with [Arazzo 1.x.y Refractors](https://github.com/swagger-api/apidom/tree/main/packages/apidom-ns-arazzo-1#refractors).
7
+
8
+ ## Installation
9
+
10
+ After [prerequisites](https://github.com/swagger-api/apidom/blob/main/README.md#prerequisites) for installing this package are satisfied, you can install it
11
+ via [npm CLI](https://docs.npmjs.com/cli) by running the following command:
12
+
13
+ ```sh
14
+ $ npm install @swagger-api/apidom-parser-adapter-arazzo-json-1
15
+ ```
16
+
17
+ ## Parser adapter API
18
+
19
+ This parser adapter is fully compatible with parser adapter interface required by [@swagger-api/apidom-parser](https://github.com/swagger-api/apidom/tree/main/packages/apidom-parser#mounting-parser-adapters)
20
+ and implements all required properties.
21
+
22
+ ### mediaTypes
23
+
24
+ Defines list of media types that this parser adapter recognizes.
25
+
26
+ ```js
27
+ [
28
+ 'application/vnd.oai.workflows;version=1.0.0',
29
+ 'application/vnd.oai.workflows+json;version=1.0.0',
30
+ 'application/vnd.oai.workflows;version=1.0.1',
31
+ 'application/vnd.oai.workflows+json;version=1.0.1',
32
+ ]
33
+ ```
34
+
35
+ ### detect
36
+
37
+ [Detection](https://github.com/swagger-api/apidom/blob/main/packages/apidom-parser-adapter-arazzo-json-1/src/adapter.ts#L13) is based on a regular expression matching required Arazzo 1.0.1 specification symbols in JSON format.
38
+
39
+ ### namespace
40
+
41
+ This adapter exposes an instance of [Arazzo 1.x.y ApiDOM namespace](https://github.com/swagger-api/apidom/blob/main/packages/apidom-ns-arazzo-1/README.md#arazzo-101-namespace).
42
+
43
+ ### parse
44
+
45
+ `parse` function consumes various options as a second argument. Here is a list of these options:
46
+
47
+ | Option | Type | Default | Description |
48
+ |----------------------------|----------|------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------|
49
+ | <a name="specObj"></a>`specObj` | `Object` | [Specification Object](https://github.com/swagger-api/apidom/blob/main/packages/apidom-ns-arazzo-1/src/refractor/specification.ts) | This specification object drives the JSON AST transformation to Arazzo 1.x.y ApiDOM namespace. |
50
+ | <a name="sourceMap"></a>`sourceMap` | `Boolean` | `false` | Indicate whether to generate source maps. |
51
+ | <a name="refractorOpts"></a>`refractorOpts` | `Object` | `{}` | Refractor options are [passed to refractors](https://github.com/swagger-api/apidom/tree/main/packages/apidom-ns-arazzo-1#refractor-plugins) during the refracting phase. |
52
+
53
+ All unrecognized arbitrary options will be ignored.
54
+
55
+ ## Usage
56
+
57
+ This parser adapter can be used directly or indirectly via [@swagger-api/apidom-parser](https://github.com/swagger-api/apidom/tree/main/packages/apidom-parser).
58
+
59
+ ### Direct usage
60
+
61
+ During direct usage you don't need to provide `mediaType` as the `parse` function is already pre-bound
62
+ with [supported media types](#mediatypes).
63
+
64
+ ```js
65
+ import { parse, detect } from '@swagger-api/apidom-parser-adapter-arazzo-json-1';
66
+
67
+ // detecting
68
+ await detect('{"arazzo": "1.0.1"}'); // => true
69
+ await detect('test'); // => false
70
+
71
+ // parsing
72
+ const parseResult = await parse('{"arazzo": "1.0.1"}', { sourceMap: true });
73
+ ```
74
+
75
+ ### Indirect usage
76
+
77
+ You can omit the `mediaType` option here, but please read [Word on detect vs mediaTypes](https://github.com/swagger-api/apidom/tree/main/packages/apidom-parser#word-on-detect-vs-mediatypes) before you do so.
78
+
79
+ ```js
80
+ import ApiDOMParser from '@swagger-api/apidom-parser';
81
+ import * as arazzoJsonAdapter from '@swagger-api/apidom-parser-adapter-arazzo-json-1';
82
+
83
+ const parser = new ApiDOMParser();
84
+
85
+ parser.use(arazzoJsonAdapter);
86
+
87
+ const parseResult = await parser.parse('{"arazzo": "1.0.1"}', { mediaType: arazzoJsonAdapter.mediaTypes.latest('json') });
88
+ ```