@speclynx/apidom-ns-arazzo-1 1.12.2 → 2.0.1
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 +21 -0
- package/NOTICE +16 -7
- package/README.md +25 -25
- package/dist/apidom-ns-arazzo-1.browser.js +8596 -13272
- package/dist/apidom-ns-arazzo-1.browser.min.js +1 -1
- package/package.json +9 -8
- package/src/elements/Arazzo.cjs +2 -2
- package/src/elements/Arazzo.mjs +1 -1
- package/src/elements/ArazzoSpecification1.cjs +2 -2
- package/src/elements/ArazzoSpecification1.mjs +1 -1
- package/src/elements/Components.cjs +2 -2
- package/src/elements/Components.mjs +1 -1
- package/src/elements/Criterion.cjs +2 -2
- package/src/elements/Criterion.mjs +1 -1
- package/src/elements/CriterionExpressionType.cjs +2 -2
- package/src/elements/CriterionExpressionType.mjs +1 -1
- package/src/elements/FailureAction.cjs +2 -2
- package/src/elements/FailureAction.mjs +1 -1
- package/src/elements/Info.cjs +2 -2
- package/src/elements/Info.mjs +1 -1
- package/src/elements/Parameter.cjs +2 -2
- package/src/elements/Parameter.mjs +1 -1
- package/src/elements/PayloadReplacement.cjs +2 -2
- package/src/elements/PayloadReplacement.mjs +1 -1
- package/src/elements/RequestBody.cjs +2 -2
- package/src/elements/RequestBody.mjs +1 -1
- package/src/elements/Reusable.cjs +2 -2
- package/src/elements/Reusable.mjs +1 -1
- package/src/elements/SourceDescription.cjs +2 -2
- package/src/elements/SourceDescription.mjs +1 -1
- package/src/elements/Step.cjs +2 -2
- package/src/elements/Step.mjs +1 -1
- package/src/elements/SuccessAction.cjs +2 -2
- package/src/elements/SuccessAction.mjs +1 -1
- package/src/elements/Workflow.cjs +2 -2
- package/src/elements/Workflow.mjs +1 -1
- package/src/elements/nces/ComponentsFailureActions.cjs +2 -2
- package/src/elements/nces/ComponentsFailureActions.mjs +1 -1
- package/src/elements/nces/ComponentsInputs.cjs +2 -2
- package/src/elements/nces/ComponentsInputs.mjs +1 -1
- package/src/elements/nces/ComponentsParameters.cjs +2 -2
- package/src/elements/nces/ComponentsParameters.mjs +1 -1
- package/src/elements/nces/ComponentsSuccessActions.cjs +2 -2
- package/src/elements/nces/ComponentsSuccessActions.mjs +1 -1
- package/src/elements/nces/FailureActionCriteria.cjs +2 -2
- package/src/elements/nces/FailureActionCriteria.mjs +1 -1
- package/src/elements/nces/RequestBodyReplacements.cjs +2 -2
- package/src/elements/nces/RequestBodyReplacements.mjs +1 -1
- package/src/elements/nces/SourceDescriptions.cjs +2 -2
- package/src/elements/nces/SourceDescriptions.mjs +1 -1
- package/src/elements/nces/StepDependsOn.cjs +2 -2
- package/src/elements/nces/StepDependsOn.mjs +1 -1
- package/src/elements/nces/StepOnFailure.cjs +2 -2
- package/src/elements/nces/StepOnFailure.mjs +1 -1
- package/src/elements/nces/StepOnSuccess.cjs +2 -2
- package/src/elements/nces/StepOnSuccess.mjs +1 -1
- package/src/elements/nces/StepOutputs.cjs +2 -2
- package/src/elements/nces/StepOutputs.mjs +1 -1
- package/src/elements/nces/StepParameters.cjs +2 -2
- package/src/elements/nces/StepParameters.mjs +1 -1
- package/src/elements/nces/StepSuccessCriteria.cjs +2 -2
- package/src/elements/nces/StepSuccessCriteria.mjs +1 -1
- package/src/elements/nces/SuccessActionCriteria.cjs +2 -2
- package/src/elements/nces/SuccessActionCriteria.mjs +1 -1
- package/src/elements/nces/WorkflowDependsOn.cjs +2 -2
- package/src/elements/nces/WorkflowDependsOn.mjs +1 -1
- package/src/elements/nces/WorkflowFailureActions.cjs +2 -2
- package/src/elements/nces/WorkflowFailureActions.mjs +1 -1
- package/src/elements/nces/WorkflowOutputs.cjs +2 -2
- package/src/elements/nces/WorkflowOutputs.mjs +1 -1
- package/src/elements/nces/WorkflowParameters.cjs +2 -2
- package/src/elements/nces/WorkflowParameters.mjs +1 -1
- package/src/elements/nces/WorkflowSteps.cjs +2 -2
- package/src/elements/nces/WorkflowSteps.mjs +1 -1
- package/src/elements/nces/WorkflowSuccessActions.cjs +2 -2
- package/src/elements/nces/WorkflowSuccessActions.mjs +1 -1
- package/src/elements/nces/Workflows.cjs +2 -2
- package/src/elements/nces/Workflows.mjs +1 -1
- package/src/index.cjs +39 -34
- package/src/index.mjs +5 -5
- package/src/predicates.cjs +72 -277
- package/src/predicates.mjs +36 -277
- package/src/refractor/index.cjs +163 -17
- package/src/refractor/index.mjs +145 -16
- package/src/refractor/inspect.cjs +118 -0
- package/src/refractor/inspect.mjs +98 -0
- package/src/refractor/plugins/replace-empty-element.cjs +19 -18
- package/src/refractor/plugins/replace-empty-element.mjs +18 -17
- package/src/refractor/predicates.cjs +3 -2
- package/src/refractor/predicates.mjs +2 -1
- package/src/refractor/specification.cjs +19 -1
- package/src/refractor/specification.mjs +19 -1
- package/src/refractor/toolbox.cjs +4 -7
- package/src/refractor/toolbox.mjs +4 -6
- package/src/refractor/visitors/FallbackVisitor.cjs +4 -4
- package/src/refractor/visitors/FallbackVisitor.mjs +4 -4
- package/src/refractor/visitors/SpecificationExtensionVisitor.cjs +5 -4
- package/src/refractor/visitors/SpecificationExtensionVisitor.mjs +4 -3
- package/src/refractor/visitors/SpecificationVisitor.cjs +4 -3
- package/src/refractor/visitors/SpecificationVisitor.mjs +3 -2
- package/src/refractor/visitors/Visitor.cjs +10 -8
- package/src/refractor/visitors/Visitor.mjs +11 -9
- package/src/refractor/visitors/arazzo-1/ArazzoVisitor.cjs +5 -6
- package/src/refractor/visitors/arazzo-1/ArazzoVisitor.mjs +6 -7
- package/src/refractor/visitors/arazzo-1/SourceDescriptionsVisitor.cjs +5 -7
- package/src/refractor/visitors/arazzo-1/SourceDescriptionsVisitor.mjs +5 -7
- package/src/refractor/visitors/arazzo-1/WorkflowsVisitor.cjs +5 -7
- package/src/refractor/visitors/arazzo-1/WorkflowsVisitor.mjs +5 -7
- package/src/refractor/visitors/arazzo-1/bases.cjs +39 -0
- package/src/refractor/visitors/arazzo-1/bases.mjs +34 -0
- package/src/refractor/visitors/arazzo-1/components/FailureActionsVisitor.cjs +2 -4
- package/src/refractor/visitors/arazzo-1/components/FailureActionsVisitor.mjs +2 -4
- package/src/refractor/visitors/arazzo-1/components/InputsVisitor.cjs +2 -4
- package/src/refractor/visitors/arazzo-1/components/InputsVisitor.mjs +2 -4
- package/src/refractor/visitors/arazzo-1/components/ParametersVisitor.cjs +2 -4
- package/src/refractor/visitors/arazzo-1/components/ParametersVisitor.mjs +2 -4
- package/src/refractor/visitors/arazzo-1/components/SuccessActionsVisitor.cjs +2 -4
- package/src/refractor/visitors/arazzo-1/components/SuccessActionsVisitor.mjs +2 -4
- package/src/refractor/visitors/arazzo-1/components/index.cjs +2 -4
- package/src/refractor/visitors/arazzo-1/components/index.mjs +2 -4
- package/src/refractor/visitors/arazzo-1/criterion/TypeVisitor.cjs +4 -6
- package/src/refractor/visitors/arazzo-1/criterion/TypeVisitor.mjs +4 -5
- package/src/refractor/visitors/arazzo-1/criterion/index.cjs +2 -4
- package/src/refractor/visitors/arazzo-1/criterion/index.mjs +2 -4
- package/src/refractor/visitors/arazzo-1/criterion-expression-type/VersionVisitor.cjs +2 -3
- package/src/refractor/visitors/arazzo-1/criterion-expression-type/VersionVisitor.mjs +2 -3
- package/src/refractor/visitors/arazzo-1/criterion-expression-type/index.cjs +2 -4
- package/src/refractor/visitors/arazzo-1/criterion-expression-type/index.mjs +2 -4
- package/src/refractor/visitors/arazzo-1/failure-action/CriteriaVisitor.cjs +5 -7
- package/src/refractor/visitors/arazzo-1/failure-action/CriteriaVisitor.mjs +5 -7
- package/src/refractor/visitors/arazzo-1/failure-action/index.cjs +2 -4
- package/src/refractor/visitors/arazzo-1/failure-action/index.mjs +2 -4
- package/src/refractor/visitors/arazzo-1/index.cjs +4 -5
- package/src/refractor/visitors/arazzo-1/index.mjs +4 -5
- package/src/refractor/visitors/arazzo-1/info/VersionVisitor.cjs +2 -3
- package/src/refractor/visitors/arazzo-1/info/VersionVisitor.mjs +2 -3
- package/src/refractor/visitors/arazzo-1/info/index.cjs +2 -4
- package/src/refractor/visitors/arazzo-1/info/index.mjs +2 -4
- package/src/refractor/visitors/arazzo-1/parameter/index.cjs +2 -4
- package/src/refractor/visitors/arazzo-1/parameter/index.mjs +2 -4
- package/src/refractor/visitors/arazzo-1/payload-replacement/index.cjs +2 -4
- package/src/refractor/visitors/arazzo-1/payload-replacement/index.mjs +2 -4
- package/src/refractor/visitors/arazzo-1/request-body/Replacements.cjs +5 -7
- package/src/refractor/visitors/arazzo-1/request-body/Replacements.mjs +5 -7
- package/src/refractor/visitors/arazzo-1/request-body/index.cjs +2 -4
- package/src/refractor/visitors/arazzo-1/request-body/index.mjs +2 -4
- package/src/refractor/visitors/arazzo-1/reusable/ReferenceVisitor.cjs +2 -3
- package/src/refractor/visitors/arazzo-1/reusable/ReferenceVisitor.mjs +2 -3
- package/src/refractor/visitors/arazzo-1/reusable/index.cjs +6 -7
- package/src/refractor/visitors/arazzo-1/reusable/index.mjs +5 -6
- package/src/refractor/visitors/arazzo-1/source-description/UrlVisitor.cjs +2 -3
- package/src/refractor/visitors/arazzo-1/source-description/UrlVisitor.mjs +2 -3
- package/src/refractor/visitors/arazzo-1/source-description/index.cjs +2 -4
- package/src/refractor/visitors/arazzo-1/source-description/index.mjs +2 -4
- package/src/refractor/visitors/arazzo-1/step/OnFailureVisitor.cjs +6 -8
- package/src/refractor/visitors/arazzo-1/step/OnFailureVisitor.mjs +6 -8
- package/src/refractor/visitors/arazzo-1/step/OnSuccessVisitor.cjs +6 -8
- package/src/refractor/visitors/arazzo-1/step/OnSuccessVisitor.mjs +6 -8
- package/src/refractor/visitors/arazzo-1/step/OutputsVisitor.cjs +2 -4
- package/src/refractor/visitors/arazzo-1/step/OutputsVisitor.mjs +2 -4
- package/src/refractor/visitors/arazzo-1/step/ParametersVisitor.cjs +6 -8
- package/src/refractor/visitors/arazzo-1/step/ParametersVisitor.mjs +6 -8
- package/src/refractor/visitors/arazzo-1/step/SuccessCriteriaVisitor.cjs +5 -7
- package/src/refractor/visitors/arazzo-1/step/SuccessCriteriaVisitor.mjs +5 -7
- package/src/refractor/visitors/arazzo-1/step/index.cjs +2 -4
- package/src/refractor/visitors/arazzo-1/step/index.mjs +2 -4
- package/src/refractor/visitors/arazzo-1/success-action/CriteriaVisitor.cjs +5 -7
- package/src/refractor/visitors/arazzo-1/success-action/CriteriaVisitor.mjs +5 -7
- package/src/refractor/visitors/arazzo-1/success-action/index.cjs +2 -4
- package/src/refractor/visitors/arazzo-1/success-action/index.mjs +2 -4
- package/src/refractor/visitors/arazzo-1/workflow/DependsOnVisitor.cjs +5 -7
- package/src/refractor/visitors/arazzo-1/workflow/DependsOnVisitor.mjs +5 -7
- package/src/refractor/visitors/arazzo-1/workflow/FailureActionsVisitor.cjs +6 -8
- package/src/refractor/visitors/arazzo-1/workflow/FailureActionsVisitor.mjs +6 -8
- package/src/refractor/visitors/arazzo-1/workflow/OutputsVisitor.cjs +2 -4
- package/src/refractor/visitors/arazzo-1/workflow/OutputsVisitor.mjs +2 -4
- package/src/refractor/visitors/arazzo-1/workflow/ParametersVisitor.cjs +6 -8
- package/src/refractor/visitors/arazzo-1/workflow/ParametersVisitor.mjs +6 -8
- package/src/refractor/visitors/arazzo-1/workflow/StepsVisitor.cjs +5 -7
- package/src/refractor/visitors/arazzo-1/workflow/StepsVisitor.mjs +5 -7
- package/src/refractor/visitors/arazzo-1/workflow/SuccessActionsVisitor.cjs +6 -8
- package/src/refractor/visitors/arazzo-1/workflow/SuccessActionsVisitor.mjs +6 -8
- package/src/refractor/visitors/arazzo-1/workflow/index.cjs +2 -4
- package/src/refractor/visitors/arazzo-1/workflow/index.mjs +2 -4
- package/src/refractor/visitors/generics/FixedFieldsVisitor.cjs +9 -7
- package/src/refractor/visitors/generics/FixedFieldsVisitor.mjs +8 -6
- package/src/refractor/visitors/generics/PatternedFieldsVisitor.cjs +8 -6
- package/src/refractor/visitors/generics/PatternedFieldsVisitor.mjs +8 -6
- package/types/apidom-ns-arazzo-1.d.ts +325 -300
- package/src/refractor/registration.cjs +0 -53
- package/src/refractor/registration.mjs +0 -34
- package/src/traversal/visitor.cjs +0 -38
- package/src/traversal/visitor.mjs +0 -35
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,27 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.0.1](https://github.com/speclynx/apidom/compare/v2.0.0...v2.0.1) (2026-01-14)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @speclynx/apidom-ns-arazzo-1
|
|
9
|
+
|
|
10
|
+
# [2.0.0](https://github.com/speclynx/apidom/compare/v1.12.2...v2.0.0) (2026-01-14)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- limit source maps memory consuption ([#20](https://github.com/speclynx/apidom/issues/20)) ([4a0574f](https://github.com/speclynx/apidom/commit/4a0574fd6d466be7c33c8a5871baacd384918d22))
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
- apply innovations learned during last 3 years ([#11](https://github.com/speclynx/apidom/issues/11)) ([cfdbbfc](https://github.com/speclynx/apidom/commit/cfdbbfc2721b0dadc77eeba31dd4e8768c078d22))
|
|
19
|
+
- **traverse:** move traverse operations to apidom-traverse package ([#18](https://github.com/speclynx/apidom/issues/18)) ([36c9d49](https://github.com/speclynx/apidom/commit/36c9d490ceac2ea961e2b23fbbc72df7fb54bbf3))
|
|
20
|
+
|
|
21
|
+
### BREAKING CHANGES
|
|
22
|
+
|
|
23
|
+
- source maps have been completely rewritten
|
|
24
|
+
- **traverse:** move traverse operations from core to traverse package
|
|
25
|
+
- breaking changes introduced to every package public API
|
|
26
|
+
|
|
6
27
|
## [1.12.2](https://github.com/speclynx/apidom/compare/v1.12.1...v1.12.2) (2025-12-23)
|
|
7
28
|
|
|
8
29
|
**Note:** Version bump only for package @speclynx/apidom-ns-arazzo-1
|
package/NOTICE
CHANGED
|
@@ -5,11 +5,6 @@ This distribution includes modifications by SpecLynx.
|
|
|
5
5
|
All such modifications are licensed under the Apache License, Version 2.0.
|
|
6
6
|
A copy of the Apache 2.0 license can be found in `LICENSES/Apache-2.0.txt`.
|
|
7
7
|
|
|
8
|
-
ApiDOM
|
|
9
|
-
Copyright 2020 SmartBear Software Inc.
|
|
10
|
-
ApiDOM is licensed under Apache 2.0 license.
|
|
11
|
-
Copy of the Apache 2.0 license can be found in `LICENSES/Apache-2.0.txt` file.
|
|
12
|
-
|
|
13
8
|
json-schema-ref-parser
|
|
14
9
|
Copyright (c) 2015 James Messinger
|
|
15
10
|
File packages/apidom-reference/src/util/url.ts (the file) was originally created under MIT license in https://github.com/APIDevTools/json-schema-ref-parser repository.
|
|
@@ -18,8 +13,8 @@ Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
|
|
|
18
13
|
|
|
19
14
|
graphql-js
|
|
20
15
|
Copyright (c) GraphQL Contributors
|
|
21
|
-
File packages/apidom-
|
|
22
|
-
|
|
16
|
+
File packages/apidom-traverse/src/traversal.ts (the file) was originally inspired by https://github.com/graphql/graphql-js repository.
|
|
17
|
+
All modifications are licensed under Apache 2.0 License.
|
|
23
18
|
Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
|
|
24
19
|
|
|
25
20
|
babel-plugin-add-import-extension
|
|
@@ -54,6 +49,20 @@ Copyright (c) 2012 James Halliday, Josh Duff, and other contributors
|
|
|
54
49
|
Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
|
|
55
50
|
All modifications are licensed under Apache 2.0 License.
|
|
56
51
|
|
|
52
|
+
ApiDOM
|
|
53
|
+
Copyright 2020 SmartBear Software Inc.
|
|
54
|
+
ApiDOM is licensed under Apache 2.0 license.
|
|
55
|
+
Copy of the Apache 2.0 license can be found in `LICENSES/Apache-2.0.txt` file.
|
|
56
|
+
|
|
57
|
+
minim
|
|
58
|
+
Copyright (c) 2014 Stephen Mizell
|
|
59
|
+
The apidom-datamodel package contains code originally created under the MIT
|
|
60
|
+
License as part of the Minim project (https://github.com/refractproject/minim).
|
|
61
|
+
This code has been copied into this project and modified.
|
|
62
|
+
The original portions remain licensed under the MIT License. Our modifications
|
|
63
|
+
to that code are licensed under the Apache License 2.0.
|
|
64
|
+
Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
|
|
65
|
+
|
|
57
66
|
---
|
|
58
67
|
|
|
59
68
|
If the SPDX-FileCopyrightText and SPDX-License-Identifier tags are not present in the file,
|
package/README.md
CHANGED
|
@@ -16,20 +16,20 @@ You can install this package via [npm CLI](https://docs.npmjs.com/cli) by runnin
|
|
|
16
16
|
## Arazzo 1.0.1 namespace
|
|
17
17
|
|
|
18
18
|
Arazzo 1.0.1 namespace consists of [number of elements](https://github.com/speclynx/apidom/tree/main/packages/apidom-ns-arazzo-1/src/elements) implemented on top
|
|
19
|
-
of [primitive ones](https://github.com/
|
|
19
|
+
of [primitive ones](https://github.com/speclynx/apidom/tree/main/packages/apidom-datamodel/src/primitives).
|
|
20
20
|
|
|
21
21
|
```js
|
|
22
|
-
import {
|
|
22
|
+
import { Namespace } from '@speclynx/apidom-datamodel';
|
|
23
23
|
import arazzo1Namespace from '@speclynx/apidom-ns-arazzo-1';
|
|
24
24
|
|
|
25
|
-
const namespace =
|
|
25
|
+
const namespace = new Namespace().use(arazzo1Namespace);
|
|
26
26
|
|
|
27
27
|
const objectElement = new namespace.elements.Object();
|
|
28
28
|
const arazzoElement = new namespace.elements.ArazzoSpecification1();
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
When namespace instance is created in this way, it will extend the base namespace
|
|
32
|
-
with the namespace provided as an argument.
|
|
32
|
+
with the namespace plugin provided as an argument.
|
|
33
33
|
|
|
34
34
|
Elements from the namespace can also be used directly by importing them.
|
|
35
35
|
|
|
@@ -55,23 +55,23 @@ isArazzoSpecification1Element(arazzoElement); // => true
|
|
|
55
55
|
|
|
56
56
|
## Traversal
|
|
57
57
|
|
|
58
|
-
Traversing ApiDOM in this namespace is possible by using `
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
Traversing ApiDOM in this namespace is possible by using `traverse` function from `@speclynx/apidom-traverse` package,
|
|
59
|
+
or by using `visit` function from `@speclynx/apidom-core`. Visitor callbacks receive a [Path](https://github.com/speclynx/apidom/blob/main/packages/apidom-traverse/src/Path.ts) object
|
|
60
|
+
which provides access to the current node via `path.node` along with traversal control methods like `path.replaceWith()`, `path.remove()`, `path.skip()`, and `path.stop()`.
|
|
61
61
|
|
|
62
62
|
```js
|
|
63
|
-
import {
|
|
64
|
-
import { ArazzoSpecification1Element
|
|
63
|
+
import { traverse } from '@speclynx/apidom-traverse';
|
|
64
|
+
import { ArazzoSpecification1Element } from '@speclynx/apidom-ns-arazzo-1';
|
|
65
65
|
|
|
66
66
|
const element = new ArazzoSpecification1Element();
|
|
67
67
|
|
|
68
68
|
const visitor = {
|
|
69
|
-
ArazzoSpecification1Element(
|
|
70
|
-
console.dir(
|
|
69
|
+
ArazzoSpecification1Element(path) {
|
|
70
|
+
console.dir(path.node);
|
|
71
71
|
},
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
traverse(element, visitor);
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
## Refractors
|
|
@@ -82,7 +82,7 @@ or generic ApiDOM structures into structures built from elements of this namespa
|
|
|
82
82
|
**Refracting JavaScript structures**:
|
|
83
83
|
|
|
84
84
|
```js
|
|
85
|
-
import {
|
|
85
|
+
import { refractInfo } from '@speclynx/apidom-ns-arazzo-1';
|
|
86
86
|
|
|
87
87
|
const object = {
|
|
88
88
|
title: 'my title',
|
|
@@ -91,14 +91,14 @@ const object = {
|
|
|
91
91
|
version: '0.1.0',
|
|
92
92
|
};
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
refractInfo(object); // => InfoElement({ title, summary, description, version })
|
|
95
95
|
```
|
|
96
96
|
|
|
97
97
|
**Refracting generic ApiDOM structures**:
|
|
98
98
|
|
|
99
99
|
```js
|
|
100
|
-
import { ObjectElement } from '@speclynx/apidom-
|
|
101
|
-
import {
|
|
100
|
+
import { ObjectElement } from '@speclynx/apidom-datamodel';
|
|
101
|
+
import { refractInfo } from '@speclynx/apidom-ns-arazzo-1';
|
|
102
102
|
|
|
103
103
|
const objectElement = new ObjectElement({
|
|
104
104
|
title: 'my title',
|
|
@@ -107,16 +107,16 @@ const objectElement = new ObjectElement({
|
|
|
107
107
|
version: '0.1.0',
|
|
108
108
|
});
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
refractInfo(objectElement); // => InfoElement({ title = 'my title', summary = 'my summary', description = 'my description', version = '0.1.0' })
|
|
111
111
|
```
|
|
112
112
|
|
|
113
113
|
### Refractor plugins
|
|
114
114
|
|
|
115
|
-
Refractors can accept plugins as a second argument of refract
|
|
115
|
+
Refractors can accept plugins as a second argument of the refract function.
|
|
116
116
|
|
|
117
117
|
```js
|
|
118
|
-
import { ObjectElement } from '@speclynx/apidom-
|
|
119
|
-
import {
|
|
118
|
+
import { ObjectElement } from '@speclynx/apidom-datamodel';
|
|
119
|
+
import { refractInfo } from '@speclynx/apidom-ns-arazzo-1';
|
|
120
120
|
|
|
121
121
|
const objectElement = new ObjectElement({
|
|
122
122
|
title: 'my title',
|
|
@@ -131,8 +131,8 @@ const plugin = ({ predicates, namespace }) => ({
|
|
|
131
131
|
console.dir('runs before traversal');
|
|
132
132
|
},
|
|
133
133
|
visitor: {
|
|
134
|
-
InfoElement(
|
|
135
|
-
|
|
134
|
+
InfoElement(path) {
|
|
135
|
+
path.node.version = '2.0.0';
|
|
136
136
|
},
|
|
137
137
|
},
|
|
138
138
|
post() {
|
|
@@ -140,7 +140,7 @@ const plugin = ({ predicates, namespace }) => ({
|
|
|
140
140
|
},
|
|
141
141
|
});
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
refractInfo(objectElement, { plugins: [plugin] }); // => InfoElement({ title = 'my title', description = 'my description', version = '2.0.0' })
|
|
144
144
|
```
|
|
145
145
|
|
|
146
146
|
You can define as many plugins as needed to enhance the resulting namespaced ApiDOM structure.
|
|
@@ -154,14 +154,14 @@ this missing value with the most appropriate semantic element type.
|
|
|
154
154
|
|
|
155
155
|
```js
|
|
156
156
|
import { parse } from '@speclynx/apidom-parser-adapter-yaml-1-2';
|
|
157
|
-
import { refractorPluginReplaceEmptyElement,
|
|
157
|
+
import { refractorPluginReplaceEmptyElement, refractArazzoSpecification1 } from '@speclynx/apidom-ns-arazzo-1';
|
|
158
158
|
|
|
159
159
|
const yamlDefinition = `
|
|
160
160
|
arazzo: 1.0.1
|
|
161
161
|
info:
|
|
162
162
|
`;
|
|
163
163
|
const apiDOM = await parse(yamlDefinition);
|
|
164
|
-
const arazzoElement =
|
|
164
|
+
const arazzoElement = refractArazzoSpecification1(apiDOM.result, {
|
|
165
165
|
plugins: [refractorPluginReplaceEmptyElement()],
|
|
166
166
|
});
|
|
167
167
|
|