@speclynx/apidom-ns-openapi-3-1 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/CHANGELOG.md +10 -0
- package/dist/apidom-ns-openapi-3-1.browser.js +34 -10
- package/dist/apidom-ns-openapi-3-1.browser.min.js +1 -1
- package/package.json +10 -9
- package/src/elements/Callback.ts +0 -8
- package/src/elements/Components.ts +0 -17
- package/src/elements/Contact.ts +0 -8
- package/src/elements/Discriminator.ts +0 -8
- package/src/elements/Encoding.ts +0 -8
- package/src/elements/Example.ts +0 -8
- package/src/elements/ExternalDocumentation.ts +0 -8
- package/src/elements/Header.ts +0 -18
- package/src/elements/Info.ts +0 -27
- package/src/elements/JsonSchemaDialect.ts +0 -15
- package/src/elements/License.ts +0 -17
- package/src/elements/Link.ts +0 -8
- package/src/elements/MediaType.ts +0 -18
- package/src/elements/OAuthFlow.ts +0 -8
- package/src/elements/OAuthFlows.ts +0 -8
- package/src/elements/OpenApi3-1.ts +0 -107
- package/src/elements/Openapi.ts +0 -8
- package/src/elements/Operation.ts +0 -19
- package/src/elements/Parameter.ts +0 -18
- package/src/elements/PathItem.ts +0 -74
- package/src/elements/Paths.ts +0 -8
- package/src/elements/Reference.ts +0 -29
- package/src/elements/RequestBody.ts +0 -8
- package/src/elements/Response.ts +0 -8
- package/src/elements/Responses.ts +0 -8
- package/src/elements/Schema.ts +0 -59
- package/src/elements/SecurityRequirement.ts +0 -8
- package/src/elements/SecurityScheme.ts +0 -8
- package/src/elements/Server.ts +0 -8
- package/src/elements/ServerVariable.ts +0 -8
- package/src/elements/Tag.ts +0 -8
- package/src/elements/Xml.ts +0 -8
- package/src/elements/nces/ComponentsPathItems.ts +0 -15
- package/src/elements/nces/Webhooks.ts +0 -15
- package/src/index.ts +0 -592
- package/src/media-types.ts +0 -46
- package/src/namespace.ts +0 -80
- package/src/predicates.ts +0 -229
- package/src/refractor/index.ts +0 -380
- package/src/refractor/inspect.ts +0 -241
- package/src/refractor/plugins/normalize-header-examples/NormalizeStorage.ts +0 -53
- package/src/refractor/plugins/normalize-header-examples/index.ts +0 -125
- package/src/refractor/plugins/normalize-operation-ids.ts +0 -198
- package/src/refractor/plugins/normalize-parameter-examples.ts +0 -128
- package/src/refractor/plugins/normalize-parameters.ts +0 -136
- package/src/refractor/plugins/normalize-security-requirements.ts +0 -87
- package/src/refractor/plugins/normalize-servers.ts +0 -144
- package/src/refractor/plugins/replace-empty-element.ts +0 -726
- package/src/refractor/predicates.ts +0 -39
- package/src/refractor/specification.ts +0 -594
- package/src/refractor/toolbox.ts +0 -70
- package/src/refractor/visitors/open-api-3-1/JsonSchemaDialectVisitor.ts +0 -32
- package/src/refractor/visitors/open-api-3-1/OpenapiVisitor.ts +0 -30
- package/src/refractor/visitors/open-api-3-1/WebhooksVisitor.ts +0 -57
- package/src/refractor/visitors/open-api-3-1/bases.ts +0 -66
- package/src/refractor/visitors/open-api-3-1/callback/index.ts +0 -56
- package/src/refractor/visitors/open-api-3-1/components/PathItemsVisitor.ts +0 -45
- package/src/refractor/visitors/open-api-3-1/components/SchemasVisitor.ts +0 -26
- package/src/refractor/visitors/open-api-3-1/components/index.ts +0 -29
- package/src/refractor/visitors/open-api-3-1/contact/index.ts +0 -29
- package/src/refractor/visitors/open-api-3-1/distriminator/index.ts +0 -32
- package/src/refractor/visitors/open-api-3-1/encoding/index.ts +0 -29
- package/src/refractor/visitors/open-api-3-1/example/index.ts +0 -29
- package/src/refractor/visitors/open-api-3-1/external-documentation/index.ts +0 -29
- package/src/refractor/visitors/open-api-3-1/header/index.ts +0 -29
- package/src/refractor/visitors/open-api-3-1/index.ts +0 -52
- package/src/refractor/visitors/open-api-3-1/info/index.ts +0 -29
- package/src/refractor/visitors/open-api-3-1/license/index.ts +0 -29
- package/src/refractor/visitors/open-api-3-1/link/index.ts +0 -29
- package/src/refractor/visitors/open-api-3-1/media-type/index.ts +0 -29
- package/src/refractor/visitors/open-api-3-1/oauth-flow/index.ts +0 -29
- package/src/refractor/visitors/open-api-3-1/oauth-flows/index.ts +0 -29
- package/src/refractor/visitors/open-api-3-1/operation/index.ts +0 -29
- package/src/refractor/visitors/open-api-3-1/parameter/index.ts +0 -29
- package/src/refractor/visitors/open-api-3-1/path-item/index.ts +0 -29
- package/src/refractor/visitors/open-api-3-1/paths/index.ts +0 -29
- package/src/refractor/visitors/open-api-3-1/reference/index.ts +0 -29
- package/src/refractor/visitors/open-api-3-1/request-body/index.ts +0 -29
- package/src/refractor/visitors/open-api-3-1/response/index.ts +0 -29
- package/src/refractor/visitors/open-api-3-1/responses/index.ts +0 -29
- package/src/refractor/visitors/open-api-3-1/schema/$defsVisitor.ts +0 -21
- package/src/refractor/visitors/open-api-3-1/schema/AllOfVisitor.ts +0 -18
- package/src/refractor/visitors/open-api-3-1/schema/AnyOfVisitor.ts +0 -18
- package/src/refractor/visitors/open-api-3-1/schema/DependentSchemasVisitor.ts +0 -18
- package/src/refractor/visitors/open-api-3-1/schema/OneOfVisitor.ts +0 -18
- package/src/refractor/visitors/open-api-3-1/schema/PatternPropertiesVisitor.ts +0 -18
- package/src/refractor/visitors/open-api-3-1/schema/PrefixItemsVisitor.ts +0 -18
- package/src/refractor/visitors/open-api-3-1/schema/PropertiesVisitor.ts +0 -18
- package/src/refractor/visitors/open-api-3-1/schema/index.ts +0 -88
- package/src/refractor/visitors/open-api-3-1/security-requirement/index.ts +0 -29
- package/src/refractor/visitors/open-api-3-1/security-scheme/index.ts +0 -29
- package/src/refractor/visitors/open-api-3-1/server/index.ts +0 -29
- package/src/refractor/visitors/open-api-3-1/server-variable/index.ts +0 -29
- package/src/refractor/visitors/open-api-3-1/tag/index.ts +0 -29
- package/src/refractor/visitors/open-api-3-1/xml/index.ts +0 -29
package/src/refractor/toolbox.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Element,
|
|
3
|
-
Namespace,
|
|
4
|
-
ArrayElement,
|
|
5
|
-
isStringElement,
|
|
6
|
-
isArrayElement,
|
|
7
|
-
isObjectElement,
|
|
8
|
-
isMemberElement,
|
|
9
|
-
} from '@speclynx/apidom-datamodel';
|
|
10
|
-
import { toValue } from '@speclynx/apidom-core';
|
|
11
|
-
import { compile as compileJSONPointerTokens } from '@speclynx/apidom-json-pointer';
|
|
12
|
-
|
|
13
|
-
import * as openApi3_1Predicates from '../predicates.ts';
|
|
14
|
-
import * as refractorPredicates from './predicates.ts';
|
|
15
|
-
import openApi3_1Namespace from '../namespace.ts';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
export interface Toolbox {
|
|
21
|
-
predicates: Record<string, (...args: any[]) => boolean>;
|
|
22
|
-
ancestorLineageToJSONPointer: typeof ancestorLineageToJSONPointer;
|
|
23
|
-
namespace: Namespace;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Translates visitor ancestor lineage to a JSON Pointer tokens.
|
|
28
|
-
* Ancestor lineage is constructed of following visitor method arguments:
|
|
29
|
-
*
|
|
30
|
-
* - ancestors
|
|
31
|
-
* - parent
|
|
32
|
-
* - element
|
|
33
|
-
* @public
|
|
34
|
-
*/
|
|
35
|
-
export const ancestorLineageToJSONPointer = <T extends (Element | Element[])[]>(elementPath: T) => {
|
|
36
|
-
const jsonPointerTokens = elementPath.reduce((path, element, index) => {
|
|
37
|
-
if (isMemberElement(element)) {
|
|
38
|
-
const token = String(toValue(element.key));
|
|
39
|
-
path.push(token);
|
|
40
|
-
} else if (isArrayElement(elementPath[index - 2])) {
|
|
41
|
-
const arrayElement = elementPath[index - 2] as ArrayElement;
|
|
42
|
-
const token = String((arrayElement.content as Element[])?.indexOf(element as Element) ?? -1);
|
|
43
|
-
path.push(token);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return path;
|
|
47
|
-
}, [] as string[]);
|
|
48
|
-
|
|
49
|
-
return compileJSONPointerTokens(jsonPointerTokens);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* @public
|
|
54
|
-
*/
|
|
55
|
-
const createToolbox = (): Toolbox => {
|
|
56
|
-
const namespace = new Namespace();
|
|
57
|
-
const predicates = {
|
|
58
|
-
...refractorPredicates,
|
|
59
|
-
...openApi3_1Predicates,
|
|
60
|
-
isStringElement,
|
|
61
|
-
isArrayElement,
|
|
62
|
-
isObjectElement,
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
namespace.use(openApi3_1Namespace);
|
|
66
|
-
|
|
67
|
-
return { predicates, ancestorLineageToJSONPointer, namespace };
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export default createToolbox;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { StringElement } from '@speclynx/apidom-datamodel';
|
|
2
|
-
import { toValue } from '@speclynx/apidom-core';
|
|
3
|
-
import { Path } from '@speclynx/apidom-traverse';
|
|
4
|
-
|
|
5
|
-
import JsonSchemaDialectElement from '../../../elements/JsonSchemaDialect.ts';
|
|
6
|
-
import { BaseSpecificationVisitor, BaseSpecificationVisitorOptions } from './bases.ts';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @public
|
|
10
|
-
*/
|
|
11
|
-
export interface JsonSchemaDialectVisitorOptions extends BaseSpecificationVisitorOptions {}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
class JsonSchemaDialectVisitor extends BaseSpecificationVisitor {
|
|
17
|
-
declare public element: JsonSchemaDialectElement;
|
|
18
|
-
|
|
19
|
-
StringElement(path: Path<StringElement>) {
|
|
20
|
-
const stringElement = path.node;
|
|
21
|
-
const jsonSchemaDialectElement = new JsonSchemaDialectElement(
|
|
22
|
-
toValue(stringElement) as string | undefined,
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
this.copyMetaAndAttributes(stringElement, jsonSchemaDialectElement);
|
|
26
|
-
|
|
27
|
-
this.element = jsonSchemaDialectElement;
|
|
28
|
-
path.stop();
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export default JsonSchemaDialectVisitor;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { StringElement } from '@speclynx/apidom-datamodel';
|
|
2
|
-
import { toValue } from '@speclynx/apidom-core';
|
|
3
|
-
import { Path } from '@speclynx/apidom-traverse';
|
|
4
|
-
|
|
5
|
-
import { BaseSpecificationVisitor, BaseSpecificationVisitorOptions } from './bases.ts';
|
|
6
|
-
import OpenapiElement from '../../../elements/Openapi.ts';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @public
|
|
10
|
-
*/
|
|
11
|
-
export type { BaseSpecificationVisitorOptions as OpenapiVisitorOptions };
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
class OpenapiVisitor extends BaseSpecificationVisitor {
|
|
17
|
-
declare public element: OpenapiElement;
|
|
18
|
-
|
|
19
|
-
StringElement(path: Path<StringElement>) {
|
|
20
|
-
const stringElement = path.node;
|
|
21
|
-
const openapiElement = new OpenapiElement(toValue(stringElement) as string | undefined);
|
|
22
|
-
|
|
23
|
-
this.copyMetaAndAttributes(stringElement, openapiElement);
|
|
24
|
-
|
|
25
|
-
this.element = openapiElement;
|
|
26
|
-
path.stop();
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export default OpenapiVisitor;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { ObjectElement, StringElement } from '@speclynx/apidom-datamodel';
|
|
2
|
-
import { toValue } from '@speclynx/apidom-core';
|
|
3
|
-
import { Path } from '@speclynx/apidom-traverse';
|
|
4
|
-
import { isReferenceLikeElement, MapVisitor, SpecPath } from '@speclynx/apidom-ns-openapi-3-0';
|
|
5
|
-
|
|
6
|
-
import ReferenceElement from '../../../elements/Reference.ts';
|
|
7
|
-
import PathItemElement from '../../../elements/PathItem.ts';
|
|
8
|
-
import WebhooksElement from '../../../elements/nces/Webhooks.ts';
|
|
9
|
-
import { isPathItemElement, isReferenceElement } from '../../../predicates.ts';
|
|
10
|
-
import { BaseMapVisitor, BaseMapVisitorOptions } from './bases.ts';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
export interface WebhooksVisitorOptions extends BaseMapVisitorOptions {}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
class WebhooksVisitor extends BaseMapVisitor {
|
|
21
|
-
declare public readonly element: WebhooksElement;
|
|
22
|
-
|
|
23
|
-
declare protected readonly specPath: SpecPath<
|
|
24
|
-
['document', 'objects', 'Reference'] | ['document', 'objects', 'PathItem']
|
|
25
|
-
>;
|
|
26
|
-
|
|
27
|
-
constructor(options: WebhooksVisitorOptions) {
|
|
28
|
-
super(options);
|
|
29
|
-
this.element = new WebhooksElement();
|
|
30
|
-
this.specPath = (element: unknown) =>
|
|
31
|
-
isReferenceLikeElement(element)
|
|
32
|
-
? ['document', 'objects', 'Reference']
|
|
33
|
-
: ['document', 'objects', 'PathItem'];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
ObjectElement(path: Path<ObjectElement>) {
|
|
37
|
-
MapVisitor.prototype.ObjectElement.call(this, path);
|
|
38
|
-
|
|
39
|
-
// decorate every ReferenceElement with metadata about their referencing type
|
|
40
|
-
// @ts-ignore
|
|
41
|
-
this.element.filter(isReferenceElement).forEach((referenceElement: ReferenceElement) => {
|
|
42
|
-
// @ts-ignore
|
|
43
|
-
referenceElement.setMetaProperty('referenced-element', 'pathItem');
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
// decorate every PathItemElement with Webhook name metadata
|
|
47
|
-
this.element
|
|
48
|
-
.filter(isPathItemElement)
|
|
49
|
-
// @ts-ignore
|
|
50
|
-
.forEach((pathItemElement: PathItemElement, key: StringElement) => {
|
|
51
|
-
// @ts-ignore
|
|
52
|
-
pathItemElement.setMetaProperty('webhook-name', toValue(key));
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export default WebhooksVisitor;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { Mixin } from 'ts-mixer';
|
|
2
|
-
import {
|
|
3
|
-
SpecificationVisitor,
|
|
4
|
-
SpecificationVisitorOptions,
|
|
5
|
-
FallbackVisitor,
|
|
6
|
-
FallbackVisitorOptions,
|
|
7
|
-
FixedFieldsVisitor,
|
|
8
|
-
FixedFieldsVisitorOptions,
|
|
9
|
-
MapVisitor,
|
|
10
|
-
MapVisitorOptions,
|
|
11
|
-
} from '@speclynx/apidom-ns-openapi-3-0';
|
|
12
|
-
import {
|
|
13
|
-
ParentSchemaAwareVisitor,
|
|
14
|
-
ParentSchemaAwareVisitorOptions,
|
|
15
|
-
} from '@speclynx/apidom-ns-json-schema-2020-12';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Base class for visitors using Mixin(SpecificationVisitor, FallbackVisitor)
|
|
19
|
-
* @public
|
|
20
|
-
*/
|
|
21
|
-
export const BaseSpecificationVisitor = Mixin(SpecificationVisitor, FallbackVisitor);
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @public
|
|
25
|
-
*/
|
|
26
|
-
export interface BaseSpecificationVisitorOptions
|
|
27
|
-
extends SpecificationVisitorOptions, FallbackVisitorOptions {}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Base class for visitors using Mixin(FixedFieldsVisitor, FallbackVisitor)
|
|
31
|
-
* @public
|
|
32
|
-
*/
|
|
33
|
-
export const BaseFixedFieldsVisitor = Mixin(FixedFieldsVisitor, FallbackVisitor);
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @public
|
|
37
|
-
*/
|
|
38
|
-
export interface BaseFixedFieldsVisitorOptions
|
|
39
|
-
extends FixedFieldsVisitorOptions, FallbackVisitorOptions {}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Base class for visitors using Mixin(MapVisitor, FallbackVisitor)
|
|
43
|
-
* @public
|
|
44
|
-
*/
|
|
45
|
-
export const BaseMapVisitor = Mixin(MapVisitor, FallbackVisitor);
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* @public
|
|
49
|
-
*/
|
|
50
|
-
export interface BaseMapVisitorOptions extends MapVisitorOptions, FallbackVisitorOptions {}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Base class for visitors using Mixin(FixedFieldsVisitor, ParentSchemaAwareVisitor, FallbackVisitor)
|
|
54
|
-
* @public
|
|
55
|
-
*/
|
|
56
|
-
export const BaseSchemaVisitor = Mixin(
|
|
57
|
-
FixedFieldsVisitor,
|
|
58
|
-
ParentSchemaAwareVisitor,
|
|
59
|
-
FallbackVisitor,
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* @public
|
|
64
|
-
*/
|
|
65
|
-
export interface BaseSchemaVisitorOptions
|
|
66
|
-
extends FixedFieldsVisitorOptions, ParentSchemaAwareVisitorOptions, FallbackVisitorOptions {}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { ObjectElement } from '@speclynx/apidom-datamodel';
|
|
2
|
-
import { Path } from '@speclynx/apidom-traverse';
|
|
3
|
-
import {
|
|
4
|
-
isReferenceLikeElement,
|
|
5
|
-
specificationObj as OpenApi3_1Specification,
|
|
6
|
-
SpecPath,
|
|
7
|
-
CallbackVisitorOptions,
|
|
8
|
-
CallbackVisitor as CallbackVisitorType,
|
|
9
|
-
} from '@speclynx/apidom-ns-openapi-3-0';
|
|
10
|
-
|
|
11
|
-
import CallbackElement from '../../../../elements/Callback.ts';
|
|
12
|
-
import ReferenceElement from '../../../../elements/Reference.ts';
|
|
13
|
-
import { isReferenceElement } from '../../../../predicates.ts';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @public
|
|
17
|
-
*/
|
|
18
|
-
export const BaseCallbackVisitor: typeof CallbackVisitorType =
|
|
19
|
-
OpenApi3_1Specification.visitors.document.objects.Callback.$visitor;
|
|
20
|
-
|
|
21
|
-
export type { CallbackVisitorOptions };
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @public
|
|
25
|
-
*/
|
|
26
|
-
class CallbackVisitor extends BaseCallbackVisitor {
|
|
27
|
-
declare public readonly element: CallbackElement;
|
|
28
|
-
|
|
29
|
-
declare protected readonly specPath: SpecPath<
|
|
30
|
-
['document', 'objects', 'Reference'] | ['document', 'objects', 'PathItem']
|
|
31
|
-
>;
|
|
32
|
-
|
|
33
|
-
constructor(options: CallbackVisitorOptions) {
|
|
34
|
-
super(options);
|
|
35
|
-
this.element = new CallbackElement();
|
|
36
|
-
this.specPath = (element: unknown) => {
|
|
37
|
-
// @ts-ignore
|
|
38
|
-
return isReferenceLikeElement(element)
|
|
39
|
-
? ['document', 'objects', 'Reference']
|
|
40
|
-
: ['document', 'objects', 'PathItem'];
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
ObjectElement(path: Path<ObjectElement>) {
|
|
45
|
-
BaseCallbackVisitor.prototype.ObjectElement.call(this, path);
|
|
46
|
-
|
|
47
|
-
// decorate every ReferenceElement with metadata about their referencing type
|
|
48
|
-
// @ts-ignore
|
|
49
|
-
this.element.filter(isReferenceElement).forEach((referenceElement: ReferenceElement) => {
|
|
50
|
-
// @ts-ignore
|
|
51
|
-
referenceElement.setMetaProperty('referenced-element', 'pathItem');
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export default CallbackVisitor;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { ObjectElement } from '@speclynx/apidom-datamodel';
|
|
2
|
-
import { Path } from '@speclynx/apidom-traverse';
|
|
3
|
-
import { isReferenceLikeElement, MapVisitor, SpecPath } from '@speclynx/apidom-ns-openapi-3-0';
|
|
4
|
-
|
|
5
|
-
import ReferenceElement from '../../../../elements/Reference.ts';
|
|
6
|
-
import ComponentsPathItemsElement from '../../../../elements/nces/ComponentsPathItems.ts';
|
|
7
|
-
import { isReferenceElement } from '../../../../predicates.ts';
|
|
8
|
-
import { BaseMapVisitor, BaseMapVisitorOptions } from '../bases.ts';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @public
|
|
12
|
-
*/
|
|
13
|
-
export interface PathItemsVisitorOptions extends BaseMapVisitorOptions {}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @public
|
|
17
|
-
*/
|
|
18
|
-
class PathItemsVisitor extends BaseMapVisitor {
|
|
19
|
-
declare public readonly element: ComponentsPathItemsElement;
|
|
20
|
-
|
|
21
|
-
declare protected readonly specPath: SpecPath<
|
|
22
|
-
['document', 'objects', 'Reference'] | ['document', 'objects', 'PathItem']
|
|
23
|
-
>;
|
|
24
|
-
|
|
25
|
-
constructor(options: PathItemsVisitorOptions) {
|
|
26
|
-
super(options);
|
|
27
|
-
this.element = new ComponentsPathItemsElement();
|
|
28
|
-
this.specPath = (element: unknown) =>
|
|
29
|
-
isReferenceLikeElement(element)
|
|
30
|
-
? ['document', 'objects', 'Reference']
|
|
31
|
-
: ['document', 'objects', 'PathItem'];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
ObjectElement(path: Path<ObjectElement>) {
|
|
35
|
-
MapVisitor.prototype.ObjectElement.call(this, path);
|
|
36
|
-
|
|
37
|
-
// @ts-ignore
|
|
38
|
-
this.element.filter(isReferenceElement).forEach((referenceElement: ReferenceElement) => {
|
|
39
|
-
// @ts-ignore
|
|
40
|
-
referenceElement.setMetaProperty('referenced-element', 'pathItem');
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export default PathItemsVisitor;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { always } from 'ramda';
|
|
2
|
-
import { ComponentsSchemasElement, SpecPath } from '@speclynx/apidom-ns-openapi-3-0';
|
|
3
|
-
|
|
4
|
-
import { BaseMapVisitor, BaseMapVisitorOptions } from '../bases.ts';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @public
|
|
8
|
-
*/
|
|
9
|
-
export interface SchemasVisitorOptions extends BaseMapVisitorOptions {}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
class SchemasVisitor extends BaseMapVisitor {
|
|
15
|
-
declare public readonly element: ComponentsSchemasElement;
|
|
16
|
-
|
|
17
|
-
declare protected readonly specPath: SpecPath<['document', 'objects', 'Schema']>;
|
|
18
|
-
|
|
19
|
-
constructor(options: SchemasVisitorOptions) {
|
|
20
|
-
super(options);
|
|
21
|
-
this.element = new ComponentsSchemasElement();
|
|
22
|
-
this.specPath = always(['document', 'objects', 'Schema']);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export default SchemasVisitor;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
specificationObj as OpenApi3_1Specification,
|
|
3
|
-
ComponentsVisitorOptions,
|
|
4
|
-
ComponentsVisitor as ComponentsVisitorType,
|
|
5
|
-
} from '@speclynx/apidom-ns-openapi-3-0';
|
|
6
|
-
|
|
7
|
-
import ComponentsElement from '../../../../elements/Components.ts';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
export const BaseComponentsVisitor: typeof ComponentsVisitorType =
|
|
13
|
-
OpenApi3_1Specification.visitors.document.objects.Components.$visitor;
|
|
14
|
-
|
|
15
|
-
export type { ComponentsVisitorOptions };
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
class ComponentsVisitor extends BaseComponentsVisitor {
|
|
21
|
-
declare public readonly element: ComponentsElement;
|
|
22
|
-
|
|
23
|
-
constructor(options: ComponentsVisitorOptions) {
|
|
24
|
-
super(options);
|
|
25
|
-
this.element = new ComponentsElement();
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export default ComponentsVisitor;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
specificationObj as OpenApi3_1Specification,
|
|
3
|
-
ContactVisitorOptions,
|
|
4
|
-
ContactVisitor as ContactVisitorType,
|
|
5
|
-
} from '@speclynx/apidom-ns-openapi-3-0';
|
|
6
|
-
|
|
7
|
-
import ContactElement from '../../../../elements/Contact.ts';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
export const BaseContactVisitor: typeof ContactVisitorType =
|
|
13
|
-
OpenApi3_1Specification.visitors.document.objects.Contact.$visitor;
|
|
14
|
-
|
|
15
|
-
export type { ContactVisitorOptions };
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
class ContactVisitor extends BaseContactVisitor {
|
|
21
|
-
declare public readonly element: ContactElement;
|
|
22
|
-
|
|
23
|
-
constructor(options: ContactVisitorOptions) {
|
|
24
|
-
super(options);
|
|
25
|
-
this.element = new ContactElement();
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export default ContactVisitor;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
specificationObj as OpenApi3_1Specification,
|
|
3
|
-
DiscriminatorVisitorOptions,
|
|
4
|
-
DiscriminatorVisitor as DiscriminatorVisitorType,
|
|
5
|
-
} from '@speclynx/apidom-ns-openapi-3-0';
|
|
6
|
-
|
|
7
|
-
import DiscriminatorElement from '../../../../elements/Discriminator.ts';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
export const BaseDiscriminatorVisitor: typeof DiscriminatorVisitorType =
|
|
13
|
-
OpenApi3_1Specification.visitors.document.objects.Discriminator.$visitor;
|
|
14
|
-
|
|
15
|
-
export type { DiscriminatorVisitorOptions };
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
class DiscriminatorVisitor extends BaseDiscriminatorVisitor {
|
|
21
|
-
declare public readonly element: DiscriminatorElement;
|
|
22
|
-
|
|
23
|
-
declare protected readonly canSupportSpecificationExtensions: true;
|
|
24
|
-
|
|
25
|
-
constructor(options: DiscriminatorVisitorOptions) {
|
|
26
|
-
super(options);
|
|
27
|
-
this.element = new DiscriminatorElement();
|
|
28
|
-
this.canSupportSpecificationExtensions = true;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export default DiscriminatorVisitor;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
specificationObj as OpenApi3_1Specification,
|
|
3
|
-
EncodingVisitorOptions,
|
|
4
|
-
EncodingVisitor as EncodingVisitorType,
|
|
5
|
-
} from '@speclynx/apidom-ns-openapi-3-0';
|
|
6
|
-
|
|
7
|
-
import EncodingElement from '../../../../elements/Encoding.ts';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
export const BaseEncodingVisitor: typeof EncodingVisitorType =
|
|
13
|
-
OpenApi3_1Specification.visitors.document.objects.Encoding.$visitor;
|
|
14
|
-
|
|
15
|
-
export type { EncodingVisitorOptions };
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
class EncodingVisitor extends BaseEncodingVisitor {
|
|
21
|
-
declare public readonly element: EncodingElement;
|
|
22
|
-
|
|
23
|
-
constructor(options: EncodingVisitorOptions) {
|
|
24
|
-
super(options);
|
|
25
|
-
this.element = new EncodingElement();
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export default EncodingVisitor;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
specificationObj as OpenApi3_1Specification,
|
|
3
|
-
ExampleVisitorOptions,
|
|
4
|
-
ExampleVisitor as ExampleVisitorType,
|
|
5
|
-
} from '@speclynx/apidom-ns-openapi-3-0';
|
|
6
|
-
|
|
7
|
-
import ExampleElement from '../../../../elements/Example.ts';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
export const BaseExampleVisitor: typeof ExampleVisitorType =
|
|
13
|
-
OpenApi3_1Specification.visitors.document.objects.Example.$visitor;
|
|
14
|
-
|
|
15
|
-
export type { ExampleVisitorOptions };
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
class ExampleVisitor extends BaseExampleVisitor {
|
|
21
|
-
declare public readonly element: ExampleElement;
|
|
22
|
-
|
|
23
|
-
constructor(options: ExampleVisitorOptions) {
|
|
24
|
-
super(options);
|
|
25
|
-
this.element = new ExampleElement();
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export default ExampleVisitor;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
specificationObj as OpenApi3_1Specification,
|
|
3
|
-
ExternalDocumentationVisitorOptions,
|
|
4
|
-
ExternalDocumentationVisitor as ExternalDocumentationVisitorType,
|
|
5
|
-
} from '@speclynx/apidom-ns-openapi-3-0';
|
|
6
|
-
|
|
7
|
-
import ExternalDocumentationElement from '../../../../elements/ExternalDocumentation.ts';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
export const BaseExternalDocumentationVisitor: typeof ExternalDocumentationVisitorType =
|
|
13
|
-
OpenApi3_1Specification.visitors.document.objects.ExternalDocumentation.$visitor;
|
|
14
|
-
|
|
15
|
-
export type { ExternalDocumentationVisitorOptions };
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
class ExternalDocumentationVisitor extends BaseExternalDocumentationVisitor {
|
|
21
|
-
declare public readonly element: ExternalDocumentationElement;
|
|
22
|
-
|
|
23
|
-
constructor(options: ExternalDocumentationVisitorOptions) {
|
|
24
|
-
super(options);
|
|
25
|
-
this.element = new ExternalDocumentationElement();
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export default ExternalDocumentationVisitor;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
specificationObj as OpenApi3_1Specification,
|
|
3
|
-
HeaderVisitorOptions,
|
|
4
|
-
HeaderVisitor as HeaderVisitorType,
|
|
5
|
-
} from '@speclynx/apidom-ns-openapi-3-0';
|
|
6
|
-
|
|
7
|
-
import HeaderElement from '../../../../elements/Header.ts';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
export const BaseHeaderVisitor: typeof HeaderVisitorType =
|
|
13
|
-
OpenApi3_1Specification.visitors.document.objects.Header.$visitor;
|
|
14
|
-
|
|
15
|
-
export type { HeaderVisitorOptions };
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
class HeaderVisitor extends BaseHeaderVisitor {
|
|
21
|
-
declare public readonly element: HeaderElement;
|
|
22
|
-
|
|
23
|
-
constructor(options: HeaderVisitorOptions) {
|
|
24
|
-
super(options);
|
|
25
|
-
this.element = new HeaderElement();
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export default HeaderVisitor;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { always } from 'ramda';
|
|
2
|
-
import { ObjectElement, isStringElement } from '@speclynx/apidom-datamodel';
|
|
3
|
-
import { toValue } from '@speclynx/apidom-core';
|
|
4
|
-
import { Path } from '@speclynx/apidom-traverse';
|
|
5
|
-
import { FixedFieldsVisitor, SpecPath } from '@speclynx/apidom-ns-openapi-3-0';
|
|
6
|
-
|
|
7
|
-
import OpenApi3_1Element from '../../../elements/OpenApi3-1.ts';
|
|
8
|
-
import { BaseFixedFieldsVisitor, BaseFixedFieldsVisitorOptions } from './bases.ts';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @public
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
export interface OpenApi3_1VisitorOptions extends BaseFixedFieldsVisitorOptions {}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @public
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
class OpenApi3_1Visitor extends BaseFixedFieldsVisitor {
|
|
21
|
-
declare public readonly element: OpenApi3_1Element;
|
|
22
|
-
|
|
23
|
-
declare protected readonly specPath: SpecPath<['document', 'objects', 'OpenApi']>;
|
|
24
|
-
|
|
25
|
-
declare protected readonly canSupportSpecificationExtensions: true;
|
|
26
|
-
|
|
27
|
-
declare protected readonly openApiSemanticElement: OpenApi3_1Element;
|
|
28
|
-
|
|
29
|
-
constructor(options: OpenApi3_1VisitorOptions) {
|
|
30
|
-
super(options);
|
|
31
|
-
this.element = new OpenApi3_1Element();
|
|
32
|
-
this.specPath = always(['document', 'objects', 'OpenApi']);
|
|
33
|
-
this.canSupportSpecificationExtensions = true;
|
|
34
|
-
this.consumeSafe = true;
|
|
35
|
-
this.openApiSemanticElement = this.element;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
ObjectElement(path: Path<ObjectElement>) {
|
|
39
|
-
const objectElement = path.node;
|
|
40
|
-
this.openApiGenericElement = objectElement;
|
|
41
|
-
// precompute values from generic root before consume may release fields
|
|
42
|
-
if (isStringElement(objectElement.get('jsonSchemaDialect'))) {
|
|
43
|
-
this.sourceContext = {
|
|
44
|
-
jsonSchemaDialect: toValue(objectElement.get('jsonSchemaDialect')) as string,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
FixedFieldsVisitor.prototype.ObjectElement.call(this, path);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export default OpenApi3_1Visitor;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
specificationObj as OpenApi3_1Specification,
|
|
3
|
-
InfoVisitorOptions,
|
|
4
|
-
InfoVisitor as InfoVisitorType,
|
|
5
|
-
} from '@speclynx/apidom-ns-openapi-3-0';
|
|
6
|
-
|
|
7
|
-
import InfoElement from '../../../../elements/Info.ts';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
export const BaseInfoVisitor: typeof InfoVisitorType =
|
|
13
|
-
OpenApi3_1Specification.visitors.document.objects.Info.$visitor;
|
|
14
|
-
|
|
15
|
-
export type { InfoVisitorOptions };
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
class InfoVisitor extends BaseInfoVisitor {
|
|
21
|
-
declare public readonly element: InfoElement;
|
|
22
|
-
|
|
23
|
-
constructor(options: InfoVisitorOptions) {
|
|
24
|
-
super(options);
|
|
25
|
-
this.element = new InfoElement();
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export default InfoVisitor;
|