@speclynx/apidom-parser-adapter-openapi-yaml-2 4.0.3 → 4.0.5

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-yaml-2",
3
- "version": "4.0.3",
3
+ "version": "4.0.5",
4
4
  "description": "Parser adapter for parsing YAML documents into OpenAPI 2.0 namespace.",
5
5
  "keywords": [
6
6
  "apidom",
@@ -56,15 +56,16 @@
56
56
  "license": "Apache-2.0",
57
57
  "dependencies": {
58
58
  "@babel/runtime-corejs3": "^7.28.4",
59
- "@speclynx/apidom-core": "4.0.3",
60
- "@speclynx/apidom-datamodel": "4.0.3",
61
- "@speclynx/apidom-ns-openapi-2": "4.0.3",
62
- "@speclynx/apidom-parser-adapter-yaml-1-2": "4.0.3",
59
+ "@speclynx/apidom-core": "4.0.5",
60
+ "@speclynx/apidom-datamodel": "4.0.5",
61
+ "@speclynx/apidom-ns-openapi-2": "4.0.5",
62
+ "@speclynx/apidom-parser-adapter-yaml-1-2": "4.0.5",
63
63
  "ramda": "~0.32.0",
64
64
  "ramda-adjunct": "^6.0.0"
65
65
  },
66
66
  "files": [
67
- "src/",
67
+ "src/**/*.mjs",
68
+ "src/**/*.cjs",
68
69
  "dist/",
69
70
  "types/apidom-parser-adapter-openapi-yaml-2.d.ts",
70
71
  "LICENSES",
@@ -72,5 +73,5 @@
72
73
  "README.md",
73
74
  "CHANGELOG.md"
74
75
  ],
75
- "gitHead": "6ccfa09c02232516215e7de3ead276641957e626"
76
+ "gitHead": "5a85d2a832eeefb07d03760faa391b457447e966"
76
77
  }
package/src/adapter.ts DELETED
@@ -1,59 +0,0 @@
1
- import { propOr, omit } from 'ramda';
2
- import { isNotUndefined } from 'ramda-adjunct';
3
- import { ParseResultElement, Namespace } from '@speclynx/apidom-datamodel';
4
- import {
5
- parse as parseYAML,
6
- detect as detectYAML,
7
- type ParseDetectOptions,
8
- type ParseOptions as ParseOptionsYAML,
9
- } from '@speclynx/apidom-parser-adapter-yaml-1-2';
10
- import openApiNamespace, { refractSwagger } from '@speclynx/apidom-ns-openapi-2';
11
-
12
- export { default as mediaTypes } from './media-types.ts';
13
-
14
- /**
15
- * @public
16
- */
17
- export const detectionRegExp =
18
- /(?<YAML>^(["']?)swagger\2\s*:\s*(["'])(?<version_yaml>2\.0)\3(?:\s+|$))|(?<JSON>"swagger"\s*:\s*"(?<version_json>2\.0)")/m;
19
-
20
- /**
21
- * @public
22
- */
23
- export const detect: typeof detectYAML = async (
24
- source: string,
25
- options: ParseDetectOptions = {},
26
- ): Promise<boolean> => detectionRegExp.test(source) && (await detectYAML(source, options));
27
-
28
- /**
29
- * @public
30
- */
31
- export interface ParseOptions extends ParseOptionsYAML {
32
- refractorOpts?: Record<string, unknown>;
33
- }
34
-
35
- /**
36
- * @public
37
- */
38
- export const parse: typeof parseYAML = async (
39
- source: string,
40
- options: ParseOptions = {},
41
- ): Promise<ParseResultElement> => {
42
- const refractorOpts: Record<string, unknown> = propOr({}, 'refractorOpts', options);
43
- const parserOpts = omit(['refractorOpts'], options);
44
- const parseResultElement = await parseYAML(source, parserOpts);
45
- const { result } = parseResultElement;
46
-
47
- if (isNotUndefined(result)) {
48
- const swaggerElement = refractSwagger(result, { consume: true, ...refractorOpts });
49
- swaggerElement.classes.push('result');
50
- parseResultElement.replaceResult(swaggerElement);
51
- }
52
-
53
- return parseResultElement;
54
- };
55
-
56
- /**
57
- * @public
58
- */
59
- export const namespace = new Namespace().use(openApiNamespace);
@@ -1,11 +0,0 @@
1
- import { mediaTypes, OpenAPIMediaTypes } from '@speclynx/apidom-ns-openapi-2';
2
-
3
- /**
4
- * @public
5
- */
6
- const yamlMediaTypes = new OpenAPIMediaTypes(
7
- ...mediaTypes.filterByFormat('generic'),
8
- ...mediaTypes.filterByFormat('yaml'),
9
- );
10
-
11
- export default yamlMediaTypes;