@speclynx/apidom-ns-openapi-2 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.
Files changed (112) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/apidom-ns-openapi-2.browser.js +7 -7
  3. package/dist/apidom-ns-openapi-2.browser.min.js +1 -1
  4. package/package.json +9 -8
  5. package/src/elements/Contact.ts +0 -42
  6. package/src/elements/Definitions.ts +0 -13
  7. package/src/elements/Example.ts +0 -13
  8. package/src/elements/ExternalDocumentation.ts +0 -34
  9. package/src/elements/Header.ts +0 -261
  10. package/src/elements/Headers.ts +0 -13
  11. package/src/elements/Info.ts +0 -70
  12. package/src/elements/Items.ts +0 -264
  13. package/src/elements/License.ts +0 -34
  14. package/src/elements/Operation.ts +0 -106
  15. package/src/elements/Parameter.ts +0 -326
  16. package/src/elements/ParametersDefinitions.ts +0 -13
  17. package/src/elements/PathItem.ts +0 -93
  18. package/src/elements/Paths.ts +0 -13
  19. package/src/elements/Reference.ts +0 -27
  20. package/src/elements/Response.ts +0 -54
  21. package/src/elements/Responses.ts +0 -24
  22. package/src/elements/ResponsesDefinitions.ts +0 -13
  23. package/src/elements/Schema.ts +0 -204
  24. package/src/elements/Scopes.ts +0 -13
  25. package/src/elements/SecurityDefinitions.ts +0 -13
  26. package/src/elements/SecurityRequirement.ts +0 -13
  27. package/src/elements/SecurityScheme.ts +0 -83
  28. package/src/elements/Swagger.ts +0 -149
  29. package/src/elements/SwaggerVersion.ts +0 -15
  30. package/src/elements/Tag.ts +0 -44
  31. package/src/elements/Xml.ts +0 -59
  32. package/src/elements/nces/OperationConsumes.ts +0 -15
  33. package/src/elements/nces/OperationParameters.ts +0 -16
  34. package/src/elements/nces/OperationProduces.ts +0 -15
  35. package/src/elements/nces/OperationSchemes.ts +0 -15
  36. package/src/elements/nces/OperationSecurity.ts +0 -16
  37. package/src/elements/nces/OperationTags.ts +0 -16
  38. package/src/elements/nces/PathItemParameters.ts +0 -16
  39. package/src/elements/nces/SwaggerConsumes.ts +0 -15
  40. package/src/elements/nces/SwaggerProduces.ts +0 -15
  41. package/src/elements/nces/SwaggerSchemes.ts +0 -15
  42. package/src/elements/nces/SwaggerSecurity.ts +0 -16
  43. package/src/elements/nces/SwaggerTags.ts +0 -15
  44. package/src/index.ts +0 -368
  45. package/src/media-types.ts +0 -42
  46. package/src/namespace.ts +0 -70
  47. package/src/predicates.ts +0 -194
  48. package/src/refractor/index.ts +0 -330
  49. package/src/refractor/inspect.ts +0 -181
  50. package/src/refractor/plugins/replace-empty-element.ts +0 -389
  51. package/src/refractor/predicates.ts +0 -29
  52. package/src/refractor/specification.ts +0 -444
  53. package/src/refractor/toolbox.ts +0 -24
  54. package/src/refractor/visitors/FallbackVisitor.ts +0 -25
  55. package/src/refractor/visitors/SpecificationExtensionVisitor.ts +0 -22
  56. package/src/refractor/visitors/SpecificationVisitor.ts +0 -83
  57. package/src/refractor/visitors/Visitor.ts +0 -47
  58. package/src/refractor/visitors/generics/AlternatingVisitor.ts +0 -45
  59. package/src/refractor/visitors/generics/FixedFieldsVisitor.ts +0 -109
  60. package/src/refractor/visitors/generics/MapVisitor.ts +0 -25
  61. package/src/refractor/visitors/generics/MixedFieldsVisitor.ts +0 -77
  62. package/src/refractor/visitors/generics/PatternedFieldsVisitor.ts +0 -99
  63. package/src/refractor/visitors/open-api-2/BasePathVisitor.ts +0 -20
  64. package/src/refractor/visitors/open-api-2/ConsumesVisitor.ts +0 -29
  65. package/src/refractor/visitors/open-api-2/HostVisitor.ts +0 -20
  66. package/src/refractor/visitors/open-api-2/ProducesVisitor.ts +0 -29
  67. package/src/refractor/visitors/open-api-2/SchemesVisitor.ts +0 -29
  68. package/src/refractor/visitors/open-api-2/SecurityVisitor.ts +0 -34
  69. package/src/refractor/visitors/open-api-2/SwaggerVisitor.ts +0 -29
  70. package/src/refractor/visitors/open-api-2/TagsVisitor.ts +0 -34
  71. package/src/refractor/visitors/open-api-2/bases.ts +0 -82
  72. package/src/refractor/visitors/open-api-2/contact/index.ts +0 -27
  73. package/src/refractor/visitors/open-api-2/definitions/index.ts +0 -48
  74. package/src/refractor/visitors/open-api-2/example/index.ts +0 -27
  75. package/src/refractor/visitors/open-api-2/external-documentation/index.ts +0 -27
  76. package/src/refractor/visitors/open-api-2/header/index.ts +0 -27
  77. package/src/refractor/visitors/open-api-2/headers/index.ts +0 -27
  78. package/src/refractor/visitors/open-api-2/index.ts +0 -28
  79. package/src/refractor/visitors/open-api-2/info/VersionVisitor.ts +0 -21
  80. package/src/refractor/visitors/open-api-2/info/index.ts +0 -27
  81. package/src/refractor/visitors/open-api-2/items/index.ts +0 -27
  82. package/src/refractor/visitors/open-api-2/license/index.ts +0 -27
  83. package/src/refractor/visitors/open-api-2/operation/ConsumesVisitor.ts +0 -29
  84. package/src/refractor/visitors/open-api-2/operation/ParametersVisitor.ts +0 -44
  85. package/src/refractor/visitors/open-api-2/operation/ProducesVisitor.ts +0 -29
  86. package/src/refractor/visitors/open-api-2/operation/SchemesVisitor.ts +0 -29
  87. package/src/refractor/visitors/open-api-2/operation/SecurityVisitor.ts +0 -34
  88. package/src/refractor/visitors/open-api-2/operation/TagsVisitor.ts +0 -29
  89. package/src/refractor/visitors/open-api-2/operation/index.ts +0 -24
  90. package/src/refractor/visitors/open-api-2/parameter/index.ts +0 -27
  91. package/src/refractor/visitors/open-api-2/parameters-definitions/index.ts +0 -24
  92. package/src/refractor/visitors/open-api-2/path-item/$RefVisitor.ts +0 -20
  93. package/src/refractor/visitors/open-api-2/path-item/ParametersVisitor.ts +0 -44
  94. package/src/refractor/visitors/open-api-2/path-item/index.ts +0 -48
  95. package/src/refractor/visitors/open-api-2/paths/index.ts +0 -48
  96. package/src/refractor/visitors/open-api-2/reference/$RefVisitor.ts +0 -20
  97. package/src/refractor/visitors/open-api-2/reference/index.ts +0 -38
  98. package/src/refractor/visitors/open-api-2/response/index.ts +0 -27
  99. package/src/refractor/visitors/open-api-2/responses/DefaultVisitor.ts +0 -36
  100. package/src/refractor/visitors/open-api-2/responses/index.ts +0 -64
  101. package/src/refractor/visitors/open-api-2/responses-definitions/index.ts +0 -24
  102. package/src/refractor/visitors/open-api-2/schema/AllOfVisitor.ts +0 -35
  103. package/src/refractor/visitors/open-api-2/schema/ItemsVisitor.ts +0 -38
  104. package/src/refractor/visitors/open-api-2/schema/PropertiesVisitor.ts +0 -35
  105. package/src/refractor/visitors/open-api-2/schema/SchemaOrJSONReferenceVisitor.ts +0 -37
  106. package/src/refractor/visitors/open-api-2/schema/index.ts +0 -27
  107. package/src/refractor/visitors/open-api-2/scopes/index.ts +0 -27
  108. package/src/refractor/visitors/open-api-2/security-definitions/index.ts +0 -24
  109. package/src/refractor/visitors/open-api-2/security-requirement/index.ts +0 -24
  110. package/src/refractor/visitors/open-api-2/security-scheme/index.ts +0 -27
  111. package/src/refractor/visitors/open-api-2/tag/index.ts +0 -27
  112. package/src/refractor/visitors/open-api-2/xml/index.ts +0 -27
