@swagger-api/apidom-ns-arazzo-1 1.0.0-beta.30

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 (159) hide show
  1. package/CHANGELOG.md +252 -0
  2. package/LICENSES/AFL-3.0.txt +182 -0
  3. package/LICENSES/Apache-2.0.txt +202 -0
  4. package/LICENSES/BSD-3-Clause.txt +26 -0
  5. package/LICENSES/MIT.txt +9 -0
  6. package/NOTICE +83 -0
  7. package/README.md +203 -0
  8. package/dist/apidom-ns-arazzo-1.browser.js +26005 -0
  9. package/dist/apidom-ns-arazzo-1.browser.min.js +1 -0
  10. package/package.json +63 -0
  11. package/src/elements/ArazzoSpec.cjs +17 -0
  12. package/src/elements/ArazzoSpec.mjs +14 -0
  13. package/src/elements/ArazzoSpecification1.cjs +47 -0
  14. package/src/elements/ArazzoSpecification1.mjs +43 -0
  15. package/src/elements/Components.cjs +27 -0
  16. package/src/elements/Components.mjs +24 -0
  17. package/src/elements/Criterion.cjs +33 -0
  18. package/src/elements/Criterion.mjs +30 -0
  19. package/src/elements/FailureAction.cjs +51 -0
  20. package/src/elements/FailureAction.mjs +48 -0
  21. package/src/elements/Info.cjs +40 -0
  22. package/src/elements/Info.mjs +37 -0
  23. package/src/elements/Parameter.cjs +45 -0
  24. package/src/elements/Parameter.mjs +42 -0
  25. package/src/elements/Reference.cjs +28 -0
  26. package/src/elements/Reference.mjs +25 -0
  27. package/src/elements/SourceDescription.cjs +33 -0
  28. package/src/elements/SourceDescription.mjs +30 -0
  29. package/src/elements/Step.cjs +81 -0
  30. package/src/elements/Step.mjs +78 -0
  31. package/src/elements/SuccessAction.cjs +39 -0
  32. package/src/elements/SuccessAction.mjs +36 -0
  33. package/src/elements/Workflow.cjs +51 -0
  34. package/src/elements/Workflow.mjs +47 -0
  35. package/src/elements/nces/ComponentsInputs.cjs +16 -0
  36. package/src/elements/nces/ComponentsInputs.mjs +13 -0
  37. package/src/elements/nces/ComponentsParameters.cjs +16 -0
  38. package/src/elements/nces/ComponentsParameters.mjs +13 -0
  39. package/src/elements/nces/FailureActionCriteria.cjs +17 -0
  40. package/src/elements/nces/FailureActionCriteria.mjs +14 -0
  41. package/src/elements/nces/SourceDescriptions.cjs +16 -0
  42. package/src/elements/nces/SourceDescriptions.mjs +13 -0
  43. package/src/elements/nces/StepDependsOn.cjs +16 -0
  44. package/src/elements/nces/StepDependsOn.mjs +13 -0
  45. package/src/elements/nces/StepOnFailure.cjs +16 -0
  46. package/src/elements/nces/StepOnFailure.mjs +13 -0
  47. package/src/elements/nces/StepOnSuccess.cjs +16 -0
  48. package/src/elements/nces/StepOnSuccess.mjs +13 -0
  49. package/src/elements/nces/StepOutputs.cjs +16 -0
  50. package/src/elements/nces/StepOutputs.mjs +13 -0
  51. package/src/elements/nces/StepParameters.cjs +17 -0
  52. package/src/elements/nces/StepParameters.mjs +14 -0
  53. package/src/elements/nces/StepSuccessCriteria.cjs +17 -0
  54. package/src/elements/nces/StepSuccessCriteria.mjs +14 -0
  55. package/src/elements/nces/SuccessActionCriteria.cjs +17 -0
  56. package/src/elements/nces/SuccessActionCriteria.mjs +14 -0
  57. package/src/elements/nces/WorkflowOutputs.cjs +16 -0
  58. package/src/elements/nces/WorkflowOutputs.mjs +13 -0
  59. package/src/elements/nces/WorkflowSteps.cjs +16 -0
  60. package/src/elements/nces/WorkflowSteps.mjs +13 -0
  61. package/src/elements/nces/Workflows.cjs +16 -0
  62. package/src/elements/nces/Workflows.mjs +13 -0
  63. package/src/index.cjs +115 -0
  64. package/src/index.mjs +32 -0
  65. package/src/media-types.cjs +34 -0
  66. package/src/media-types.mjs +30 -0
  67. package/src/namespace.cjs +43 -0
  68. package/src/namespace.mjs +38 -0
  69. package/src/predicates.cjs +311 -0
  70. package/src/predicates.mjs +305 -0
  71. package/src/refractor/index.cjs +52 -0
  72. package/src/refractor/index.mjs +46 -0
  73. package/src/refractor/plugins/replace-empty-element.cjs +89 -0
  74. package/src/refractor/plugins/replace-empty-element.mjs +83 -0
  75. package/src/refractor/predicates.cjs +17 -0
  76. package/src/refractor/predicates.mjs +11 -0
  77. package/src/refractor/registration.cjs +44 -0
  78. package/src/refractor/registration.mjs +28 -0
  79. package/src/refractor/specification.cjs +237 -0
  80. package/src/refractor/specification.mjs +231 -0
  81. package/src/refractor/toolbox.cjs +23 -0
  82. package/src/refractor/toolbox.mjs +17 -0
  83. package/src/refractor/visitors/FallbackVisitor.cjs +24 -0
  84. package/src/refractor/visitors/FallbackVisitor.mjs +18 -0
  85. package/src/refractor/visitors/SpecificationExtensionVisitor.cjs +18 -0
  86. package/src/refractor/visitors/SpecificationExtensionVisitor.mjs +13 -0
  87. package/src/refractor/visitors/SpecificationVisitor.cjs +74 -0
  88. package/src/refractor/visitors/SpecificationVisitor.mjs +68 -0
  89. package/src/refractor/visitors/Visitor.cjs +34 -0
  90. package/src/refractor/visitors/Visitor.mjs +31 -0
  91. package/src/refractor/visitors/arazzo-1/ArazzoSpecVisitor.cjs +26 -0
  92. package/src/refractor/visitors/arazzo-1/ArazzoSpecVisitor.mjs +20 -0
  93. package/src/refractor/visitors/arazzo-1/FailureActionCriteriaVisitor.cjs +34 -0
  94. package/src/refractor/visitors/arazzo-1/FailureActionCriteriaVisitor.mjs +28 -0
  95. package/src/refractor/visitors/arazzo-1/ParametersVisitor.cjs +39 -0
  96. package/src/refractor/visitors/arazzo-1/ParametersVisitor.mjs +33 -0
  97. package/src/refractor/visitors/arazzo-1/SourceDescriptionsVisitor.cjs +34 -0
  98. package/src/refractor/visitors/arazzo-1/SourceDescriptionsVisitor.mjs +28 -0
  99. package/src/refractor/visitors/arazzo-1/SuccessActionCriteriaVisitor.cjs +34 -0
  100. package/src/refractor/visitors/arazzo-1/SuccessActionCriteriaVisitor.mjs +28 -0
  101. package/src/refractor/visitors/arazzo-1/WorkflowsVisitor.cjs +34 -0
  102. package/src/refractor/visitors/arazzo-1/WorkflowsVisitor.mjs +28 -0
  103. package/src/refractor/visitors/arazzo-1/components/InputsVisitor.cjs +25 -0
  104. package/src/refractor/visitors/arazzo-1/components/InputsVisitor.mjs +19 -0
  105. package/src/refractor/visitors/arazzo-1/components/ParametersVisitor.cjs +25 -0
  106. package/src/refractor/visitors/arazzo-1/components/ParametersVisitor.mjs +19 -0
  107. package/src/refractor/visitors/arazzo-1/components/index.cjs +26 -0
  108. package/src/refractor/visitors/arazzo-1/components/index.mjs +20 -0
  109. package/src/refractor/visitors/arazzo-1/criterion/index.cjs +26 -0
  110. package/src/refractor/visitors/arazzo-1/criterion/index.mjs +20 -0
  111. package/src/refractor/visitors/arazzo-1/failure-action/index.cjs +26 -0
  112. package/src/refractor/visitors/arazzo-1/failure-action/index.mjs +20 -0
  113. package/src/refractor/visitors/arazzo-1/index.cjs +32 -0
  114. package/src/refractor/visitors/arazzo-1/index.mjs +26 -0
  115. package/src/refractor/visitors/arazzo-1/info/VersionVisitor.cjs +18 -0
  116. package/src/refractor/visitors/arazzo-1/info/VersionVisitor.mjs +13 -0
  117. package/src/refractor/visitors/arazzo-1/info/index.cjs +26 -0
  118. package/src/refractor/visitors/arazzo-1/info/index.mjs +20 -0
  119. package/src/refractor/visitors/arazzo-1/parameter/index.cjs +26 -0
  120. package/src/refractor/visitors/arazzo-1/parameter/index.mjs +20 -0
  121. package/src/refractor/visitors/arazzo-1/reference/$RefVisitor.cjs +18 -0
  122. package/src/refractor/visitors/arazzo-1/reference/$RefVisitor.mjs +12 -0
  123. package/src/refractor/visitors/arazzo-1/reference/index.cjs +36 -0
  124. package/src/refractor/visitors/arazzo-1/reference/index.mjs +30 -0
  125. package/src/refractor/visitors/arazzo-1/source-description/UrlVisitor.cjs +17 -0
  126. package/src/refractor/visitors/arazzo-1/source-description/UrlVisitor.mjs +12 -0
  127. package/src/refractor/visitors/arazzo-1/source-description/index.cjs +26 -0
  128. package/src/refractor/visitors/arazzo-1/source-description/index.mjs +20 -0
  129. package/src/refractor/visitors/arazzo-1/step/DependsOnVisitor.cjs +26 -0
  130. package/src/refractor/visitors/arazzo-1/step/DependsOnVisitor.mjs +20 -0
  131. package/src/refractor/visitors/arazzo-1/step/OnFailureVisitor.cjs +33 -0
  132. package/src/refractor/visitors/arazzo-1/step/OnFailureVisitor.mjs +27 -0
  133. package/src/refractor/visitors/arazzo-1/step/OnSuccessVisitor.cjs +33 -0
  134. package/src/refractor/visitors/arazzo-1/step/OnSuccessVisitor.mjs +27 -0
  135. package/src/refractor/visitors/arazzo-1/step/OutputsVisitor.cjs +25 -0
  136. package/src/refractor/visitors/arazzo-1/step/OutputsVisitor.mjs +19 -0
  137. package/src/refractor/visitors/arazzo-1/step/ParametersVisitor.cjs +38 -0
  138. package/src/refractor/visitors/arazzo-1/step/ParametersVisitor.mjs +32 -0
  139. package/src/refractor/visitors/arazzo-1/step/SuccessCriteriaVisitor.cjs +33 -0
  140. package/src/refractor/visitors/arazzo-1/step/SuccessCriteriaVisitor.mjs +27 -0
  141. package/src/refractor/visitors/arazzo-1/step/index.cjs +26 -0
  142. package/src/refractor/visitors/arazzo-1/step/index.mjs +20 -0
  143. package/src/refractor/visitors/arazzo-1/success-action/index.cjs +26 -0
  144. package/src/refractor/visitors/arazzo-1/success-action/index.mjs +20 -0
  145. package/src/refractor/visitors/arazzo-1/workflow/OutputsVisitor.cjs +25 -0
  146. package/src/refractor/visitors/arazzo-1/workflow/OutputsVisitor.mjs +19 -0
  147. package/src/refractor/visitors/arazzo-1/workflow/StepsVisitor.cjs +33 -0
  148. package/src/refractor/visitors/arazzo-1/workflow/StepsVisitor.mjs +27 -0
  149. package/src/refractor/visitors/arazzo-1/workflow/index.cjs +26 -0
  150. package/src/refractor/visitors/arazzo-1/workflow/index.mjs +20 -0
  151. package/src/refractor/visitors/generics/FixedFieldsVisitor.cjs +67 -0
  152. package/src/refractor/visitors/generics/FixedFieldsVisitor.mjs +60 -0
  153. package/src/refractor/visitors/generics/MapVisitor.cjs +21 -0
  154. package/src/refractor/visitors/generics/MapVisitor.mjs +15 -0
  155. package/src/refractor/visitors/generics/PatternedFieldsVisitor.cjs +67 -0
  156. package/src/refractor/visitors/generics/PatternedFieldsVisitor.mjs +61 -0
  157. package/src/traversal/visitor.cjs +35 -0
  158. package/src/traversal/visitor.mjs +32 -0
  159. package/types/apidom-ns-arazzo-1.d.ts +1549 -0
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) <year> <copyright holders>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/NOTICE ADDED
@@ -0,0 +1,83 @@
1
+ ApiDOM
2
+ Copyright 2020 SmartBear Software Inc.
3
+ ApiDOM is licensed under Apache 2.0 license.
4
+ Copy of the Apache 2.0 license can be found in `LICENSES/Apache-2.0.txt` file.
5
+
6
+ json-schema-ref-parser
7
+ Copyright (c) 2015 James Messinger
8
+ 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.
9
+ The file has been copied into this project and modified. All modifications are licensed under Apache 2.0 License.
10
+ Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
11
+
12
+ graphql-js
13
+ Copyright (c) GraphQL Contributors
14
+ File packages/apidom-ast/src/traversal/visitor.ts (the file) was originally created under MIT license in https://github.com/graphql/graphql-js repository.
15
+ The file has been copied into this project and modified. All modifications are licensed under Apache 2.0 License.
16
+ Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
17
+
18
+ babel-plugin-add-import-extension
19
+ Copyright (c) 2019 Karl Prieb
20
+ File scripts/babel-plugin-add-import-extension.cjs (the file) was originally created under MIT license in https://codeberg.org/karl/babel-plugin-add-import-extension.
21
+ The file has been copied into this project and modified. All modifications are licensed under Apache 2.0 License.
22
+ Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
23
+
24
+ refract-spec
25
+ Copyright (c) 2015 refractproject
26
+ Specific texts in README.md (the file) were originally created under MIT license in https://github.com/refractproject/refract-spec repository.
27
+ Specific texts have been copied into this project and modified. All modifications are licensed under Apache 2.0 License.
28
+ Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
29
+
30
+ api-elements
31
+ Copyright (c) 2015 Apiary Inc.
32
+ Specific texts in README.md (the file) were originally created under MIT license in https://github.com/refractproject/refract-spec repository.
33
+ Specific texts have been copied into this project and modified. All modifications are licensed under Apache 2.0 License.
34
+ Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
35
+
36
+ deepmerge
37
+ Copyright (c) 2012 James Halliday, Josh Duff, and other contributors
38
+ - File packages/apidom-core/src/deepmerge.ts contains algorithms that we originally created
39
+ in https://github.com/TehShrike/deepmerge/blob/master/index.js to handle deep merging of JavaScript Objects and Arrays.
40
+ These algorithms have been reverse engineered and adapted to support deep merging of ApiDOM structures.
41
+ - File packages/apidom-core/test/deepmerge.ts contains tests and fixtures that were originally created
42
+ in https://github.com/TehShrike/deepmerge/blob/master/test/merge.js to test deep merging of JavaScript Objects and Arrays.
43
+ These tests have been adapted to support testing deep merging of ApiDOM structures.
44
+ - File packages/apidom-core/README.md contains text fragments that were originally created
45
+ in https://github.com/TehShrike/deepmerge/blob/master/readme.md to document deepmerge library.
46
+ These text fragments have been amended to describe merging of ApiDOM structures.
47
+ Copy of the MIT license can be found in `LICENSES/MIT.txt` file.
48
+ All modifications are licensed under Apache 2.0 License.
49
+
50
+ OpenAPI Specification 2.0
51
+ Copyright The Linux Foundation
52
+ Fragments of the specification text are embedded in packages/apidom-ls/src/config/openapi.
53
+ Copy of the Apache 2.0 license can be found in `LICENSES/Apache-2.0.txt` file.
54
+
55
+ OpenAPI Specification 3.0.x
56
+ Copyright The Linux Foundation
57
+ Fragments of the specification text are embedded in packages/apidom-ls/src/config/openapi.
58
+ Copy of the Apache 2.0 license can be found in `LICENSES/Apache-2.0.txt` file.
59
+
60
+ OpenAPI Specification 3.1.x
61
+ Copyright The Linux Foundation
62
+ Fragments of the specification text are embedded in packages/apidom-ls/src/config/openapi.
63
+ Copy of the Apache 2.0 license can be found in `LICENSES/Apache-2.0.txt` file.
64
+
65
+ AsyncAPI Specification 2.x / AsyncAPI Initiative
66
+ Copyright The Linux Foundation
67
+ Fragments of the specification text are embedded in packages/apidom-ls/src/config/asyncapi.
68
+ Copy of the Apache 2.0 license can be found in `LICENSES/Apache-2.0.txt` file.
69
+
70
+ JSON Schema Specification (Draft 4/5 -> 2020-12)
71
+ Copyright (c) 2022 JSON Schema Specification Authors
72
+ Fragments of the specification text are embedded in packages/apidom-ls/src/config/common.
73
+ Copy of the BSD 3-Clause "New" or "Revised" License can be found in `LICENSES/BSD-3-Clause.txt` file.
74
+ Copy of the Academic Free License v3.0 can be found in `LICENSES/AFL-3.0.txt` file.
75
+
76
+ ---
77
+
78
+ If the SPDX-FileCopyrightText and SPDX-License-Identifier tags are not present in the file,
79
+ it is assumed that these tags have following implicit value:
80
+
81
+ SPDX-FileCopyrightText: Copyright 2020-2021 SmartBear Software Inc.
82
+ SPDX-License-Identifier: Apache-2.0
83
+
package/README.md ADDED
@@ -0,0 +1,203 @@
1
+ # @swagger-api/apidom-ns-arazzo-1
2
+
3
+ `@swagger-api/apidom-ns-arazzo-1` contains ApiDOM namespace specific to [Arazzo 1.0.1 specification](https://spec.openapis.org/arazzo/latest.html#version-1-0-1).
4
+
5
+ ## Installation
6
+
7
+ You can install this package via [npm CLI](https://docs.npmjs.com/cli) by running the following command:
8
+
9
+ ```sh
10
+ $ npm install @swagger-api/apidom-ns-arazzo-1
11
+ ```
12
+
13
+ ## Arazzo 1.0.1 namespace
14
+
15
+ Arazzo 1.0.1 namespace consists of [number of elements](https://github.com/swagger-api/apidom/tree/main/packages/apidom-ns-arazzo-1/src/elements) implemented on top
16
+ of [primitive ones](https://github.com/refractproject/minim/tree/master/lib/primitives).
17
+
18
+ ```js
19
+ import { createNamespace } from '@swagger-api/apidom-core';
20
+ import arazzo1Namespace from '@swagger-api/apidom-ns-arazzo-1';
21
+
22
+ const namespace = createNamespace(arazzo1Namespace);
23
+
24
+ const objectElement = new namespace.elements.Object();
25
+ const arazzoElement = new namespace.elements.ArazzoSpecification1();
26
+ ```
27
+
28
+ When namespace instance is created in this way, it will extend the base namespace
29
+ with the namespace provided as an argument.
30
+
31
+ Elements from the namespace can also be used directly by importing them.
32
+
33
+ ```js
34
+ import { ArazzoSpecification1Element, InfoElement } from '@swagger-api/apidom-ns-arazzo-1';
35
+
36
+ const infoElement = new InfoElement();
37
+ const arazzoElement = new ArazzoSpecification1Element();
38
+ ```
39
+
40
+ ## Predicates
41
+
42
+ This package exposes [predicates](https://github.com/swagger-api/apidom/blob/main/packages/apidom-ns-arazzo-1/src/predicates.ts)
43
+ for all higher order elements that are part of this namespace.
44
+
45
+ ```js
46
+ import { isArazzoSpecification1Element, ArazzoSpecification1Element } from '@swagger-api/apidom-ns-arazzo-1';
47
+
48
+ const arazzoElement = new ArazzoSpecification1Element();
49
+
50
+ isArazzoSpecification1Element(arazzoElement); // => true
51
+ ```
52
+
53
+ ## Traversal
54
+
55
+ Traversing ApiDOM in this namespace is possible by using `visit` function from `apidom` package.
56
+ This package comes with its own [keyMap](https://github.com/swagger-api/apidom/blob/main/packages/apidom-ns-arazzo-1/src/traversal/visitor.ts) and [nodeTypeGetter](https://github.com/swagger-api/apidom/blob/main/packages/apidom-ns-arazzo-1/src/traversal/visitor.ts).
57
+ To learn more about these `visit` configuration options please refer to [@swagger-api/apidom-ast documentation](https://github.com/swagger-api/apidom/blob/main/packages/apidom-ast/README.md#visit).
58
+
59
+ ```js
60
+ import { visit } from '@swagger-api/apidom-core';
61
+ import { ArazzoSpecification1Element, keyMap, getNodeType } from '@swagger-api/apidom-ns-arazzo-1';
62
+
63
+ const element = new ArazzoSpecification1Element();
64
+
65
+ const visitor = {
66
+ ArazzoSpecification1Element(arazzoElement) {
67
+ console.dir(arazzoElement);
68
+ },
69
+ };
70
+
71
+ visit(element, visitor, { keyMap, nodeTypeGetter: getNodeType });
72
+ ```
73
+
74
+ ## Refractors
75
+
76
+ Refractor is a special layer inside the namespace that can transform either JavaScript structures
77
+ or generic ApiDOM structures into structures built from elements of this namespace.
78
+
79
+ **Refracting JavaScript structures**:
80
+
81
+ ```js
82
+ import { InfoElement } from '@swagger-api/apidom-ns-arazzo-1';
83
+
84
+ const object = {
85
+ title: 'my title',
86
+ summary: 'my summary',
87
+ description: 'my description',
88
+ version: '0.1.0',
89
+ };
90
+
91
+ InfoElement.refract(object); // => InfoElement({ title, summary, description, version })
92
+ ```
93
+
94
+ **Refracting generic ApiDOM structures**:
95
+
96
+ ```js
97
+ import { ObjectElement } from '@swagger-api/apidom-core';
98
+ import { InfoElement } from '@swagger-api/apidom-ns-arazzo-1';
99
+
100
+ const objectElement = new ObjectElement({
101
+ title: 'my title',
102
+ summary: 'my summary',
103
+ description: 'my description',
104
+ version: '0.1.0',
105
+ });
106
+
107
+ InfoElement.refract(objectElement); // => InfoElement({ title = 'my title', summary = 'my summary', description = 'my description', version = '0.1.0' })
108
+ ```
109
+
110
+ ### Refractor plugins
111
+
112
+ Refractors can accept plugins as a second argument of refract static method.
113
+
114
+ ```js
115
+ import { ObjectElement } from '@swagger-api/apidom-core';
116
+ import { InfoElement } from '@swagger-api/apidom-ns-arazzo-1';
117
+
118
+ const objectElement = new ObjectElement({
119
+ title: 'my title',
120
+ summary: 'my summary',
121
+ description: 'my description',
122
+ version: '0.1.0',
123
+ });
124
+
125
+ const plugin = ({ predicates, namespace }) => ({
126
+ name: 'plugin',
127
+ pre() {
128
+ console.dir('runs before traversal');
129
+ },
130
+ visitor: {
131
+ InfoElement(infoElement) {
132
+ infoElement.version = '2.0.0';
133
+ },
134
+ },
135
+ post() {
136
+ console.dir('runs after traversal');
137
+ },
138
+ });
139
+
140
+ InfoElement.refract(objectElement, { plugins: [plugin] }); // => InfoElement({ title = 'my title', description = 'my description', version = '2.0.0' })
141
+ ```
142
+
143
+ You can define as many plugins as needed to enhance the resulting namespaced ApiDOM structure.
144
+ If multiple plugins with the same visitor method are defined, they run in parallel (just like in Babel).
145
+
146
+ #### Replace Empty Element plugin
147
+
148
+ This plugin is specific to YAML 1.2 format, which allows defining key-value pairs with empty key,
149
+ empty value, or both. If the value is not provided in YAML format, this plugin compensates for
150
+ this missing value with the most appropriate semantic element type.
151
+
152
+ ```js
153
+ import { parse } from '@swagger-api/apidom-parser-adapter-yaml-1-2';
154
+ import { refractorPluginReplaceEmptyElement, ArazzoSpecification1Element } from '@swagger-api/apidom-ns-arazzo-1';
155
+
156
+ const yamlDefinition = `
157
+ arazzo: 1.0.1
158
+ info:
159
+ `;
160
+ const apiDOM = await parse(yamlDefinition);
161
+ const arazzoElement = ArazzoSpecification1Element.refract(apiDOM.result, {
162
+ plugins: [refractorPluginReplaceEmptyElement()],
163
+ });
164
+
165
+ // =>
166
+ // (ArazzoSpecification1Element
167
+ // (MemberElement
168
+ // (StringElement)
169
+ // (StringElement))
170
+ // (MemberElement
171
+ // (StringElement)
172
+ // (InfoElement)))
173
+
174
+ // => without the plugin the result would be as follows:
175
+ // (ArazzoSpecification1Element
176
+ // (MemberElement
177
+ // (StringElement)
178
+ // (StringElement))
179
+ // (MemberElement
180
+ // (StringElement)
181
+ // (StringElement)))
182
+ ```
183
+
184
+ ## Implementation progress
185
+
186
+ Only fully implemented specification objects should be checked here.
187
+
188
+ - [x] [Arazzo Specification Object](https://spec.openapis.org/arazzo/latest.html#arazzo-specification-object)
189
+ - [x] [Info Object](https://spec.openapis.org/arazzo/latest.html#info-object)
190
+ - [x] [Source Description Object](https://spec.openapis.org/arazzo/latest.html#source-description-object)
191
+ - [x] [Workflow Object](https://spec.openapis.org/arazzo/latest.html#workflow-object)
192
+ - [x] [Step Object](https://spec.openapis.org/arazzo/latest.html#step-object)
193
+ - [x] [Parameter Object](https://spec.openapis.org/arazzo/latest.html#parameter-object)
194
+ - [x] [Success Action Object](https://spec.openapis.org/arazzo/latest.html#success-action-object)
195
+ - [x] [Failure Action Object](https://spec.openapis.org/arazzo/latest.html#failure-action-object)
196
+ - [x] [Component Object](https://spec.openapis.org/arazzo/latest.html#components-object)
197
+ - [x] [Reusable Object](https://spec.openapis.org/arazzo/latest.html#reusable-object)
198
+ - [x] [Criterion Object](https://spec.openapis.org/arazzo/latest.html#criterion-object)
199
+ - [x] [Criterion Expression Type Object](https://spec.openapis.org/arazzo/latest.html#criterion-expression-type-object)
200
+ - [x] [Request Body Object](https://spec.openapis.org/arazzo/latest.html#request-body-object)
201
+ - [x] [Reusable Object](https://spec.openapis.org/arazzo/latest.html#reusable-object)
202
+ - [x] [JSON Schema](https://json-schema.org/specification-links#2020-12)
203
+ - [x] [Specification extensions](https://spec.openapis.org/arazzo/latest.html#specification-extensions)