@speclynx/apidom-ns-openapi-3-0 4.0.3 → 4.0.4
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 +6 -0
- package/dist/apidom-ns-openapi-3-0.browser.js +2 -2
- package/dist/apidom-ns-openapi-3-0.browser.min.js +1 -1
- package/package.json +9 -8
- package/src/elements/Callback.ts +0 -13
- package/src/elements/Components.ts +0 -85
- package/src/elements/Contact.ts +0 -42
- package/src/elements/Discriminator.ts +0 -34
- package/src/elements/Encoding.ts +0 -59
- package/src/elements/Example.ts +0 -51
- package/src/elements/ExternalDocumentation.ts +0 -34
- package/src/elements/Header.ts +0 -119
- package/src/elements/Info.ts +0 -70
- package/src/elements/License.ts +0 -34
- package/src/elements/Link.ts +0 -85
- package/src/elements/MediaType.ts +0 -48
- package/src/elements/OAuthFlow.ts +0 -50
- package/src/elements/OAuthFlows.ts +0 -47
- package/src/elements/OpenApi3-0.ts +0 -90
- package/src/elements/Openapi.ts +0 -15
- package/src/elements/Operation.ts +0 -124
- package/src/elements/Parameter.ts +0 -135
- package/src/elements/PathItem.ts +0 -125
- package/src/elements/Paths.ts +0 -13
- package/src/elements/Reference.ts +0 -27
- package/src/elements/RequestBody.ts +0 -46
- package/src/elements/Response.ts +0 -50
- package/src/elements/Responses.ts +0 -24
- package/src/elements/Schema.ts +0 -230
- package/src/elements/SecurityRequirement.ts +0 -13
- package/src/elements/SecurityScheme.ts +0 -84
- package/src/elements/Server.ts +0 -42
- package/src/elements/ServerVariable.ts +0 -43
- package/src/elements/Tag.ts +0 -44
- package/src/elements/Xml.ts +0 -59
- package/src/elements/nces/ComponentsCallbacks.ts +0 -15
- package/src/elements/nces/ComponentsExamples.ts +0 -16
- package/src/elements/nces/ComponentsHeaders.ts +0 -15
- package/src/elements/nces/ComponentsLinks.ts +0 -15
- package/src/elements/nces/ComponentsParameters.ts +0 -16
- package/src/elements/nces/ComponentsRequestBodies.ts +0 -15
- package/src/elements/nces/ComponentsResponses.ts +0 -15
- package/src/elements/nces/ComponentsSchemas.ts +0 -15
- package/src/elements/nces/ComponentsSecuritySchemes.ts +0 -15
- package/src/elements/nces/DiscriminatorMapping.ts +0 -15
- package/src/elements/nces/EncodingHeaders.ts +0 -15
- package/src/elements/nces/HeaderContent.ts +0 -16
- package/src/elements/nces/HeaderExamples.ts +0 -16
- package/src/elements/nces/LinkParameters.ts +0 -15
- package/src/elements/nces/MediaTypeEncoding.ts +0 -15
- package/src/elements/nces/MediaTypeExamples.ts +0 -16
- package/src/elements/nces/OAuthFlowScopes.ts +0 -15
- package/src/elements/nces/OperationCallbacks.ts +0 -15
- package/src/elements/nces/OperationParameters.ts +0 -16
- package/src/elements/nces/OperationSecurity.ts +0 -16
- package/src/elements/nces/OperationServers.ts +0 -16
- package/src/elements/nces/OperationTags.ts +0 -15
- package/src/elements/nces/ParameterContent.ts +0 -16
- package/src/elements/nces/ParameterExamples.ts +0 -16
- package/src/elements/nces/PathItemParameters.ts +0 -16
- package/src/elements/nces/PathItemServers.ts +0 -16
- package/src/elements/nces/RequestBodyContent.ts +0 -16
- package/src/elements/nces/ResponseContent.ts +0 -16
- package/src/elements/nces/ResponseHeaders.ts +0 -15
- package/src/elements/nces/ResponseLinks.ts +0 -15
- package/src/elements/nces/Security.ts +0 -15
- package/src/elements/nces/ServerVariables.ts +0 -15
- package/src/elements/nces/Servers.ts +0 -15
- package/src/elements/nces/Tags.ts +0 -15
- package/src/index.ts +0 -550
- package/src/media-types.ts +0 -52
- package/src/namespace.ts +0 -78
- package/src/predicates.ts +0 -185
- package/src/refractor/index.ts +0 -370
- package/src/refractor/inspect.ts +0 -239
- package/src/refractor/plugins/replace-empty-element.ts +0 -656
- package/src/refractor/predicates.ts +0 -39
- package/src/refractor/specification.ts +0 -557
- package/src/refractor/toolbox.ts +0 -24
- package/src/refractor/visitors/FallbackVisitor.ts +0 -24
- package/src/refractor/visitors/SpecificationExtensionVisitor.ts +0 -22
- package/src/refractor/visitors/SpecificationVisitor.ts +0 -112
- package/src/refractor/visitors/Visitor.ts +0 -47
- package/src/refractor/visitors/generics/AlternatingVisitor.ts +0 -45
- package/src/refractor/visitors/generics/FixedFieldsVisitor.ts +0 -110
- package/src/refractor/visitors/generics/MapVisitor.ts +0 -25
- package/src/refractor/visitors/generics/MixedFieldsVisitor.ts +0 -77
- package/src/refractor/visitors/generics/PatternedFieldsVisitor.ts +0 -99
- package/src/refractor/visitors/open-api-3-0/ContentVisitor.ts +0 -28
- package/src/refractor/visitors/open-api-3-0/ExamplesVisitor.ts +0 -48
- package/src/refractor/visitors/open-api-3-0/OpenapiVisitor.ts +0 -30
- package/src/refractor/visitors/open-api-3-0/ParametersVisitor.ts +0 -47
- package/src/refractor/visitors/open-api-3-0/SecurityVisitor.ts +0 -44
- package/src/refractor/visitors/open-api-3-0/ServersVisitor.ts +0 -40
- package/src/refractor/visitors/open-api-3-0/TagsVisitor.ts +0 -40
- package/src/refractor/visitors/open-api-3-0/bases.ts +0 -82
- package/src/refractor/visitors/open-api-3-0/callback/index.ts +0 -49
- package/src/refractor/visitors/open-api-3-0/components/CallbacksVisitor.ts +0 -45
- package/src/refractor/visitors/open-api-3-0/components/ExamplesVisitor.ts +0 -46
- package/src/refractor/visitors/open-api-3-0/components/HeadersVisitor.ts +0 -53
- package/src/refractor/visitors/open-api-3-0/components/LinksVisitor.ts +0 -45
- package/src/refractor/visitors/open-api-3-0/components/ParametersVisitor.ts +0 -46
- package/src/refractor/visitors/open-api-3-0/components/RequestBodiesVisitor.ts +0 -45
- package/src/refractor/visitors/open-api-3-0/components/ResponsesVisitor.ts +0 -53
- package/src/refractor/visitors/open-api-3-0/components/SchemasVisitor.ts +0 -46
- package/src/refractor/visitors/open-api-3-0/components/SecuritySchemesVisitor.ts +0 -45
- package/src/refractor/visitors/open-api-3-0/components/index.ts +0 -31
- package/src/refractor/visitors/open-api-3-0/contact/index.ts +0 -27
- package/src/refractor/visitors/open-api-3-0/distriminator/MappingVisitor.ts +0 -24
- package/src/refractor/visitors/open-api-3-0/distriminator/index.ts +0 -27
- package/src/refractor/visitors/open-api-3-0/encoding/HeadersVisitor.ts +0 -57
- package/src/refractor/visitors/open-api-3-0/encoding/index.ts +0 -49
- package/src/refractor/visitors/open-api-3-0/example/ExternalValueVisitor.ts +0 -20
- package/src/refractor/visitors/open-api-3-0/example/index.ts +0 -38
- package/src/refractor/visitors/open-api-3-0/external-documentation/index.ts +0 -27
- package/src/refractor/visitors/open-api-3-0/header/ContentVisitor.ts +0 -18
- package/src/refractor/visitors/open-api-3-0/header/ExamplesVisitor.ts +0 -18
- package/src/refractor/visitors/open-api-3-0/header/SchemaVisitor.ts +0 -33
- package/src/refractor/visitors/open-api-3-0/header/index.ts +0 -27
- package/src/refractor/visitors/open-api-3-0/index.ts +0 -39
- package/src/refractor/visitors/open-api-3-0/info/VersionVisitor.ts +0 -21
- package/src/refractor/visitors/open-api-3-0/info/index.ts +0 -27
- package/src/refractor/visitors/open-api-3-0/license/index.ts +0 -27
- package/src/refractor/visitors/open-api-3-0/link/OperationIdVisitor.ts +0 -20
- package/src/refractor/visitors/open-api-3-0/link/OperationRefVisitor.ts +0 -20
- package/src/refractor/visitors/open-api-3-0/link/ParametersVisitor.ts +0 -24
- package/src/refractor/visitors/open-api-3-0/link/index.ts +0 -38
- package/src/refractor/visitors/open-api-3-0/media-type/EncodingVisitor.ts +0 -24
- package/src/refractor/visitors/open-api-3-0/media-type/ExamplesVisitor.ts +0 -18
- package/src/refractor/visitors/open-api-3-0/media-type/SchemaVisitor.ts +0 -33
- package/src/refractor/visitors/open-api-3-0/media-type/index.ts +0 -27
- package/src/refractor/visitors/open-api-3-0/oauth-flow/ScopesVisitor.ts +0 -24
- package/src/refractor/visitors/open-api-3-0/oauth-flow/index.ts +0 -27
- package/src/refractor/visitors/open-api-3-0/oauth-flows/index.ts +0 -27
- package/src/refractor/visitors/open-api-3-0/operation/CallbacksVisitor.ts +0 -45
- package/src/refractor/visitors/open-api-3-0/operation/ParametersVisitor.ts +0 -18
- package/src/refractor/visitors/open-api-3-0/operation/RequestBodyVisitor.ts +0 -39
- package/src/refractor/visitors/open-api-3-0/operation/SecurityVisitor.ts +0 -41
- package/src/refractor/visitors/open-api-3-0/operation/ServersVisitor.ts +0 -18
- package/src/refractor/visitors/open-api-3-0/operation/TagsVisitor.ts +0 -32
- package/src/refractor/visitors/open-api-3-0/operation/index.ts +0 -27
- package/src/refractor/visitors/open-api-3-0/parameter/ContentVisitor.ts +0 -18
- package/src/refractor/visitors/open-api-3-0/parameter/ExamplesVisitor.ts +0 -18
- package/src/refractor/visitors/open-api-3-0/parameter/SchemaVisitor.ts +0 -36
- package/src/refractor/visitors/open-api-3-0/parameter/index.ts +0 -49
- package/src/refractor/visitors/open-api-3-0/path-item/$RefVisitor.ts +0 -20
- package/src/refractor/visitors/open-api-3-0/path-item/ParametersVisitor.ts +0 -18
- package/src/refractor/visitors/open-api-3-0/path-item/ServersVisitor.ts +0 -18
- package/src/refractor/visitors/open-api-3-0/path-item/index.ts +0 -53
- package/src/refractor/visitors/open-api-3-0/paths/index.ts +0 -51
- package/src/refractor/visitors/open-api-3-0/reference/$RefVisitor.ts +0 -20
- package/src/refractor/visitors/open-api-3-0/reference/index.ts +0 -41
- package/src/refractor/visitors/open-api-3-0/request-body/ContentVisitor.ts +0 -18
- package/src/refractor/visitors/open-api-3-0/request-body/index.ts +0 -46
- package/src/refractor/visitors/open-api-3-0/response/ContentVisitor.ts +0 -18
- package/src/refractor/visitors/open-api-3-0/response/HeadersVisitor.ts +0 -57
- package/src/refractor/visitors/open-api-3-0/response/LinksVisitor.ts +0 -45
- package/src/refractor/visitors/open-api-3-0/response/index.ts +0 -57
- package/src/refractor/visitors/open-api-3-0/responses/DefaultVisitor.ts +0 -39
- package/src/refractor/visitors/open-api-3-0/responses/index.ts +0 -64
- package/src/refractor/visitors/open-api-3-0/schema/AllOfVisitor.ts +0 -34
- package/src/refractor/visitors/open-api-3-0/schema/AnyOfVisitor.ts +0 -34
- package/src/refractor/visitors/open-api-3-0/schema/ItemsVisitor.ts +0 -31
- package/src/refractor/visitors/open-api-3-0/schema/OneOfVisitor.ts +0 -34
- package/src/refractor/visitors/open-api-3-0/schema/PropertiesVisitor.ts +0 -34
- package/src/refractor/visitors/open-api-3-0/schema/SchemaOrReferenceVisitor.ts +0 -36
- package/src/refractor/visitors/open-api-3-0/schema/TypeVisitor.ts +0 -26
- package/src/refractor/visitors/open-api-3-0/schema/index.ts +0 -30
- package/src/refractor/visitors/open-api-3-0/security-requirement/index.ts +0 -24
- package/src/refractor/visitors/open-api-3-0/security-scheme/index.ts +0 -27
- package/src/refractor/visitors/open-api-3-0/server/UrlVisitor.ts +0 -20
- package/src/refractor/visitors/open-api-3-0/server/VariablesVisitor.ts +0 -24
- package/src/refractor/visitors/open-api-3-0/server/index.ts +0 -27
- package/src/refractor/visitors/open-api-3-0/server-variable/index.ts +0 -27
- package/src/refractor/visitors/open-api-3-0/tag/index.ts +0 -27
- package/src/refractor/visitors/open-api-3-0/xml/index.ts +0 -27
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { always } from 'ramda';
|
|
2
|
-
import { StringElement, ObjectElement, isStringElement } from '@speclynx/apidom-datamodel';
|
|
3
|
-
import { toValue } from '@speclynx/apidom-core';
|
|
4
|
-
import { Path } from '@speclynx/apidom-traverse';
|
|
5
|
-
|
|
6
|
-
import PathItemElement from '../../../../elements/PathItem.ts';
|
|
7
|
-
import OperationElement from '../../../../elements/Operation.ts';
|
|
8
|
-
import { isOperationElement } from '../../../../predicates.ts';
|
|
9
|
-
import { SpecPath } from '../../generics/FixedFieldsVisitor.ts';
|
|
10
|
-
import { BaseFixedFieldsVisitor, BaseFixedFieldsVisitorOptions } from '../bases.ts';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
export type { BaseFixedFieldsVisitorOptions as PathItemVisitorOptions };
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
class PathItemVisitor extends BaseFixedFieldsVisitor {
|
|
21
|
-
declare public readonly element: PathItemElement;
|
|
22
|
-
|
|
23
|
-
declare protected readonly specPath: SpecPath<['document', 'objects', 'PathItem']>;
|
|
24
|
-
|
|
25
|
-
constructor(options: BaseFixedFieldsVisitorOptions) {
|
|
26
|
-
super(options);
|
|
27
|
-
this.element = new PathItemElement();
|
|
28
|
-
this.specPath = always(['document', 'objects', 'PathItem']);
|
|
29
|
-
this.consumeSafe = true;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
ObjectElement(path: Path<ObjectElement>) {
|
|
33
|
-
BaseFixedFieldsVisitor.prototype.ObjectElement.call(this, path);
|
|
34
|
-
|
|
35
|
-
// decorate Operation elements with HTTP method
|
|
36
|
-
this.element
|
|
37
|
-
.filter(isOperationElement)
|
|
38
|
-
// @ts-ignore
|
|
39
|
-
.forEach((operationElement: OperationElement, httpMethodElementCI: StringElement) => {
|
|
40
|
-
operationElement.meta.set(
|
|
41
|
-
'http-method',
|
|
42
|
-
(toValue(httpMethodElementCI) as string).toUpperCase(),
|
|
43
|
-
);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
// mark this PathItemElement with reference metadata
|
|
47
|
-
if (isStringElement(this.element.$ref)) {
|
|
48
|
-
this.element.classes.push('reference-element');
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export default PathItemVisitor;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { T as stubTrue, always } from 'ramda';
|
|
2
|
-
import { ObjectElement, StringElement } from '@speclynx/apidom-datamodel';
|
|
3
|
-
import { toValue } from '@speclynx/apidom-core';
|
|
4
|
-
import { Path } from '@speclynx/apidom-traverse';
|
|
5
|
-
|
|
6
|
-
import PathsElement from '../../../../elements/Paths.ts';
|
|
7
|
-
import PathItemElement from '../../../../elements/PathItem.ts';
|
|
8
|
-
import { SpecPath } from '../../generics/PatternedFieldsVisitor.ts';
|
|
9
|
-
import { isPathItemElement } from '../../../../predicates.ts';
|
|
10
|
-
import { BasePatternedFieldsVisitor, BasePatternedFieldsVisitorOptions } from '../bases.ts';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
export type { BasePatternedFieldsVisitorOptions as PathsVisitorOptions };
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
class PathsVisitor extends BasePatternedFieldsVisitor {
|
|
21
|
-
declare public readonly element: PathsElement;
|
|
22
|
-
|
|
23
|
-
declare protected readonly specPath: SpecPath<['document', 'objects', 'PathItem']>;
|
|
24
|
-
|
|
25
|
-
declare protected readonly canSupportSpecificationExtensions: true;
|
|
26
|
-
|
|
27
|
-
constructor(options: BasePatternedFieldsVisitorOptions) {
|
|
28
|
-
super(options);
|
|
29
|
-
this.element = new PathsElement();
|
|
30
|
-
this.specPath = always(['document', 'objects', 'PathItem']);
|
|
31
|
-
this.canSupportSpecificationExtensions = true;
|
|
32
|
-
this.consumeSafe = true;
|
|
33
|
-
this.fieldPatternPredicate = stubTrue;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
ObjectElement(path: Path<ObjectElement>) {
|
|
37
|
-
BasePatternedFieldsVisitor.prototype.ObjectElement.call(this, path);
|
|
38
|
-
|
|
39
|
-
// decorate every PathItemElement with path metadata
|
|
40
|
-
this.element
|
|
41
|
-
.filter(isPathItemElement)
|
|
42
|
-
// @ts-ignore
|
|
43
|
-
.forEach((pathItemElement: PathItemElement, key: StringElement) => {
|
|
44
|
-
key.classes.push('openapi-path-template');
|
|
45
|
-
key.classes.push('path-template');
|
|
46
|
-
pathItemElement.meta.set('path', toValue(key) as string);
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export default PathsVisitor;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { StringElement } from '@speclynx/apidom-datamodel';
|
|
2
|
-
import { Path } from '@speclynx/apidom-traverse';
|
|
3
|
-
|
|
4
|
-
import FallbackVisitor, { FallbackVisitorOptions } from '../../FallbackVisitor.ts';
|
|
5
|
-
|
|
6
|
-
export type { FallbackVisitorOptions as $RefVisitorOptions };
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @public
|
|
10
|
-
*/
|
|
11
|
-
class $RefVisitor extends FallbackVisitor {
|
|
12
|
-
declare public readonly element: StringElement;
|
|
13
|
-
|
|
14
|
-
StringElement(path: Path<StringElement>) {
|
|
15
|
-
super.enter(path);
|
|
16
|
-
this.element.classes.push('reference-value');
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default $RefVisitor;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { always } from 'ramda';
|
|
2
|
-
import { ObjectElement, isStringElement } from '@speclynx/apidom-datamodel';
|
|
3
|
-
import { Path } from '@speclynx/apidom-traverse';
|
|
4
|
-
|
|
5
|
-
import ReferenceElement from '../../../../elements/Reference.ts';
|
|
6
|
-
import { SpecPath } from '../../generics/FixedFieldsVisitor.ts';
|
|
7
|
-
import { BaseFixedFieldsVisitor, BaseFixedFieldsVisitorOptions } from '../bases.ts';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
export type { BaseFixedFieldsVisitorOptions as ReferenceVisitorOptions };
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @public
|
|
16
|
-
*/
|
|
17
|
-
class ReferenceVisitor extends BaseFixedFieldsVisitor {
|
|
18
|
-
declare public readonly element: ReferenceElement;
|
|
19
|
-
|
|
20
|
-
declare protected readonly specPath: SpecPath<['document', 'objects', 'Reference']>;
|
|
21
|
-
|
|
22
|
-
declare protected readonly canSupportSpecificationExtensions: false;
|
|
23
|
-
|
|
24
|
-
constructor(options: BaseFixedFieldsVisitorOptions) {
|
|
25
|
-
super(options);
|
|
26
|
-
this.element = new ReferenceElement();
|
|
27
|
-
this.specPath = always(['document', 'objects', 'Reference']);
|
|
28
|
-
this.canSupportSpecificationExtensions = false;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
ObjectElement(path: Path<ObjectElement>) {
|
|
32
|
-
BaseFixedFieldsVisitor.prototype.ObjectElement.call(this, path);
|
|
33
|
-
|
|
34
|
-
// mark this ReferenceElement with reference metadata
|
|
35
|
-
if (isStringElement(this.element.$ref)) {
|
|
36
|
-
this.element.classes.push('reference-element');
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export default ReferenceVisitor;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import RequestBodyContentElement from '../../../../elements/nces/RequestBodyContent.ts';
|
|
2
|
-
import BaseContentVisitor, { ContentVisitorOptions } from '../ContentVisitor.ts';
|
|
3
|
-
|
|
4
|
-
export type { ContentVisitorOptions };
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @public
|
|
8
|
-
*/
|
|
9
|
-
class ContentVisitor extends BaseContentVisitor {
|
|
10
|
-
declare public readonly element: RequestBodyContentElement;
|
|
11
|
-
|
|
12
|
-
constructor(options: ContentVisitorOptions) {
|
|
13
|
-
super(options);
|
|
14
|
-
this.element = new RequestBodyContentElement();
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default ContentVisitor;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { always } from 'ramda';
|
|
2
|
-
import { StringElement, ObjectElement, isObjectElement } from '@speclynx/apidom-datamodel';
|
|
3
|
-
import { toValue } from '@speclynx/apidom-core';
|
|
4
|
-
import { Path } from '@speclynx/apidom-traverse';
|
|
5
|
-
|
|
6
|
-
import RequestBodyElement from '../../../../elements/RequestBody.ts';
|
|
7
|
-
import MediaTypeElement from '../../../../elements/MediaType.ts';
|
|
8
|
-
import FixedFieldsVisitor, { SpecPath } from '../../generics/FixedFieldsVisitor.ts';
|
|
9
|
-
import { isMediaTypeElement } from '../../../../predicates.ts';
|
|
10
|
-
import { BaseFixedFieldsVisitor, BaseFixedFieldsVisitorOptions } from '../bases.ts';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
export type { BaseFixedFieldsVisitorOptions as RequestBodyVisitorOptions };
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
class RequestBodyVisitor extends BaseFixedFieldsVisitor {
|
|
21
|
-
declare public readonly element: RequestBodyElement;
|
|
22
|
-
|
|
23
|
-
declare protected readonly specPath: SpecPath<['document', 'objects', 'RequestBody']>;
|
|
24
|
-
|
|
25
|
-
constructor(options: BaseFixedFieldsVisitorOptions) {
|
|
26
|
-
super(options);
|
|
27
|
-
this.element = new RequestBodyElement();
|
|
28
|
-
this.specPath = always(['document', 'objects', 'RequestBody']);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
ObjectElement(path: Path<ObjectElement>) {
|
|
32
|
-
FixedFieldsVisitor.prototype.ObjectElement.call(this, path);
|
|
33
|
-
|
|
34
|
-
// decorate every MediaTypeElement with media type metadata
|
|
35
|
-
if (isObjectElement(this.element.contentField)) {
|
|
36
|
-
this.element.contentField
|
|
37
|
-
.filter(isMediaTypeElement)
|
|
38
|
-
// @ts-ignore
|
|
39
|
-
.forEach((mediaTypeElement: MediaTypeElement, key: StringElement) => {
|
|
40
|
-
mediaTypeElement.meta.set('media-type', toValue(key));
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export default RequestBodyVisitor;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import ResponseContentElement from '../../../../elements/nces/ResponseContent.ts';
|
|
2
|
-
import BaseContentVisitor, { ContentVisitorOptions } from '../ContentVisitor.ts';
|
|
3
|
-
|
|
4
|
-
export type { ContentVisitorOptions };
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @public
|
|
8
|
-
*/
|
|
9
|
-
class ContentVisitor extends BaseContentVisitor {
|
|
10
|
-
declare public readonly element: ResponseContentElement;
|
|
11
|
-
|
|
12
|
-
constructor(options: ContentVisitorOptions) {
|
|
13
|
-
super(options);
|
|
14
|
-
this.element = new ResponseContentElement();
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default ContentVisitor;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { ObjectElement, Element, StringElement } from '@speclynx/apidom-datamodel';
|
|
2
|
-
import { toValue } from '@speclynx/apidom-core';
|
|
3
|
-
import { Path } from '@speclynx/apidom-traverse';
|
|
4
|
-
|
|
5
|
-
import ReferenceElement from '../../../../elements/Reference.ts';
|
|
6
|
-
import ResponseHeadersElement from '../../../../elements/nces/ResponseHeaders.ts';
|
|
7
|
-
import { SpecPath } from '../../generics/MapVisitor.ts';
|
|
8
|
-
import { isReferenceLikeElement } from '../../../predicates.ts';
|
|
9
|
-
import { isHeaderElement, isReferenceElement } from '../../../../predicates.ts';
|
|
10
|
-
import { BaseMapVisitor, BaseMapVisitorOptions } from '../bases.ts';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
export type { BaseMapVisitorOptions as HeadersVisitorOptions };
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
class HeadersVisitor extends BaseMapVisitor {
|
|
21
|
-
declare public readonly element: ResponseHeadersElement;
|
|
22
|
-
|
|
23
|
-
declare protected readonly specPath: SpecPath<
|
|
24
|
-
['document', 'objects', 'Reference'] | ['document', 'objects', 'Header']
|
|
25
|
-
>;
|
|
26
|
-
|
|
27
|
-
constructor(options: BaseMapVisitorOptions) {
|
|
28
|
-
super(options);
|
|
29
|
-
this.element = new ResponseHeadersElement();
|
|
30
|
-
this.specPath = (element: unknown) =>
|
|
31
|
-
isReferenceLikeElement(element)
|
|
32
|
-
? ['document', 'objects', 'Reference']
|
|
33
|
-
: ['document', 'objects', 'Header'];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
ObjectElement(path: Path<ObjectElement>) {
|
|
37
|
-
BaseMapVisitor.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
|
-
referenceElement.meta.set('referenced-element', 'header');
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
// decorate every HeaderElement with metadata about their name
|
|
46
|
-
// @ts-ignore
|
|
47
|
-
this.element.forEach((value: Element, key: StringElement): void => {
|
|
48
|
-
if (!isHeaderElement(value)) return;
|
|
49
|
-
|
|
50
|
-
const headerName = toValue(key);
|
|
51
|
-
|
|
52
|
-
value.meta.set('header-name', headerName);
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export default HeadersVisitor;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { ObjectElement } from '@speclynx/apidom-datamodel';
|
|
2
|
-
import { Path } from '@speclynx/apidom-traverse';
|
|
3
|
-
|
|
4
|
-
import ReferenceElement from '../../../../elements/Reference.ts';
|
|
5
|
-
import ResponseLinksElement from '../../../../elements/nces/ResponseLinks.ts';
|
|
6
|
-
import { SpecPath } from '../../generics/MapVisitor.ts';
|
|
7
|
-
import { isReferenceLikeElement } from '../../../predicates.ts';
|
|
8
|
-
import { isReferenceElement } from '../../../../predicates.ts';
|
|
9
|
-
import { BaseMapVisitor, BaseMapVisitorOptions } from '../bases.ts';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
export type { BaseMapVisitorOptions as LinksVisitorOptions };
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @public
|
|
18
|
-
*/
|
|
19
|
-
class LinksVisitor extends BaseMapVisitor {
|
|
20
|
-
declare public readonly element: ResponseLinksElement;
|
|
21
|
-
|
|
22
|
-
declare protected readonly specPath: SpecPath<
|
|
23
|
-
['document', 'objects', 'Reference'] | ['document', 'objects', 'Link']
|
|
24
|
-
>;
|
|
25
|
-
|
|
26
|
-
constructor(options: BaseMapVisitorOptions) {
|
|
27
|
-
super(options);
|
|
28
|
-
this.element = new ResponseLinksElement();
|
|
29
|
-
this.specPath = (element: unknown) =>
|
|
30
|
-
isReferenceLikeElement(element)
|
|
31
|
-
? ['document', 'objects', 'Reference']
|
|
32
|
-
: ['document', 'objects', 'Link'];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
ObjectElement(path: Path<ObjectElement>) {
|
|
36
|
-
BaseMapVisitor.prototype.ObjectElement.call(this, path);
|
|
37
|
-
|
|
38
|
-
// @ts-ignore
|
|
39
|
-
this.element.filter(isReferenceElement).forEach((referenceElement: ReferenceElement) => {
|
|
40
|
-
referenceElement.meta.set('referenced-element', 'link');
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export default LinksVisitor;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { always } from 'ramda';
|
|
2
|
-
import { isObjectElement, ObjectElement, StringElement } from '@speclynx/apidom-datamodel';
|
|
3
|
-
import { toValue } from '@speclynx/apidom-core';
|
|
4
|
-
import { Path } from '@speclynx/apidom-traverse';
|
|
5
|
-
|
|
6
|
-
import ResponseElement from '../../../../elements/Response.ts';
|
|
7
|
-
import MediaTypeElement from '../../../../elements/MediaType.ts';
|
|
8
|
-
import HeaderElement from '../../../../elements/Header.ts';
|
|
9
|
-
import { SpecPath } from '../../generics/FixedFieldsVisitor.ts';
|
|
10
|
-
import { isHeaderElement, isMediaTypeElement } from '../../../../predicates.ts';
|
|
11
|
-
import { BaseFixedFieldsVisitor, BaseFixedFieldsVisitorOptions } from '../bases.ts';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
export type { BaseFixedFieldsVisitorOptions as ResponseVisitorOptions };
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @public
|
|
20
|
-
*/
|
|
21
|
-
class ResponseVisitor extends BaseFixedFieldsVisitor {
|
|
22
|
-
declare public readonly element: ResponseElement;
|
|
23
|
-
|
|
24
|
-
declare protected readonly specPath: SpecPath<['document', 'objects', 'Response']>;
|
|
25
|
-
|
|
26
|
-
constructor(options: BaseFixedFieldsVisitorOptions) {
|
|
27
|
-
super(options);
|
|
28
|
-
this.element = new ResponseElement();
|
|
29
|
-
this.specPath = always(['document', 'objects', 'Response']);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
ObjectElement(path: Path<ObjectElement>) {
|
|
33
|
-
BaseFixedFieldsVisitor.prototype.ObjectElement.call(this, path);
|
|
34
|
-
|
|
35
|
-
// decorate every MediaTypeElement with media type metadata
|
|
36
|
-
if (isObjectElement(this.element.contentField)) {
|
|
37
|
-
this.element.contentField
|
|
38
|
-
.filter(isMediaTypeElement)
|
|
39
|
-
// @ts-ignore
|
|
40
|
-
.forEach((mediaTypeElement: MediaTypeElement, key: StringElement) => {
|
|
41
|
-
mediaTypeElement.meta.set('media-type', toValue(key));
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// decorate every MediaTypeElement with media type metadata
|
|
46
|
-
if (isObjectElement(this.element.headers)) {
|
|
47
|
-
this.element.headers
|
|
48
|
-
.filter(isHeaderElement)
|
|
49
|
-
// @ts-ignore
|
|
50
|
-
.forEach((headerElement: HeaderElement, key: StringElement) => {
|
|
51
|
-
headerElement.meta.set('header-name', toValue(key));
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export default ResponseVisitor;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { T as stubTrue } from 'ramda';
|
|
2
|
-
import { ObjectElement } from '@speclynx/apidom-datamodel';
|
|
3
|
-
import { Path } from '@speclynx/apidom-traverse';
|
|
4
|
-
|
|
5
|
-
import { isReferenceLikeElement } from '../../../predicates.ts';
|
|
6
|
-
import { isReferenceElement, isResponseElement } from '../../../../predicates.ts';
|
|
7
|
-
import { BaseAlternatingVisitor, BaseAlternatingVisitorOptions } from '../bases.ts';
|
|
8
|
-
import AlternatingVisitor from '../../generics/AlternatingVisitor.ts';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @public
|
|
12
|
-
*/
|
|
13
|
-
export type { BaseAlternatingVisitorOptions as DefaultVisitorOptions };
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @public
|
|
17
|
-
*/
|
|
18
|
-
class DefaultVisitor extends BaseAlternatingVisitor {
|
|
19
|
-
constructor(options: BaseAlternatingVisitorOptions) {
|
|
20
|
-
super(options);
|
|
21
|
-
this.alternator = [
|
|
22
|
-
{ predicate: isReferenceLikeElement, specPath: ['document', 'objects', 'Reference'] },
|
|
23
|
-
{ predicate: stubTrue, specPath: ['document', 'objects', 'Response'] },
|
|
24
|
-
];
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
ObjectElement(path: Path<ObjectElement>) {
|
|
28
|
-
AlternatingVisitor.prototype.enter.call(this, path);
|
|
29
|
-
|
|
30
|
-
// decorate ReferenceElement with type of referencing element
|
|
31
|
-
if (isReferenceElement(this.element)) {
|
|
32
|
-
this.element.meta.set('referenced-element', 'response');
|
|
33
|
-
} else if (isResponseElement(this.element)) {
|
|
34
|
-
this.element.meta.set('http-status-code', 'default');
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export default DefaultVisitor;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { always, range } from 'ramda';
|
|
2
|
-
import { Element, ObjectElement, StringElement } from '@speclynx/apidom-datamodel';
|
|
3
|
-
import { toValue } from '@speclynx/apidom-core';
|
|
4
|
-
import { Path } from '@speclynx/apidom-traverse';
|
|
5
|
-
|
|
6
|
-
import ReferenceElement from '../../../../elements/Reference.ts';
|
|
7
|
-
import ResponsesElement from '../../../../elements/Responses.ts';
|
|
8
|
-
import { SpecPath } from '../../generics/MixedFieldsVisitor.ts';
|
|
9
|
-
import { isReferenceLikeElement } from '../../../predicates.ts';
|
|
10
|
-
import { isReferenceElement, isResponseElement } from '../../../../predicates.ts';
|
|
11
|
-
import { BaseMixedFieldsVisitor, BaseMixedFieldsVisitorOptions } from '../bases.ts';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
export type { BaseMixedFieldsVisitorOptions as ResponsesVisitorOptions };
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @public
|
|
20
|
-
*/
|
|
21
|
-
class ResponsesVisitor extends BaseMixedFieldsVisitor {
|
|
22
|
-
declare public readonly element: ResponsesElement;
|
|
23
|
-
|
|
24
|
-
declare protected readonly specPathFixedFields: SpecPath<['document', 'objects', 'Responses']>;
|
|
25
|
-
|
|
26
|
-
declare protected readonly canSupportSpecificationExtensions: true;
|
|
27
|
-
|
|
28
|
-
declare protected readonly specPathPatternedFields: SpecPath<
|
|
29
|
-
['document', 'objects', 'Reference'] | ['document', 'objects', 'Response']
|
|
30
|
-
>;
|
|
31
|
-
|
|
32
|
-
constructor(options: BaseMixedFieldsVisitorOptions) {
|
|
33
|
-
super(options);
|
|
34
|
-
this.element = new ResponsesElement();
|
|
35
|
-
this.specPathFixedFields = always(['document', 'objects', 'Responses']);
|
|
36
|
-
this.canSupportSpecificationExtensions = true;
|
|
37
|
-
this.specPathPatternedFields = (element: unknown) =>
|
|
38
|
-
isReferenceLikeElement(element)
|
|
39
|
-
? ['document', 'objects', 'Reference']
|
|
40
|
-
: ['document', 'objects', 'Response'];
|
|
41
|
-
this.fieldPatternPredicate = (value) =>
|
|
42
|
-
new RegExp(`^(1XX|2XX|3XX|4XX|5XX|${range(100, 600).join('|')})$`).test(String(value));
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
ObjectElement(path: Path<ObjectElement>) {
|
|
46
|
-
BaseMixedFieldsVisitor.prototype.ObjectElement.call(this, path);
|
|
47
|
-
|
|
48
|
-
// decorate every ReferenceElement with metadata about their referencing type
|
|
49
|
-
// @ts-ignore
|
|
50
|
-
this.element.filter(isReferenceElement).forEach((referenceElement: ReferenceElement) => {
|
|
51
|
-
referenceElement.meta.set('referenced-element', 'response');
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
// decorate every ResponseElement with metadata about their status code
|
|
55
|
-
// @ts-ignore
|
|
56
|
-
this.element.filter(isResponseElement).forEach((value: Element, key: StringElement) => {
|
|
57
|
-
const httpStatusCode = toValue(key) as string;
|
|
58
|
-
if (!this.fieldPatternPredicate(httpStatusCode)) return;
|
|
59
|
-
value.meta.set('http-status-code', httpStatusCode);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export default ResponsesVisitor;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { ArrayElement } from '@speclynx/apidom-datamodel';
|
|
2
|
-
import {
|
|
3
|
-
specificationObj as JSONSchemaDraft4Specification,
|
|
4
|
-
AllOfVisitorOptions,
|
|
5
|
-
AllOfVisitor as AllOfVisitorType,
|
|
6
|
-
} from '@speclynx/apidom-ns-json-schema-draft-4';
|
|
7
|
-
import { Path } from '@speclynx/apidom-traverse';
|
|
8
|
-
|
|
9
|
-
import ReferenceElement from '../../../../elements/Reference.ts';
|
|
10
|
-
import { isReferenceElement } from '../../../../predicates.ts';
|
|
11
|
-
|
|
12
|
-
export type { AllOfVisitorOptions };
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @public
|
|
16
|
-
*/
|
|
17
|
-
export const JSONSchemaAllOfVisitor: typeof AllOfVisitorType =
|
|
18
|
-
JSONSchemaDraft4Specification.visitors.document.objects.JSONSchema.fixedFields.allOf;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @public
|
|
22
|
-
*/
|
|
23
|
-
class AllOfVisitor extends JSONSchemaAllOfVisitor {
|
|
24
|
-
ArrayElement(path: Path<ArrayElement>) {
|
|
25
|
-
JSONSchemaAllOfVisitor.prototype.ArrayElement.call(this, path);
|
|
26
|
-
|
|
27
|
-
// @ts-ignore
|
|
28
|
-
this.element.filter(isReferenceElement).forEach((referenceElement: ReferenceElement) => {
|
|
29
|
-
referenceElement.meta.set('referenced-element', 'schema');
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default AllOfVisitor;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { ArrayElement } from '@speclynx/apidom-datamodel';
|
|
2
|
-
import {
|
|
3
|
-
specificationObj as JSONSchemaDraft4Specification,
|
|
4
|
-
AnyOfVisitorOptions,
|
|
5
|
-
AnyOfVisitor as AnyOfVisitorType,
|
|
6
|
-
} from '@speclynx/apidom-ns-json-schema-draft-4';
|
|
7
|
-
import { Path } from '@speclynx/apidom-traverse';
|
|
8
|
-
|
|
9
|
-
import ReferenceElement from '../../../../elements/Reference.ts';
|
|
10
|
-
import { isReferenceElement } from '../../../../predicates.ts';
|
|
11
|
-
|
|
12
|
-
export type { AnyOfVisitorOptions };
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @public
|
|
16
|
-
*/
|
|
17
|
-
export const JSONSchemaAnyOfVisitor: typeof AnyOfVisitorType =
|
|
18
|
-
JSONSchemaDraft4Specification.visitors.document.objects.JSONSchema.fixedFields.anyOf;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @public
|
|
22
|
-
*/
|
|
23
|
-
class AnyOfVisitor extends JSONSchemaAnyOfVisitor {
|
|
24
|
-
ArrayElement(path: Path<ArrayElement>) {
|
|
25
|
-
JSONSchemaAnyOfVisitor.prototype.ArrayElement.call(this, path);
|
|
26
|
-
|
|
27
|
-
// @ts-ignore
|
|
28
|
-
this.element.filter(isReferenceElement).forEach((referenceElement: ReferenceElement) => {
|
|
29
|
-
referenceElement.meta.set('referenced-element', 'schema');
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default AnyOfVisitor;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { ArrayElement, ObjectElement } from '@speclynx/apidom-datamodel';
|
|
2
|
-
import {
|
|
3
|
-
ItemsVisitorOptions,
|
|
4
|
-
ItemsVisitor as JSONSchemaItemsVisitor,
|
|
5
|
-
} from '@speclynx/apidom-ns-json-schema-draft-4';
|
|
6
|
-
import { Path } from '@speclynx/apidom-traverse';
|
|
7
|
-
|
|
8
|
-
import { isReferenceElement } from '../../../../predicates.ts';
|
|
9
|
-
|
|
10
|
-
export type { ItemsVisitorOptions };
|
|
11
|
-
|
|
12
|
-
export { JSONSchemaItemsVisitor };
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @public
|
|
16
|
-
*/
|
|
17
|
-
class ItemsVisitor extends JSONSchemaItemsVisitor {
|
|
18
|
-
ObjectElement(path: Path<ObjectElement>) {
|
|
19
|
-
JSONSchemaItemsVisitor.prototype.ObjectElement.call(this, path);
|
|
20
|
-
|
|
21
|
-
if (isReferenceElement(this.element)) {
|
|
22
|
-
this.element.meta.set('referenced-element', 'schema');
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
ArrayElement(path: Path<ArrayElement>) {
|
|
27
|
-
this.enter(path);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export default ItemsVisitor;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { ArrayElement } from '@speclynx/apidom-datamodel';
|
|
2
|
-
import {
|
|
3
|
-
specificationObj as JSONSchemaDraft4Specification,
|
|
4
|
-
OneOfVisitorOptions,
|
|
5
|
-
OneOfVisitor as OneOfVisitorType,
|
|
6
|
-
} from '@speclynx/apidom-ns-json-schema-draft-4';
|
|
7
|
-
import { Path } from '@speclynx/apidom-traverse';
|
|
8
|
-
|
|
9
|
-
import ReferenceElement from '../../../../elements/Reference.ts';
|
|
10
|
-
import { isReferenceElement } from '../../../../predicates.ts';
|
|
11
|
-
|
|
12
|
-
export type { OneOfVisitorOptions };
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @public
|
|
16
|
-
*/
|
|
17
|
-
export const JSONSchemaOneOfVisitor: typeof OneOfVisitorType =
|
|
18
|
-
JSONSchemaDraft4Specification.visitors.document.objects.JSONSchema.fixedFields.oneOf;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @public
|
|
22
|
-
*/
|
|
23
|
-
class OneOfVisitor extends JSONSchemaOneOfVisitor {
|
|
24
|
-
ArrayElement(path: Path<ArrayElement>) {
|
|
25
|
-
JSONSchemaOneOfVisitor.prototype.ArrayElement.call(this, path);
|
|
26
|
-
|
|
27
|
-
// @ts-ignore
|
|
28
|
-
this.element.filter(isReferenceElement).forEach((referenceElement: ReferenceElement) => {
|
|
29
|
-
referenceElement.meta.set('referenced-element', 'schema');
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default OneOfVisitor;
|