@speclynx/apidom-parser-adapter-openapi-json-2 3.2.0 → 4.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@speclynx/apidom-parser-adapter-openapi-json-2",
3
- "version": "3.2.0",
3
+ "version": "4.0.0",
4
4
  "description": "Parser adapter for parsing JSON documents into OpenAPI 2.0 namespace.",
5
5
  "keywords": [
6
6
  "apidom",
@@ -56,10 +56,10 @@
56
56
  "license": "Apache-2.0",
57
57
  "dependencies": {
58
58
  "@babel/runtime-corejs3": "^7.28.4",
59
- "@speclynx/apidom-core": "3.2.0",
60
- "@speclynx/apidom-datamodel": "3.2.0",
61
- "@speclynx/apidom-ns-openapi-2": "3.2.0",
62
- "@speclynx/apidom-parser-adapter-json": "3.2.0",
59
+ "@speclynx/apidom-core": "4.0.0",
60
+ "@speclynx/apidom-datamodel": "4.0.0",
61
+ "@speclynx/apidom-ns-openapi-2": "4.0.0",
62
+ "@speclynx/apidom-parser-adapter-json": "4.0.0",
63
63
  "ramda": "~0.32.0",
64
64
  "ramda-adjunct": "^6.0.0"
65
65
  },
@@ -73,5 +73,5 @@
73
73
  "README.md",
74
74
  "CHANGELOG.md"
75
75
  ],
76
- "gitHead": "eeb2f01cd34fb0a95617f02bc1b6683aefc028f2"
76
+ "gitHead": "384ff82a1bb68d015fd6801de641898b4b582876"
77
77
  }
package/src/adapter.cjs DELETED
@@ -1,53 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
- var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard").default;
5
- exports.__esModule = true;
6
- exports.parse = exports.namespace = exports.mediaTypes = exports.detectionRegExp = exports.detect = void 0;
7
- var _ramda = require("ramda");
8
- var _ramdaAdjunct = require("ramda-adjunct");
9
- var _apidomDatamodel = require("@speclynx/apidom-datamodel");
10
- var _apidomParserAdapterJson = require("@speclynx/apidom-parser-adapter-json");
11
- var _apidomNsOpenapi = _interopRequireWildcard(require("@speclynx/apidom-ns-openapi-2"));
12
- var _mediaTypes = _interopRequireDefault(require("./media-types.cjs"));
13
- exports.mediaTypes = _mediaTypes.default;
14
- /**
15
- * @public
16
- */
17
- const detectionRegExp = exports.detectionRegExp = /"swagger"\s*:\s*"(?<version_json>2\.0)"/;
18
-
19
- /**
20
- * @public
21
- */
22
- const detect = async (source, options = {}) => detectionRegExp.test(source) && (await (0, _apidomParserAdapterJson.detect)(source, options));
23
-
24
- /**
25
- * @public
26
- */
27
- exports.detect = detect;
28
- /**
29
- * @public
30
- */
31
- const parse = async (source, options = {}) => {
32
- const refractorOpts = (0, _ramda.propOr)({}, 'refractorOpts', options);
33
- const parserOpts = (0, _ramda.omit)(['refractorOpts'], options);
34
- const parseResultElement = await (0, _apidomParserAdapterJson.parse)(source, parserOpts);
35
- const {
36
- result
37
- } = parseResultElement;
38
- if ((0, _ramdaAdjunct.isNotUndefined)(result)) {
39
- const swaggerElement = (0, _apidomNsOpenapi.refractSwagger)(result, {
40
- consume: true,
41
- ...refractorOpts
42
- });
43
- swaggerElement.classes.push('result');
44
- parseResultElement.replaceResult(swaggerElement);
45
- }
46
- return parseResultElement;
47
- };
48
-
49
- /**
50
- * @public
51
- */
52
- exports.parse = parse;
53
- const namespace = exports.namespace = new _apidomDatamodel.Namespace().use(_apidomNsOpenapi.default);
package/src/adapter.mjs DELETED
@@ -1,45 +0,0 @@
1
- import { propOr, omit } from 'ramda';
2
- import { isNotUndefined } from 'ramda-adjunct';
3
- import { Namespace } from '@speclynx/apidom-datamodel';
4
- import { parse as parseJSON, detect as detectJSON } from '@speclynx/apidom-parser-adapter-json';
5
- import openApiNamespace, { refractSwagger } from '@speclynx/apidom-ns-openapi-2';
6
- export { default as mediaTypes } from "./media-types.mjs";
7
- /**
8
- * @public
9
- */
10
- export const detectionRegExp = /"swagger"\s*:\s*"(?<version_json>2\.0)"/;
11
-
12
- /**
13
- * @public
14
- */
15
- export const detect = async (source, options = {}) => detectionRegExp.test(source) && (await detectJSON(source, options));
16
-
17
- /**
18
- * @public
19
- */
20
-
21
- /**
22
- * @public
23
- */
24
- export const parse = async (source, options = {}) => {
25
- const refractorOpts = propOr({}, 'refractorOpts', options);
26
- const parserOpts = omit(['refractorOpts'], options);
27
- const parseResultElement = await parseJSON(source, parserOpts);
28
- const {
29
- result
30
- } = parseResultElement;
31
- if (isNotUndefined(result)) {
32
- const swaggerElement = refractSwagger(result, {
33
- consume: true,
34
- ...refractorOpts
35
- });
36
- swaggerElement.classes.push('result');
37
- parseResultElement.replaceResult(swaggerElement);
38
- }
39
- return parseResultElement;
40
- };
41
-
42
- /**
43
- * @public
44
- */
45
- export const namespace = new Namespace().use(openApiNamespace);
@@ -1,10 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.default = void 0;
5
- var _apidomNsOpenapi = require("@speclynx/apidom-ns-openapi-2");
6
- /**
7
- * @public
8
- */
9
- const jsonMediaTypes = new _apidomNsOpenapi.OpenAPIMediaTypes(..._apidomNsOpenapi.mediaTypes.filterByFormat('generic'), ..._apidomNsOpenapi.mediaTypes.filterByFormat('json'));
10
- var _default = exports.default = jsonMediaTypes;
@@ -1,7 +0,0 @@
1
- import { mediaTypes, OpenAPIMediaTypes } from '@speclynx/apidom-ns-openapi-2';
2
-
3
- /**
4
- * @public
5
- */
6
- const jsonMediaTypes = new OpenAPIMediaTypes(...mediaTypes.filterByFormat('generic'), ...mediaTypes.filterByFormat('json'));
7
- export default jsonMediaTypes;