@@ -1,48 +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
- export type { BaseFixedFieldsVisitorOptions as PathItemVisitorOptions };
13
-
14
- /**
15
- * @public
16
- */
17
- class PathItemVisitor extends BaseFixedFieldsVisitor {
18
- declare public readonly element: PathItemElement;
19
-
20
- declare protected readonly specPath: SpecPath<['document', 'objects', 'PathItem']>;
21
-
22
- constructor(options: BaseFixedFieldsVisitorOptions) {
23
- super(options);
24
- this.element = new PathItemElement();
25
- this.consumeSafe = true;
26
- this.specPath = always(['document', 'objects', 'PathItem']);
27
- }
28
-
29
- ObjectElement(path: Path<ObjectElement>) {
30
- BaseFixedFieldsVisitor.prototype.ObjectElement.call(this, path);
31
-
32
- // decorate Operation elements with HTTP method
33
- this.element
34
- .filter(isOperationElement)
35
- // @ts-ignore
36
- .forEach((operationElement: OperationElement, httpMethodElementCI: StringElement) => {
37
- const httpMethod = (toValue(httpMethodElementCI) as string).toUpperCase();
38
- operationElement.meta.set('http-method', httpMethod);
39
- });
40
-
41
- // mark this PathItemElement with reference metadata
42
- if (isStringElement(this.element.$ref)) {
43
- this.element.classes.push('reference-element');
44
- }
45
- }
46
- }
47
-
48
- export default PathItemVisitor;
@@ -1,48 +0,0 @@
1
- import { T as stubTrue, always } from 'ramda';
2
- import { ObjectElement, StringElement } from '@speclynx/apidom-datamodel';
3
- import { Path } from '@speclynx/apidom-traverse';
4
- import { toValue } from '@speclynx/apidom-core';
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
- export type { BasePatternedFieldsVisitorOptions as PathsVisitorOptions };
13
-
14
- /**
15
- * @public
16
- */
17
- class PathsVisitor extends BasePatternedFieldsVisitor {
18
- public readonly element: PathsElement;
19
-
20
- declare protected readonly specPath: SpecPath<['document', 'objects', 'PathItem']>;
21
-
22
- declare protected readonly canSupportSpecificationExtensions: true;
23
-
24
- constructor(options: BasePatternedFieldsVisitorOptions) {
25
- super(options);
26
- this.element = new PathsElement();
27
- this.consumeSafe = true;
28
- this.specPath = always(['document', 'objects', 'PathItem']);
29
- this.canSupportSpecificationExtensions = true;
30
- this.fieldPatternPredicate = stubTrue;
31
- }
32
-
33
- ObjectElement(path: Path<ObjectElement>) {
34
- BasePatternedFieldsVisitor.prototype.ObjectElement.call(this, path);
35
-
36
- // decorate every PathItemElement with path metadata
37
- this.element
38
- .filter(isPathItemElement)
39
- // @ts-ignore
40
- .forEach((pathItemElement: PathItemElement, key: StringElement) => {
41
- key.classes.push('openapi-path-template');
42
- key.classes.push('path-template');
43
- pathItemElement.meta.set('path', toValue(key) as string);
44
- });
45
- }
46
- }
47
-
48
- 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,38 +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
- export type { BaseFixedFieldsVisitorOptions as ReferenceVisitorOptions };
10
-
11
- /**
12
- * @public
13
- */
14
- class ReferenceVisitor extends BaseFixedFieldsVisitor {
15
- declare public readonly element: ReferenceElement;
16
-
17
- declare protected readonly specPath: SpecPath<['document', 'objects', 'Reference']>;
18
-
19
- declare protected readonly canSupportSpecificationExtensions: false;
20
-
21
- constructor(options: BaseFixedFieldsVisitorOptions) {
22
- super(options);
23
- this.element = new ReferenceElement();
24
- this.specPath = always(['document', 'objects', 'Reference']);
25
- this.canSupportSpecificationExtensions = false;
26
- }
27
-
28
- ObjectElement(path: Path<ObjectElement>) {
29
- BaseFixedFieldsVisitor.prototype.ObjectElement.call(this, path);
30
-
31
- // mark this ReferenceElement with reference metadata
32
- if (isStringElement(this.element.$ref)) {
33
- this.element.classes.push('reference-element');
34
- }
35
- }
36
- }
37
-
38
- export default ReferenceVisitor;
@@ -1,27 +0,0 @@
1
- import { always } from 'ramda';
2
-
3
- import ResponseElement from '../../../../elements/Response.ts';
4
- import { SpecPath } from '../../generics/FixedFieldsVisitor.ts';
5
- import { BaseFixedFieldsVisitor, BaseFixedFieldsVisitorOptions } from '../bases.ts';
6
-
7
- export type { BaseFixedFieldsVisitorOptions as ResponseVisitorOptions };
8
-
9
- /**
10
- * @public
11
- */
12
- class ResponseVisitor extends BaseFixedFieldsVisitor {
13
- declare public readonly element: ResponseElement;
14
-
15
- declare protected readonly specPath: SpecPath<['document', 'objects', 'Response']>;
16
-
17
- declare protected readonly canSupportSpecificationExtensions: true;
18
-
19
- constructor(options: BaseFixedFieldsVisitorOptions) {
20
- super(options);
21
- this.element = new ResponseElement();
22
- this.specPath = always(['document', 'objects', 'Response']);
23
- this.canSupportSpecificationExtensions = true;
24
- }
25
- }
26
-
27
- export default ResponseVisitor;
@@ -1,36 +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
- export type { BaseAlternatingVisitorOptions as DefaultVisitorOptions };
11
-
12
- /**
13
- * @public
14
- */
15
- class DefaultVisitor extends BaseAlternatingVisitor {
16
- constructor(options: BaseAlternatingVisitorOptions) {
17
- super(options);
18
- this.alternator = [
19
- { predicate: isReferenceLikeElement, specPath: ['document', 'objects', 'Reference'] },
20
- { predicate: stubTrue, specPath: ['document', 'objects', 'Response'] },
21
- ];
22
- }
23
-
24
- ObjectElement(path: Path<ObjectElement>) {
25
- AlternatingVisitor.prototype.enter.call(this, path);
26
-
27
- // decorate ReferenceElement with type of referencing element
28
- if (isReferenceElement(this.element)) {
29
- this.element.meta.set('referenced-element', 'response');
30
- } else if (isResponseElement(this.element)) {
31
- this.element.meta.set('http-status-code', 'default');
32
- }
33
- }
34
- }
35
-
36
- export default DefaultVisitor;
@@ -1,64 +0,0 @@
1
- import { test, 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
- export type { BaseMixedFieldsVisitorOptions as ResponsesVisitorOptions };
14
-
15
- /**
16
- * @public
17
- */
18
- class ResponsesVisitor extends BaseMixedFieldsVisitor {
19
- declare public readonly element: ResponsesElement;
20
-
21
- declare protected readonly specPathFixedFields: SpecPath<['document', 'objects', 'Responses']>;
22
-
23
- declare protected readonly canSupportSpecificationExtensions: true;
24
-
25
- declare protected readonly specPathPatternedFields: SpecPath<
26
- ['document', 'objects', 'Reference'] | ['document', 'objects', 'Response']
27
- >;
28
-
29
- constructor(options: BaseMixedFieldsVisitorOptions) {
30
- super(options);
31
- this.element = new ResponsesElement();
32
- this.specPathFixedFields = always(['document', 'objects', 'Responses']);
33
- this.canSupportSpecificationExtensions = true;
34
- this.specPathPatternedFields = (element: unknown) => {
35
- return isReferenceLikeElement(element)
36
- ? ['document', 'objects', 'Reference']
37
- : ['document', 'objects', 'Response'];
38
- };
39
- // @ts-ignore
40
- this.fieldPatternPredicate = test(
41
- new RegExp(`^(1XX|2XX|3XX|4XX|5XX|${range(100, 600).join('|')})$`),
42
- );
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,24 +0,0 @@
1
- import { always } from 'ramda';
2
-
3
- import ResponsesDefinitionsElement from '../../../../elements/ResponsesDefinitions.ts';
4
- import { SpecPath } from '../../generics/MapVisitor.ts';
5
- import { BaseMapVisitor, BaseMapVisitorOptions } from '../bases.ts';
6
-
7
- export type { BaseMapVisitorOptions as ResponsesDefinitionsVisitorOptions };
8
-
9
- /**
10
- * @public
11
- */
12
- class ResponsesDefinitionsVisitor extends BaseMapVisitor {
13
- declare public readonly element: ResponsesDefinitionsElement;
14
-
15
- declare protected readonly specPath: SpecPath<['document', 'objects', 'Response']>;
16
-
17
- constructor(options: BaseMapVisitorOptions) {
18
- super(options);
19
- this.element = new ResponsesDefinitionsElement();
20
- this.specPath = always(['document', 'objects', 'Response']);
21
- }
22
- }
23
-
24
- export default ResponsesDefinitionsVisitor;
@@ -1,35 +0,0 @@
1
- import { ArrayElement } from '@speclynx/apidom-datamodel';
2
- import { Path } from '@speclynx/apidom-traverse';
3
- import {
4
- specificationObj as JSONSchemaDraft4Specification,
5
- isJSONReferenceElement,
6
- JSONReferenceElement,
7
- AllOfVisitorOptions,
8
- AllOfVisitor as AllOfVisitorType,
9
- } from '@speclynx/apidom-ns-json-schema-draft-4';
10
-
11
- export type { AllOfVisitorOptions };
12
-
13
- /**
14
- * @public
15
- */
16
- export const JSONSchemaAllOfVisitor: typeof AllOfVisitorType =
17
- JSONSchemaDraft4Specification.visitors.document.objects.JSONSchema.fixedFields.allOf;
18
-
19
- /**
20
- * @public
21
- */
22
- class AllOfVisitor extends JSONSchemaAllOfVisitor {
23
- ArrayElement(path: Path<ArrayElement>) {
24
- JSONSchemaAllOfVisitor.prototype.ArrayElement.call(this, path);
25
-
26
- this.element
27
- .filter(isJSONReferenceElement)
28
- // @ts-ignore
29
- .forEach((referenceElement: JSONReferenceElement) => {
30
- referenceElement.meta.set('referenced-element', 'schema');
31
- });
32
- }
33
- }
34
-
35
- export default AllOfVisitor;
@@ -1,38 +0,0 @@
1
- import { ArrayElement, ObjectElement } from '@speclynx/apidom-datamodel';
2
- import { Path } from '@speclynx/apidom-traverse';
3
- import {
4
- JSONReferenceElement,
5
- isJSONReferenceElement,
6
- ItemsVisitorOptions,
7
- ItemsVisitor as JSONSchemaItemsVisitor,
8
- } from '@speclynx/apidom-ns-json-schema-draft-4';
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 (isJSONReferenceElement(this.element)) {
22
- this.element.meta.set('referenced-element', 'schema');
23
- }
24
- }
25
-
26
- ArrayElement(path: Path<ArrayElement>) {
27
- JSONSchemaItemsVisitor.prototype.ArrayElement.call(this, path);
28
-
29
- this.element
30
- .filter(isJSONReferenceElement)
31
- // @ts-ignore
32
- .forEach((referenceElement: JSONReferenceElement) => {
33
- referenceElement.meta.set('referenced-element', 'schema');
34
- });
35
- }
36
- }
37
-
38
- export default ItemsVisitor;
@@ -1,35 +0,0 @@
1
- import { ObjectElement } from '@speclynx/apidom-datamodel';
2
- import { Path } from '@speclynx/apidom-traverse';
3
- import {
4
- specificationObj as JSONSchemaDraft4Specification,
5
- JSONReferenceElement,
6
- isJSONReferenceElement,
7
- PropertiesVisitorOptions,
8
- PropertiesVisitor as PropertiesVisitorType,
9
- } from '@speclynx/apidom-ns-json-schema-draft-4';
10
-
11
- export type { PropertiesVisitorOptions };
12
-
13
- /**
14
- * @public
15
- */
16
- export const JSONSchemaPropertiesVisitor: typeof PropertiesVisitorType =
17
- JSONSchemaDraft4Specification.visitors.document.objects.JSONSchema.fixedFields.properties;
18
-
19
- /**
20
- * @public
21
- */
22
- class PropertiesVisitor extends JSONSchemaPropertiesVisitor {
23
- ObjectElement(path: Path<ObjectElement>) {
24
- JSONSchemaPropertiesVisitor.prototype.ObjectElement.call(this, path);
25
-
26
- this.element
27
- .filter(isJSONReferenceElement)
28
- // @ts-ignore
29
- .forEach((referenceElement: JSONReferenceElement) => {
30
- referenceElement.meta.set('referenced-element', 'schema');
31
- });
32
- }
33
- }
34
-
35
- export default PropertiesVisitor;
@@ -1,37 +0,0 @@
1
- import { ObjectElement } from '@speclynx/apidom-datamodel';
2
- import { Path } from '@speclynx/apidom-traverse';
3
- import {
4
- specificationObj as JSONSchemaDraft4Specification,
5
- isJSONReferenceElement,
6
- JSONReferenceElement,
7
- SchemaOrReferenceVisitorOptions,
8
- SchemaOrReferenceVisitor as SchemaOrReferenceVisitorType,
9
- } from '@speclynx/apidom-ns-json-schema-draft-4';
10
-
11
- import SchemaElement from '../../../../elements/Schema.ts';
12
-
13
- export type { SchemaOrReferenceVisitorOptions };
14
-
15
- /**
16
- * @public
17
- */
18
-
19
- export const JSONSchemaOrJSONReferenceVisitor: typeof SchemaOrReferenceVisitorType =
20
- JSONSchemaDraft4Specification.visitors.JSONSchemaOrJSONReferenceVisitor;
21
-
22
- /**
23
- * @public
24
- */
25
- class SchemaOrJSONReferenceVisitor extends JSONSchemaOrJSONReferenceVisitor {
26
- declare public element: SchemaElement | JSONReferenceElement;
27
-
28
- ObjectElement(path: Path<ObjectElement>) {
29
- JSONSchemaOrJSONReferenceVisitor.prototype.enter.call(this, path);
30
-
31
- if (isJSONReferenceElement(this.element)) {
32
- this.element.meta.set('referenced-element', 'schema');
33
- }
34
- }
35
- }
36
-
37
- export default SchemaOrJSONReferenceVisitor;
@@ -1,27 +0,0 @@
1
- import { always } from 'ramda';
2
-
3
- import SchemaElement from '../../../../elements/Schema.ts';
4
- import { SpecPath } from '../../generics/FixedFieldsVisitor.ts';
5
- import { BaseFixedFieldsVisitor, BaseFixedFieldsVisitorOptions } from '../bases.ts';
6
-
7
- export type { BaseFixedFieldsVisitorOptions as SchemaVisitorOptions };
8
-
9
- /**
10
- * @public
11
- */
12
- class SchemaVisitor extends BaseFixedFieldsVisitor {
13
- declare public readonly element: SchemaElement;
14
-
15
- declare protected readonly specPath: SpecPath<['document', 'objects', 'Schema']>;
16
-
17
- declare protected readonly canSupportSpecificationExtensions: true;
18
-
19
- constructor(options: BaseFixedFieldsVisitorOptions) {
20
- super(options);
21
- this.element = new SchemaElement();
22
- this.specPath = always(['document', 'objects', 'Schema']);
23
- this.canSupportSpecificationExtensions = true;
24
- }
25
- }
26
-
27
- export default SchemaVisitor;
@@ -1,27 +0,0 @@
1
- import { always } from 'ramda';
2
-
3
- import ScopesElement from '../../../../elements/Scopes.ts';
4
- import { SpecPath } from '../../generics/MapVisitor.ts';
5
- import { BaseMapVisitor, BaseMapVisitorOptions } from '../bases.ts';
6
-
7
- export type { BaseMapVisitorOptions as ScopesVisitorOptions };
8
-
9
- /**
10
- * @public
11
- */
12
- class ScopesVisitor extends BaseMapVisitor {
13
- declare public readonly element: ScopesElement;
14
-
15
- declare protected readonly specPath: SpecPath<['value']>;
16
-
17
- declare protected readonly canSupportSpecificationExtensions: true;
18
-
19
- constructor(options: BaseMapVisitorOptions) {
20
- super(options);
21
- this.element = new ScopesElement();
22
- this.specPath = always(['value']);
23
- this.canSupportSpecificationExtensions = true;
24
- }
25
- }
26
-
27
- export default ScopesVisitor;
@@ -1,24 +0,0 @@
1
- import { always } from 'ramda';
2
-
3
- import SecurityDefinitionsElement from '../../../../elements/SecurityDefinitions.ts';
4
- import { SpecPath } from '../../generics/MapVisitor.ts';
5
- import { BaseMapVisitor, BaseMapVisitorOptions } from '../bases.ts';
6
-
7
- export type { BaseMapVisitorOptions as SecurityDefinitionsVisitorOptions };
8
-
9
- /**
10
- * @public
11
- */
12
- class SecurityDefinitionsVisitor extends BaseMapVisitor {
13
- public readonly element: SecurityDefinitionsElement;
14
-
15
- declare protected readonly specPath: SpecPath<['document', 'objects', 'SecurityScheme']>;
16
-
17
- constructor(options: BaseMapVisitorOptions) {
18
- super(options);
19
- this.element = new SecurityDefinitionsElement();
20
- this.specPath = always(['document', 'objects', 'SecurityScheme']);
21
- }
22
- }
23
-
24
- export default SecurityDefinitionsVisitor;
@@ -1,24 +0,0 @@
1
- import { always } from 'ramda';
2
-
3
- import SecurityRequirementElement from '../../../../elements/SecurityRequirement.ts';
4
- import { SpecPath } from '../../generics/MapVisitor.ts';
5
- import { BaseMapVisitor, BaseMapVisitorOptions } from '../bases.ts';
6
-
7
- export type { BaseMapVisitorOptions as SecurityRequirementVisitorOptions };
8
-
9
- /**
10
- * @public
11
- */
12
- class SecurityRequirementVisitor extends BaseMapVisitor {
13
- declare public readonly element: SecurityRequirementElement;
14
-
15
- declare protected readonly specPath: SpecPath<['value']>;
16
-
17
- constructor(options: BaseMapVisitorOptions) {
18
- super(options);
19
- this.element = new SecurityRequirementElement();
20
- this.specPath = always(['value']);
21
- }
22
- }
23
-
24
- export default SecurityRequirementVisitor;
@@ -1,27 +0,0 @@
1
- import { always } from 'ramda';
2
-
3
- import SecuritySchemeElement from '../../../../elements/SecurityScheme.ts';
4
- import { SpecPath } from '../../generics/FixedFieldsVisitor.ts';
5
- import { BaseFixedFieldsVisitor, BaseFixedFieldsVisitorOptions } from '../bases.ts';
6
-
7
- export type { BaseFixedFieldsVisitorOptions as SecuritySchemeVisitorOptions };
8
-
9
- /**
10
- * @public
11
- */
12
- class SecuritySchemeVisitor extends BaseFixedFieldsVisitor {
13
- declare public readonly element: SecuritySchemeElement;
14
-
15
- declare protected readonly specPath: SpecPath<['document', 'objects', 'SecurityScheme']>;
16
-
17
- declare protected readonly canSupportSpecificationExtensions: true;
18
-
19
- constructor(options: BaseFixedFieldsVisitorOptions) {
20
- super(options);
21
- this.element = new SecuritySchemeElement();
22
- this.specPath = always(['document', 'objects', 'SecurityScheme']);
23
- this.canSupportSpecificationExtensions = true;
24
- }
25
- }
26
-
27
- export default SecuritySchemeVisitor;
@@ -1,27 +0,0 @@
1
- import { always } from 'ramda';
2
-
3
- import TagElement from '../../../../elements/Tag.ts';
4
- import { SpecPath } from '../../generics/FixedFieldsVisitor.ts';
5
- import { BaseFixedFieldsVisitor, BaseFixedFieldsVisitorOptions } from '../bases.ts';
6
-
7
- export type { BaseFixedFieldsVisitorOptions as TagVisitorOptions };
8
-
9
- /**
10
- * @public
11
- */
12
- class TagVisitor extends BaseFixedFieldsVisitor {
13
- declare public readonly element: TagElement;
14
-
15
- declare protected readonly specPath: SpecPath<['document', 'objects', 'Tag']>;
16
-
17
- declare protected readonly canSupportSpecificationExtensions: true;
18
-
19
- constructor(options: BaseFixedFieldsVisitorOptions) {
20
- super(options);
21
- this.element = new TagElement();
22
- this.specPath = always(['document', 'objects', 'Tag']);
23
- this.canSupportSpecificationExtensions = true;
24
- }
25
- }
26
-
27
- export default TagVisitor;
@@ -1,27 +0,0 @@
1
- import { always } from 'ramda';
2
-
3
- import XmlElement from '../../../../elements/Xml.ts';
4
- import { SpecPath } from '../../generics/FixedFieldsVisitor.ts';
5
- import { BaseFixedFieldsVisitor, BaseFixedFieldsVisitorOptions } from '../bases.ts';
6
-
7
- export type { BaseFixedFieldsVisitorOptions as XmlVisitorOptions };
8
-
9
- /**
10
- * @public
11
- */
12
- class XmlVisitor extends BaseFixedFieldsVisitor {
13
- declare public readonly element: XmlElement;
14
-
15
- declare protected readonly specPath: SpecPath<['document', 'objects', 'XML']>;
16
-
17
- declare protected readonly canSupportSpecificationExtensions: true;
18
-
19
- constructor(options: BaseFixedFieldsVisitorOptions) {
20
- super(options);
21
- this.element = new XmlElement();
22
- this.specPath = always(['document', 'objects', 'XML']);
23
- this.canSupportSpecificationExtensions = true;
24
- }
25
- }
26
-
27
- export default XmlVisitor;