@speclynx/apidom-parser-adapter-openapi-json-3-1 1.12.1

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.
@@ -0,0 +1,26 @@
1
+ Redistribution and use in source and binary forms, with or without
2
+ modification, are permitted provided that the following conditions are
3
+ met:
4
+
5
+ 1. Redistributions of source code must retain the above copyright
6
+ notice, this list of conditions and the following disclaimer.
7
+
8
+ 2. Redistributions in binary form must reproduce the above copyright
9
+ notice, this list of conditions and the following disclaimer in the
10
+ documentation and/or other materials provided with the distribution.
11
+
12
+ 3. Neither the name of the copyright holder nor the names of its
13
+ contributors may be used to endorse or promote products derived from
14
+ this software without specific prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
22
+ TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) <year> <copyright holders>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/NOTICE ADDED
@@ -0,0 +1,65 @@
1
+ Additional Notices for SpecLynx Distribution
2
+ Copyright 2025 SpecLynx
3
+ This distribution is known as "SpecLynx ApiDOM". It is a fork of the ApiDOM project maintained by SmartBear.
4
+ This distribution includes modifications by SpecLynx.
5
+ All such modifications are licensed under the Apache License, Version 2.0.
6
+ A copy of the Apache 2.0 license can be found in `LICENSES/Apache-2.0.txt`.
7
+
8
+ ApiDOM
9
+ Copyright 2020 SmartBear Software Inc.
10
+ ApiDOM is licensed under Apache 2.0 license.
11
+ Copy of the Apache 2.0 license can be found in `LICENSES/Apache-2.0.txt` file.
12
+
13
+ json-schema-ref-parser
14
+ Copyright (c) 2015 James Messinger
15
+ 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.
16
+ The file has been copied into this project and modified. All modifications are licensed under Apache 2.0 License.
17
+ Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
18
+
19
+ graphql-js
20
+ Copyright (c) GraphQL Contributors
21
+ File packages/apidom-ast/src/traversal/visitor.ts (the file) was originally created under MIT license in https://github.com/graphql/graphql-js repository.
22
+ The file has been copied into this project and modified. All modifications are licensed under Apache 2.0 License.
23
+ Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
24
+
25
+ babel-plugin-add-import-extension
26
+ Copyright (c) 2019 Karl Prieb
27
+ 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.
28
+ The file has been copied into this project and modified. All modifications are licensed under Apache 2.0 License.
29
+ Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
30
+
31
+ refract-spec
32
+ Copyright (c) 2015 refractproject
33
+ Specific texts in README.md (the file) were originally created under MIT license in https://github.com/refractproject/refract-spec repository.
34
+ Specific texts have been copied into this project and modified. All modifications are licensed under Apache 2.0 License.
35
+ Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
36
+
37
+ api-elements
38
+ Copyright (c) 2015 Apiary Inc.
39
+ Specific texts in README.md (the file) were originally created under MIT license in https://github.com/refractproject/refract-spec repository.
40
+ Specific texts have been copied into this project and modified. All modifications are licensed under Apache 2.0 License.
41
+ Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
42
+
43
+ deepmerge
44
+ Copyright (c) 2012 James Halliday, Josh Duff, and other contributors
45
+ - File packages/apidom-core/src/deepmerge.ts contains algorithms that we originally created
46
+ in https://github.com/TehShrike/deepmerge/blob/master/index.js to handle deep merging of JavaScript Objects and Arrays.
47
+ These algorithms have been reverse engineered and adapted to support deep merging of ApiDOM structures.
48
+ - File packages/apidom-core/test/deepmerge.ts contains tests and fixtures that were originally created
49
+ in https://github.com/TehShrike/deepmerge/blob/master/test/merge.js to test deep merging of JavaScript Objects and Arrays.
50
+ These tests have been adapted to support testing deep merging of ApiDOM structures.
51
+ - File packages/apidom-core/README.md contains text fragments that were originally created
52
+ in https://github.com/TehShrike/deepmerge/blob/master/readme.md to document deepmerge library.
53
+ These text fragments have been amended to describe merging of ApiDOM structures.
54
+ Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
55
+ All modifications are licensed under Apache 2.0 License.
56
+
57
+ ---
58
+
59
+ If the SPDX-FileCopyrightText and SPDX-License-Identifier tags are not present in the file,
60
+ it is assumed that these tags have following implicit value:
61
+
62
+ SPDX-FileCopyrightText: Copyright 2025 SpecLynx
63
+ SPDX-FileCopyrightText: Copyright 2020-2021 SmartBear Software Inc.
64
+ SPDX-License-Identifier: Apache-2.0
65
+
package/README.md ADDED
@@ -0,0 +1,94 @@
1
+ # @speclynx/apidom-parser-adapter-openapi-json-3-1
2
+
3
+ `@speclynx/apidom-parser-adapter-openapi-json-3-1` is a parser adapter for the **OpenAPI 3.1.x specification** in [JSON format](https://www.json.org/json-en.html) supporting the following versions:
4
+
5
+ - [OpenAPI 3.1.0](https://spec.openapis.org/oas/v3.1.0.html)
6
+ - [OpenAPI 3.1.1](https://spec.openapis.org/oas/v3.1.1.html)
7
+ - [OpenAPI 3.1.2](https://spec.openapis.org/oas/v3.1.2.html)
8
+
9
+ Under the hood this adapter uses [apidom-parser-adapter-json](https://github.com/speclynx/apidom/tree/main/packages/apidom-parser-adapter-json)
10
+ to parse a source string into generic ApiDOM in [base ApiDOM namespace](https://github.com/speclynx/apidom/tree/main/packages/apidom#base-namespace)
11
+ which is then refracted with [OpenAPI 3.1.x Refractors](https://github.com/speclynx/apidom/tree/main/packages/apidom-ns-openapi-3-1#refractors).
12
+
13
+ ## Installation
14
+
15
+ You can install `@speclynx/apidom-parser-adapter-openapi-json-3-1` via [npm CLI](https://docs.npmjs.com/cli) by running the following command:
16
+
17
+ ```sh
18
+ $ npm install @speclynx/apidom-parser-adapter-openapi-json-3-1
19
+ ```
20
+
21
+ ## Parser adapter API
22
+
23
+ This parser adapter is fully compatible with parser adapter interface required by [@speclynx/apidom-parser](https://github.com/speclynx/apidom/tree/main/packages/apidom-parser#mounting-parser-adapters)
24
+ and implements all required properties.
25
+
26
+ ### mediaTypes
27
+
28
+ Defines list of media types that this parser adapter recognizes.
29
+
30
+ ```js
31
+ [
32
+ 'application/vnd.oai.openapi;version=3.1.0',
33
+ 'application/vnd.oai.openapi+json;version=3.1.0',
34
+ 'application/vnd.oai.openapi;version=3.1.1',
35
+ 'application/vnd.oai.openapi+json;version=3.1.1',
36
+ 'application/vnd.oai.openapi;version=3.1.2',
37
+ 'application/vnd.oai.openapi+json;version=3.1.2',
38
+ ]
39
+ ```
40
+
41
+ ### detect
42
+
43
+ [Detection](https://github.com/speclynx/apidom/blob/main/packages/apidom-parser-adapter-openapi-json-3-1/src/adapter.ts#L13) is based on a regular expression matching required OpenAPI 3.1.x specification symbols in JSON format.
44
+
45
+ ### namespace
46
+
47
+ This adapter exposes an instance of [OpenAPI 3.1.x ApiDOM namespace](https://github.com/speclynx/apidom/tree/main/packages/apidom-ns-openapi-3-1#openapi-310-namespace).
48
+
49
+ ### parse
50
+
51
+ `parse` function consumes various options as a second argument. Here is a list of these options:
52
+
53
+ Option | Type | Default | Description
54
+ --- | --- | --- | ---
55
+ <a name="specObj"></a>`specObj` | `Object` | [Specification Object](https://github.com/speclynx/apidom/blob/main/packages/apidom-ns-openapi-3-1/src/refractor/specification.ts) | This specification object drives the JSON AST transformation to OpenAPI 3.1.x ApiDOM namespace.
56
+ <a name="sourceMap"></a>`sourceMap` | `Boolean` | `false` | Indicate whether to generate source maps.
57
+ <a name="refractorOpts"></a>`refractorOpts` | `Object` | `{}` | Refractor options are [passed to refractors](https://github.com/speclynx/apidom/tree/main/packages/apidom-ns-openapi-3-1#refractor-plugins) during refracting phase.
58
+
59
+ All unrecognized arbitrary options will be ignored.
60
+
61
+ ## Usage
62
+
63
+ This parser adapter can be used directly or indirectly via [@speclynx/apidom-parser](https://github.com/speclynx/apidom/tree/main/packages/apidom-parser).
64
+
65
+ ### Direct usage
66
+
67
+ During direct usage you don't need to provide `mediaType` as the `parse` function is already pre-bound
68
+ with [supported media types](#mediatypes).
69
+
70
+ ```js
71
+ import { parse, detect } from '@speclynx/apidom-parser-adapter-openapi-json-3-1';
72
+
73
+ // detecting
74
+ await detect('{"openapi": "3.1.2"}'); // => true
75
+ await detect('test'); // => false
76
+
77
+ // parsing
78
+ const parseResult = await parse('{"openapi": "3.1.2"}', { sourceMap: true });
79
+ ```
80
+
81
+ ### Indirect usage
82
+
83
+ You can omit the `mediaType` option here, but please read [Word on detect vs mediaTypes](https://github.com/speclynx/apidom/tree/main/packages/apidom-parser#word-on-detect-vs-mediatypes) before you do so.
84
+
85
+ ```js
86
+ import ApiDOMParser from '@speclynx/apidom-parser';
87
+ import * as openApiJsonAdapter from '@speclynx/apidom-parser-adapter-openapi-json-3-1';
88
+
89
+ const parser = new ApiDOMParser();
90
+
91
+ parser.use(openApiJsonAdapter);
92
+
93
+ const parseResult = await parser.parse('{"openapi": "3.1.2"}', { mediaType: openApiJsonAdapter.mediaTypes.latest('json') });
94
+ ```
@@ -0,0 +1,10 @@
1
+ (self["webpackChunkapidomParserAdapterOpenApiJson3_1"] = self["webpackChunkapidomParserAdapterOpenApiJson3_1"] || []).push([[167],{
2
+
3
+ /***/ 59167:
4
+ /***/ (() => {
5
+
6
+ /* (ignored) */
7
+
8
+ /***/ })
9
+
10
+ }]);
@@ -0,0 +1 @@
1
+ (self.webpackChunkapidomParserAdapterOpenApiJson3_1=self.webpackChunkapidomParserAdapterOpenApiJson3_1||[]).push([[167],{9167:()=>{}}]);
@@ -0,0 +1,10 @@
1
+ (self["webpackChunkapidomParserAdapterOpenApiJson3_1"] = self["webpackChunkapidomParserAdapterOpenApiJson3_1"] || []).push([[451],{
2
+
3
+ /***/ 19451:
4
+ /***/ (() => {
5
+
6
+ /* (ignored) */
7
+
8
+ /***/ })
9
+
10
+ }]);
@@ -0,0 +1 @@
1
+ (self.webpackChunkapidomParserAdapterOpenApiJson3_1=self.webpackChunkapidomParserAdapterOpenApiJson3_1||[]).push([[451],{9451:()=>{}}]);