@speclynx/apidom-ns-openapi-2 1.12.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.
Files changed (228) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/LICENSE +202 -0
  3. package/LICENSES/AFL-3.0.txt +182 -0
  4. package/LICENSES/Apache-2.0.txt +202 -0
  5. package/LICENSES/BSD-3-Clause.txt +26 -0
  6. package/LICENSES/MIT.txt +9 -0
  7. package/NOTICE +65 -0
  8. package/README.md +215 -0
  9. package/dist/apidom-ns-openapi-2.browser.js +23072 -0
  10. package/dist/apidom-ns-openapi-2.browser.min.js +1 -0
  11. package/package.json +65 -0
  12. package/src/elements/Contact.cjs +33 -0
  13. package/src/elements/Contact.mjs +30 -0
  14. package/src/elements/Definitions.cjs +15 -0
  15. package/src/elements/Definitions.mjs +12 -0
  16. package/src/elements/Example.cjs +15 -0
  17. package/src/elements/Example.mjs +12 -0
  18. package/src/elements/ExternalDocumentation.cjs +27 -0
  19. package/src/elements/ExternalDocumentation.mjs +24 -0
  20. package/src/elements/Header.cjs +185 -0
  21. package/src/elements/Header.mjs +182 -0
  22. package/src/elements/Headers.cjs +15 -0
  23. package/src/elements/Headers.mjs +12 -0
  24. package/src/elements/Info.cjs +52 -0
  25. package/src/elements/Info.mjs +48 -0
  26. package/src/elements/Items.cjs +190 -0
  27. package/src/elements/Items.mjs +187 -0
  28. package/src/elements/License.cjs +27 -0
  29. package/src/elements/License.mjs +24 -0
  30. package/src/elements/Operation.cjs +78 -0
  31. package/src/elements/Operation.mjs +74 -0
  32. package/src/elements/Parameter.cjs +230 -0
  33. package/src/elements/Parameter.mjs +226 -0
  34. package/src/elements/ParametersDefinitions.cjs +15 -0
  35. package/src/elements/ParametersDefinitions.mjs +12 -0
  36. package/src/elements/PathItem.cjs +69 -0
  37. package/src/elements/PathItem.mjs +65 -0
  38. package/src/elements/Paths.cjs +15 -0
  39. package/src/elements/Paths.mjs +12 -0
  40. package/src/elements/Reference.cjs +22 -0
  41. package/src/elements/Reference.mjs +19 -0
  42. package/src/elements/Response.cjs +39 -0
  43. package/src/elements/Response.mjs +35 -0
  44. package/src/elements/Responses.cjs +21 -0
  45. package/src/elements/Responses.mjs +17 -0
  46. package/src/elements/ResponsesDefinitions.cjs +15 -0
  47. package/src/elements/ResponsesDefinitions.mjs +12 -0
  48. package/src/elements/Schema.cjs +116 -0
  49. package/src/elements/Schema.mjs +113 -0
  50. package/src/elements/Scopes.cjs +15 -0
  51. package/src/elements/Scopes.mjs +12 -0
  52. package/src/elements/SecurityDefinitions.cjs +15 -0
  53. package/src/elements/SecurityDefinitions.mjs +12 -0
  54. package/src/elements/SecurityRequirement.cjs +15 -0
  55. package/src/elements/SecurityRequirement.mjs +12 -0
  56. package/src/elements/SecurityScheme.cjs +63 -0
  57. package/src/elements/SecurityScheme.mjs +60 -0
  58. package/src/elements/Swagger.cjs +106 -0
  59. package/src/elements/Swagger.mjs +102 -0
  60. package/src/elements/SwaggerVersion.cjs +17 -0
  61. package/src/elements/SwaggerVersion.mjs +14 -0
  62. package/src/elements/Tag.cjs +33 -0
  63. package/src/elements/Tag.mjs +29 -0
  64. package/src/elements/Xml.cjs +45 -0
  65. package/src/elements/Xml.mjs +42 -0
  66. package/src/elements/nces/OperationConsumes.cjs +16 -0
  67. package/src/elements/nces/OperationConsumes.mjs +13 -0
  68. package/src/elements/nces/OperationParameters.cjs +17 -0
  69. package/src/elements/nces/OperationParameters.mjs +14 -0
  70. package/src/elements/nces/OperationProduces.cjs +16 -0
  71. package/src/elements/nces/OperationProduces.mjs +13 -0
  72. package/src/elements/nces/OperationSchemes.cjs +16 -0
  73. package/src/elements/nces/OperationSchemes.mjs +13 -0
  74. package/src/elements/nces/OperationSecurity.cjs +17 -0
  75. package/src/elements/nces/OperationSecurity.mjs +14 -0
  76. package/src/elements/nces/OperationTags.cjs +17 -0
  77. package/src/elements/nces/OperationTags.mjs +14 -0
  78. package/src/elements/nces/PathItemParameters.cjs +17 -0
  79. package/src/elements/nces/PathItemParameters.mjs +14 -0
  80. package/src/elements/nces/SwaggerConsumes.cjs +16 -0
  81. package/src/elements/nces/SwaggerConsumes.mjs +13 -0
  82. package/src/elements/nces/SwaggerProduces.cjs +16 -0
  83. package/src/elements/nces/SwaggerProduces.mjs +13 -0
  84. package/src/elements/nces/SwaggerSchemes.cjs +16 -0
  85. package/src/elements/nces/SwaggerSchemes.mjs +13 -0
  86. package/src/elements/nces/SwaggerSecurity.cjs +17 -0
  87. package/src/elements/nces/SwaggerSecurity.mjs +14 -0
  88. package/src/elements/nces/SwaggerTags.cjs +16 -0
  89. package/src/elements/nces/SwaggerTags.mjs +13 -0
  90. package/src/index.cjs +135 -0
  91. package/src/index.mjs +31 -0
  92. package/src/media-types.cjs +34 -0
  93. package/src/media-types.mjs +30 -0
  94. package/src/namespace.cjs +71 -0
  95. package/src/namespace.mjs +66 -0
  96. package/src/predicates.cjs +329 -0
  97. package/src/predicates.mjs +324 -0
  98. package/src/refractor/index.cjs +52 -0
  99. package/src/refractor/index.mjs +46 -0
  100. package/src/refractor/plugins/replace-empty-element.cjs +358 -0
  101. package/src/refractor/plugins/replace-empty-element.mjs +350 -0
  102. package/src/refractor/predicates.cjs +25 -0
  103. package/src/refractor/predicates.mjs +20 -0
  104. package/src/refractor/registration.cjs +87 -0
  105. package/src/refractor/registration.mjs +56 -0
  106. package/src/refractor/specification.cjs +490 -0
  107. package/src/refractor/specification.mjs +484 -0
  108. package/src/refractor/toolbox.cjs +23 -0
  109. package/src/refractor/toolbox.mjs +17 -0
  110. package/src/refractor/visitors/FallbackVisitor.cjs +24 -0
  111. package/src/refractor/visitors/FallbackVisitor.mjs +18 -0
  112. package/src/refractor/visitors/SpecificationExtensionVisitor.cjs +18 -0
  113. package/src/refractor/visitors/SpecificationExtensionVisitor.mjs +13 -0
  114. package/src/refractor/visitors/SpecificationVisitor.cjs +74 -0
  115. package/src/refractor/visitors/SpecificationVisitor.mjs +68 -0
  116. package/src/refractor/visitors/Visitor.cjs +31 -0
  117. package/src/refractor/visitors/Visitor.mjs +28 -0
  118. package/src/refractor/visitors/generics/AlternatingVisitor.cjs +42 -0
  119. package/src/refractor/visitors/generics/AlternatingVisitor.mjs +35 -0
  120. package/src/refractor/visitors/generics/FixedFieldsVisitor.cjs +67 -0
  121. package/src/refractor/visitors/generics/FixedFieldsVisitor.mjs +60 -0
  122. package/src/refractor/visitors/generics/MapVisitor.cjs +21 -0
  123. package/src/refractor/visitors/generics/MapVisitor.mjs +15 -0
  124. package/src/refractor/visitors/generics/MixedFieldsVisitor.cjs +60 -0
  125. package/src/refractor/visitors/generics/MixedFieldsVisitor.mjs +54 -0
  126. package/src/refractor/visitors/generics/PatternedFieldsVisitor.cjs +67 -0
  127. package/src/refractor/visitors/generics/PatternedFieldsVisitor.mjs +61 -0
  128. package/src/refractor/visitors/open-api-2/BasePathVisitor.cjs +17 -0
  129. package/src/refractor/visitors/open-api-2/BasePathVisitor.mjs +12 -0
  130. package/src/refractor/visitors/open-api-2/ConsumesVisitor.cjs +22 -0
  131. package/src/refractor/visitors/open-api-2/ConsumesVisitor.mjs +17 -0
  132. package/src/refractor/visitors/open-api-2/HostVisitor.cjs +17 -0
  133. package/src/refractor/visitors/open-api-2/HostVisitor.mjs +12 -0
  134. package/src/refractor/visitors/open-api-2/ProducesVisitor.cjs +22 -0
  135. package/src/refractor/visitors/open-api-2/ProducesVisitor.mjs +17 -0
  136. package/src/refractor/visitors/open-api-2/SchemesVisitor.cjs +22 -0
  137. package/src/refractor/visitors/open-api-2/SchemesVisitor.mjs +17 -0
  138. package/src/refractor/visitors/open-api-2/SecurityVisitor.cjs +33 -0
  139. package/src/refractor/visitors/open-api-2/SecurityVisitor.mjs +27 -0
  140. package/src/refractor/visitors/open-api-2/SwaggerVisitor.cjs +26 -0
  141. package/src/refractor/visitors/open-api-2/SwaggerVisitor.mjs +20 -0
  142. package/src/refractor/visitors/open-api-2/TagsVisitor.cjs +33 -0
  143. package/src/refractor/visitors/open-api-2/TagsVisitor.mjs +27 -0
  144. package/src/refractor/visitors/open-api-2/contact/index.cjs +26 -0
  145. package/src/refractor/visitors/open-api-2/contact/index.mjs +20 -0
  146. package/src/refractor/visitors/open-api-2/definitions/index.cjs +38 -0
  147. package/src/refractor/visitors/open-api-2/definitions/index.mjs +32 -0
  148. package/src/refractor/visitors/open-api-2/example/index.cjs +26 -0
  149. package/src/refractor/visitors/open-api-2/example/index.mjs +20 -0
  150. package/src/refractor/visitors/open-api-2/external-documentation/index.cjs +26 -0
  151. package/src/refractor/visitors/open-api-2/external-documentation/index.mjs +20 -0
  152. package/src/refractor/visitors/open-api-2/header/index.cjs +26 -0
  153. package/src/refractor/visitors/open-api-2/header/index.mjs +20 -0
  154. package/src/refractor/visitors/open-api-2/headers/index.cjs +26 -0
  155. package/src/refractor/visitors/open-api-2/headers/index.mjs +20 -0
  156. package/src/refractor/visitors/open-api-2/index.cjs +26 -0
  157. package/src/refractor/visitors/open-api-2/index.mjs +20 -0
  158. package/src/refractor/visitors/open-api-2/info/VersionVisitor.cjs +18 -0
  159. package/src/refractor/visitors/open-api-2/info/VersionVisitor.mjs +13 -0
  160. package/src/refractor/visitors/open-api-2/info/index.cjs +26 -0
  161. package/src/refractor/visitors/open-api-2/info/index.mjs +20 -0
  162. package/src/refractor/visitors/open-api-2/items/index.cjs +28 -0
  163. package/src/refractor/visitors/open-api-2/items/index.mjs +22 -0
  164. package/src/refractor/visitors/open-api-2/license/index.cjs +26 -0
  165. package/src/refractor/visitors/open-api-2/license/index.mjs +20 -0
  166. package/src/refractor/visitors/open-api-2/operation/ConsumesVisitor.cjs +22 -0
  167. package/src/refractor/visitors/open-api-2/operation/ConsumesVisitor.mjs +17 -0
  168. package/src/refractor/visitors/open-api-2/operation/ParametersVisitor.cjs +38 -0
  169. package/src/refractor/visitors/open-api-2/operation/ParametersVisitor.mjs +32 -0
  170. package/src/refractor/visitors/open-api-2/operation/ProducesVisitor.cjs +22 -0
  171. package/src/refractor/visitors/open-api-2/operation/ProducesVisitor.mjs +17 -0
  172. package/src/refractor/visitors/open-api-2/operation/SchemesVisitor.cjs +22 -0
  173. package/src/refractor/visitors/open-api-2/operation/SchemesVisitor.mjs +17 -0
  174. package/src/refractor/visitors/open-api-2/operation/SecurityVisitor.cjs +33 -0
  175. package/src/refractor/visitors/open-api-2/operation/SecurityVisitor.mjs +27 -0
  176. package/src/refractor/visitors/open-api-2/operation/TagsVisitor.cjs +22 -0
  177. package/src/refractor/visitors/open-api-2/operation/TagsVisitor.mjs +17 -0
  178. package/src/refractor/visitors/open-api-2/operation/index.cjs +25 -0
  179. package/src/refractor/visitors/open-api-2/operation/index.mjs +19 -0
  180. package/src/refractor/visitors/open-api-2/parameter/index.cjs +26 -0
  181. package/src/refractor/visitors/open-api-2/parameter/index.mjs +20 -0
  182. package/src/refractor/visitors/open-api-2/parameters-definitions/index.cjs +25 -0
  183. package/src/refractor/visitors/open-api-2/parameters-definitions/index.mjs +19 -0
  184. package/src/refractor/visitors/open-api-2/path-item/$RefVisitor.cjs +17 -0
  185. package/src/refractor/visitors/open-api-2/path-item/$RefVisitor.mjs +12 -0
  186. package/src/refractor/visitors/open-api-2/path-item/ParametersVisitor.cjs +38 -0
  187. package/src/refractor/visitors/open-api-2/path-item/ParametersVisitor.mjs +32 -0
  188. package/src/refractor/visitors/open-api-2/path-item/index.cjs +45 -0
  189. package/src/refractor/visitors/open-api-2/path-item/index.mjs +39 -0
  190. package/src/refractor/visitors/open-api-2/paths/index.cjs +43 -0
  191. package/src/refractor/visitors/open-api-2/paths/index.mjs +37 -0
  192. package/src/refractor/visitors/open-api-2/reference/$RefVisitor.cjs +17 -0
  193. package/src/refractor/visitors/open-api-2/reference/$RefVisitor.mjs +12 -0
  194. package/src/refractor/visitors/open-api-2/reference/index.cjs +36 -0
  195. package/src/refractor/visitors/open-api-2/reference/index.mjs +30 -0
  196. package/src/refractor/visitors/open-api-2/response/index.cjs +26 -0
  197. package/src/refractor/visitors/open-api-2/response/index.mjs +20 -0
  198. package/src/refractor/visitors/open-api-2/responses/DefaultVisitor.cjs +42 -0
  199. package/src/refractor/visitors/open-api-2/responses/DefaultVisitor.mjs +36 -0
  200. package/src/refractor/visitors/open-api-2/responses/index.cjs +52 -0
  201. package/src/refractor/visitors/open-api-2/responses/index.mjs +46 -0
  202. package/src/refractor/visitors/open-api-2/responses-definitions/index.cjs +25 -0
  203. package/src/refractor/visitors/open-api-2/responses-definitions/index.mjs +19 -0
  204. package/src/refractor/visitors/open-api-2/schema/AllOfVisitor.cjs +25 -0
  205. package/src/refractor/visitors/open-api-2/schema/AllOfVisitor.mjs +21 -0
  206. package/src/refractor/visitors/open-api-2/schema/ItemsVisitor.cjs +32 -0
  207. package/src/refractor/visitors/open-api-2/schema/ItemsVisitor.mjs +28 -0
  208. package/src/refractor/visitors/open-api-2/schema/PropertiesVisitor.cjs +25 -0
  209. package/src/refractor/visitors/open-api-2/schema/PropertiesVisitor.mjs +21 -0
  210. package/src/refractor/visitors/open-api-2/schema/SchemaOrJSONReferenceVisitor.cjs +24 -0
  211. package/src/refractor/visitors/open-api-2/schema/SchemaOrJSONReferenceVisitor.mjs +20 -0
  212. package/src/refractor/visitors/open-api-2/schema/index.cjs +26 -0
  213. package/src/refractor/visitors/open-api-2/schema/index.mjs +20 -0
  214. package/src/refractor/visitors/open-api-2/scopes/index.cjs +26 -0
  215. package/src/refractor/visitors/open-api-2/scopes/index.mjs +20 -0
  216. package/src/refractor/visitors/open-api-2/security-definitions/index.cjs +26 -0
  217. package/src/refractor/visitors/open-api-2/security-definitions/index.mjs +20 -0
  218. package/src/refractor/visitors/open-api-2/security-requirement/index.cjs +25 -0
  219. package/src/refractor/visitors/open-api-2/security-requirement/index.mjs +19 -0
  220. package/src/refractor/visitors/open-api-2/security-scheme/index.cjs +26 -0
  221. package/src/refractor/visitors/open-api-2/security-scheme/index.mjs +20 -0
  222. package/src/refractor/visitors/open-api-2/tag/index.cjs +26 -0
  223. package/src/refractor/visitors/open-api-2/tag/index.mjs +20 -0
  224. package/src/refractor/visitors/open-api-2/xml/index.cjs +26 -0
  225. package/src/refractor/visitors/open-api-2/xml/index.mjs +20 -0
  226. package/src/traversal/visitor.cjs +56 -0
  227. package/src/traversal/visitor.mjs +53 -0
  228. package/types/apidom-ns-openapi-2.d.ts +2485 -0
@@ -0,0 +1,484 @@
1
+ import { specificationObj as JSONSchemaDraft4Specification } from '@speclynx/apidom-ns-json-schema-draft-4';
2
+ import FallbackVisitor from "./visitors/FallbackVisitor.mjs";
3
+ import SwaggerVisitor from "./visitors/open-api-2/index.mjs";
4
+ import SwaggerSwaggerVisitor from "./visitors/open-api-2/SwaggerVisitor.mjs";
5
+ import SwaggerHostVisitor from "./visitors/open-api-2/HostVisitor.mjs";
6
+ import SwaggerBasePathVisitor from "./visitors/open-api-2/BasePathVisitor.mjs";
7
+ import SwaggerSchemesVisitor from "./visitors/open-api-2/SchemesVisitor.mjs";
8
+ import SwaggerConsumesVisitor from "./visitors/open-api-2/ConsumesVisitor.mjs";
9
+ import SwaggerProducesVisitor from "./visitors/open-api-2/ProducesVisitor.mjs";
10
+ import SwaggerSecurityVisitor from "./visitors/open-api-2/SecurityVisitor.mjs";
11
+ import SwaggerTagsVisitor from "./visitors/open-api-2/TagsVisitor.mjs";
12
+ import InfoVisitor from "./visitors/open-api-2/info/index.mjs";
13
+ import InfoVersionVisitor from "./visitors/open-api-2/info/VersionVisitor.mjs";
14
+ import ContactVisitor from "./visitors/open-api-2/contact/index.mjs";
15
+ import LicenseVisitor from "./visitors/open-api-2/license/index.mjs";
16
+ import PathsVisitor from "./visitors/open-api-2/paths/index.mjs";
17
+ import PathItemVisitor from "./visitors/open-api-2/path-item/index.mjs";
18
+ import PathItem$RefVisitor from "./visitors/open-api-2/path-item/$RefVisitor.mjs";
19
+ import PathItemParametersVisitor from "./visitors/open-api-2/path-item/ParametersVisitor.mjs";
20
+ import OperationVisitor from "./visitors/open-api-2/operation/index.mjs";
21
+ import OperationTagsVisitor from "./visitors/open-api-2/operation/TagsVisitor.mjs";
22
+ import OperationConsumesVisitor from "./visitors/open-api-2/operation/ConsumesVisitor.mjs";
23
+ import OperationProducesVisitor from "./visitors/open-api-2/operation/ProducesVisitor.mjs";
24
+ import OperationParametersVisitor from "./visitors/open-api-2/operation/ParametersVisitor.mjs";
25
+ import OperationSchemesVisitor from "./visitors/open-api-2/operation/SchemesVisitor.mjs";
26
+ import OperationSecurityVisitor from "./visitors/open-api-2/operation/SecurityVisitor.mjs";
27
+ import ExternalDocumentationElement from "./visitors/open-api-2/external-documentation/index.mjs";
28
+ import ParameterVisitor from "./visitors/open-api-2/parameter/index.mjs";
29
+ import ItemsVisitor from "./visitors/open-api-2/items/index.mjs";
30
+ import ResponsesVisitor from "./visitors/open-api-2/responses/index.mjs";
31
+ import ResponsesDefaultVisitor from "./visitors/open-api-2/responses/DefaultVisitor.mjs";
32
+ import ResponseVisitor from "./visitors/open-api-2/response/index.mjs";
33
+ import HeadersVisitor from "./visitors/open-api-2/headers/index.mjs";
34
+ import ExampleVisitor from "./visitors/open-api-2/example/index.mjs";
35
+ import HeaderVisitor from "./visitors/open-api-2/header/index.mjs";
36
+ import TagVisitor from "./visitors/open-api-2/tag/index.mjs";
37
+ import ReferenceVisitor from "./visitors/open-api-2/reference/index.mjs";
38
+ import Reference$RefVisitor from "./visitors/open-api-2/reference/$RefVisitor.mjs";
39
+ import SchemaVisitor from "./visitors/open-api-2/schema/index.mjs";
40
+ import SchemaAllOfVisitor from "./visitors/open-api-2/schema/AllOfVisitor.mjs";
41
+ import SchemaItemsVisitor from "./visitors/open-api-2/schema/ItemsVisitor.mjs";
42
+ import SchemaPropertiesVisitor from "./visitors/open-api-2/schema/PropertiesVisitor.mjs";
43
+ import SchemaOrJSONReferenceVisitor from "./visitors/open-api-2/schema/SchemaOrJSONReferenceVisitor.mjs";
44
+ import XmlVisitor from "./visitors/open-api-2/xml/index.mjs";
45
+ import DefinitionsVisitor from "./visitors/open-api-2/definitions/index.mjs";
46
+ import ResponsesDefinitionsVisitor from "./visitors/open-api-2/responses-definitions/index.mjs";
47
+ import ParametersDefinitionsVisitor from "./visitors/open-api-2/parameters-definitions/index.mjs";
48
+ import SecurityDefinitionsVisitor from "./visitors/open-api-2/security-definitions/index.mjs";
49
+ import SecuritySchemeVisitor from "./visitors/open-api-2/security-scheme/index.mjs";
50
+ import ScopesVisitor from "./visitors/open-api-2/scopes/index.mjs";
51
+ import SecurityRequirementVisitor from "./visitors/open-api-2/security-requirement/index.mjs";
52
+ import SpecificationExtensionVisitor from "./visitors/SpecificationExtensionVisitor.mjs";
53
+ /**
54
+ * Specification object allows us to have complete control over visitors
55
+ * when traversing the ApiDOM.
56
+ * Specification also allows us to create amended refractors from
57
+ * existing ones by manipulating it.
58
+ *
59
+ * Note: Specification object allows to use absolute internal JSON pointers.
60
+ */
61
+ const {
62
+ fixedFields: jsonSchemaFixedFields
63
+ } = JSONSchemaDraft4Specification.visitors.document.objects.JSONSchema;
64
+
65
+ /**
66
+ * @public
67
+ */
68
+ const specification = {
69
+ visitors: {
70
+ value: FallbackVisitor,
71
+ document: {
72
+ objects: {
73
+ // JSON Schema Draft 4/5 specific visitors
74
+ JSONReference: JSONSchemaDraft4Specification.visitors.document.objects.JSONReference,
75
+ JSONSchema: {
76
+ $ref: '#/visitors/document/objects/Schema'
77
+ },
78
+ // OpenAPI 2 specific visitors
79
+ Swagger: {
80
+ $visitor: SwaggerVisitor,
81
+ fixedFields: {
82
+ swagger: SwaggerSwaggerVisitor,
83
+ info: {
84
+ $ref: '#/visitors/document/objects/Info'
85
+ },
86
+ host: SwaggerHostVisitor,
87
+ basePath: SwaggerBasePathVisitor,
88
+ schemes: SwaggerSchemesVisitor,
89
+ consumes: SwaggerConsumesVisitor,
90
+ produces: SwaggerProducesVisitor,
91
+ paths: {
92
+ $ref: '#/visitors/document/objects/Paths'
93
+ },
94
+ definitions: {
95
+ $ref: '#/visitors/document/objects/Definitions'
96
+ },
97
+ parameters: {
98
+ $ref: '#/visitors/document/objects/ParametersDefinitions'
99
+ },
100
+ responses: {
101
+ $ref: '#/visitors/document/objects/ResponsesDefinitions'
102
+ },
103
+ securityDefinitions: {
104
+ $ref: '#/visitors/document/objects/SecurityDefinitions'
105
+ },
106
+ security: SwaggerSecurityVisitor,
107
+ tags: SwaggerTagsVisitor,
108
+ externalDocs: {
109
+ $ref: '#/visitors/document/objects/ExternalDocumentation'
110
+ }
111
+ }
112
+ },
113
+ Info: {
114
+ $visitor: InfoVisitor,
115
+ fixedFields: {
116
+ title: {
117
+ $ref: '#/visitors/value'
118
+ },
119
+ description: {
120
+ $ref: '#/visitors/value'
121
+ },
122
+ termsOfService: {
123
+ $ref: '#/visitors/value'
124
+ },
125
+ contact: {
126
+ $ref: '#/visitors/document/objects/Contact'
127
+ },
128
+ license: {
129
+ $ref: '#/visitors/document/objects/License'
130
+ },
131
+ version: InfoVersionVisitor
132
+ }
133
+ },
134
+ Contact: {
135
+ $visitor: ContactVisitor,
136
+ fixedFields: {
137
+ name: {
138
+ $ref: '#/visitors/value'
139
+ },
140
+ url: {
141
+ $ref: '#/visitors/value'
142
+ },
143
+ email: {
144
+ $ref: '#/visitors/value'
145
+ }
146
+ }
147
+ },
148
+ License: {
149
+ $visitor: LicenseVisitor,
150
+ fixedFields: {
151
+ name: {
152
+ $ref: '#/visitors/value'
153
+ },
154
+ url: {
155
+ $ref: '#/visitors/value'
156
+ }
157
+ }
158
+ },
159
+ Paths: {
160
+ $visitor: PathsVisitor
161
+ },
162
+ PathItem: {
163
+ $visitor: PathItemVisitor,
164
+ fixedFields: {
165
+ $ref: PathItem$RefVisitor,
166
+ get: {
167
+ $ref: '#/visitors/document/objects/Operation'
168
+ },
169
+ put: {
170
+ $ref: '#/visitors/document/objects/Operation'
171
+ },
172
+ post: {
173
+ $ref: '#/visitors/document/objects/Operation'
174
+ },
175
+ delete: {
176
+ $ref: '#/visitors/document/objects/Operation'
177
+ },
178
+ options: {
179
+ $ref: '#/visitors/document/objects/Operation'
180
+ },
181
+ head: {
182
+ $ref: '#/visitors/document/objects/Operation'
183
+ },
184
+ patch: {
185
+ $ref: '#/visitors/document/objects/Operation'
186
+ },
187
+ parameters: PathItemParametersVisitor
188
+ }
189
+ },
190
+ Operation: {
191
+ $visitor: OperationVisitor,
192
+ fixedFields: {
193
+ tags: OperationTagsVisitor,
194
+ summary: {
195
+ $ref: '#/visitors/value'
196
+ },
197
+ description: {
198
+ $ref: '#/visitors/value'
199
+ },
200
+ externalDocs: {
201
+ $ref: '#/visitors/document/objects/ExternalDocumentation'
202
+ },
203
+ operationId: {
204
+ $ref: '#/visitors/value'
205
+ },
206
+ consumes: OperationConsumesVisitor,
207
+ produces: OperationProducesVisitor,
208
+ parameters: OperationParametersVisitor,
209
+ responses: {
210
+ $ref: '#/visitors/document/objects/Responses'
211
+ },
212
+ schemes: OperationSchemesVisitor,
213
+ deprecated: {
214
+ $ref: '#/visitors/value'
215
+ },
216
+ security: OperationSecurityVisitor
217
+ }
218
+ },
219
+ ExternalDocumentation: {
220
+ $visitor: ExternalDocumentationElement,
221
+ fixedFields: {
222
+ description: {
223
+ $ref: '#/visitors/value'
224
+ },
225
+ url: {
226
+ $ref: '#/visitors/value'
227
+ }
228
+ }
229
+ },
230
+ Parameter: {
231
+ $visitor: ParameterVisitor,
232
+ fixedFields: {
233
+ name: {
234
+ $ref: '#/visitors/value'
235
+ },
236
+ in: {
237
+ $ref: '#/visitors/value'
238
+ },
239
+ description: jsonSchemaFixedFields.description,
240
+ required: jsonSchemaFixedFields.required,
241
+ schema: SchemaOrJSONReferenceVisitor,
242
+ type: jsonSchemaFixedFields.type,
243
+ format: jsonSchemaFixedFields.format,
244
+ items: {
245
+ $ref: '#/visitors/document/objects/Items'
246
+ },
247
+ collectionFormat: {
248
+ $ref: '#/visitors/value'
249
+ },
250
+ default: jsonSchemaFixedFields.default,
251
+ maximum: jsonSchemaFixedFields.maximum,
252
+ exclusiveMaximum: jsonSchemaFixedFields.exclusiveMaximum,
253
+ minimum: jsonSchemaFixedFields.minimum,
254
+ exclusiveMinimum: jsonSchemaFixedFields.exclusiveMinimum,
255
+ maxLength: jsonSchemaFixedFields.maxLength,
256
+ minLength: jsonSchemaFixedFields.minLength,
257
+ pattern: jsonSchemaFixedFields.pattern,
258
+ maxItems: jsonSchemaFixedFields.maxItems,
259
+ minItems: jsonSchemaFixedFields.minItems,
260
+ uniqueItems: jsonSchemaFixedFields.uniqueItems,
261
+ enum: jsonSchemaFixedFields.enum,
262
+ multipleOf: jsonSchemaFixedFields.multipleOf
263
+ }
264
+ },
265
+ Items: {
266
+ $visitor: ItemsVisitor,
267
+ fixedFields: {
268
+ type: jsonSchemaFixedFields.type,
269
+ format: jsonSchemaFixedFields.format,
270
+ items: {
271
+ $ref: '#/visitors/document/objects/Items'
272
+ },
273
+ collectionFormat: {
274
+ $ref: '#/visitors/value'
275
+ },
276
+ default: jsonSchemaFixedFields.default,
277
+ maximum: jsonSchemaFixedFields.maximum,
278
+ exclusiveMaximum: jsonSchemaFixedFields.exclusiveMaximum,
279
+ minimum: jsonSchemaFixedFields.minimum,
280
+ exclusiveMinimum: jsonSchemaFixedFields.exclusiveMinimum,
281
+ maxLength: jsonSchemaFixedFields.maxLength,
282
+ minLength: jsonSchemaFixedFields.minLength,
283
+ pattern: jsonSchemaFixedFields.pattern,
284
+ maxItems: jsonSchemaFixedFields.maxItems,
285
+ minItems: jsonSchemaFixedFields.minItems,
286
+ uniqueItems: jsonSchemaFixedFields.uniqueItems,
287
+ enum: jsonSchemaFixedFields.enum,
288
+ multipleOf: jsonSchemaFixedFields.multipleOf
289
+ }
290
+ },
291
+ Responses: {
292
+ $visitor: ResponsesVisitor,
293
+ fixedFields: {
294
+ default: ResponsesDefaultVisitor
295
+ }
296
+ },
297
+ Response: {
298
+ $visitor: ResponseVisitor,
299
+ fixedFields: {
300
+ description: {
301
+ $ref: '#/visitors/value'
302
+ },
303
+ schema: SchemaOrJSONReferenceVisitor,
304
+ headers: {
305
+ $ref: '#/visitors/document/objects/Headers'
306
+ },
307
+ examples: {
308
+ $ref: '#/visitors/document/objects/Example'
309
+ }
310
+ }
311
+ },
312
+ Headers: {
313
+ $visitor: HeadersVisitor
314
+ },
315
+ Example: {
316
+ $visitor: ExampleVisitor
317
+ },
318
+ Header: {
319
+ $visitor: HeaderVisitor,
320
+ fixedFields: {
321
+ description: jsonSchemaFixedFields.description,
322
+ type: jsonSchemaFixedFields.type,
323
+ format: jsonSchemaFixedFields.format,
324
+ items: {
325
+ $ref: '#/visitors/document/objects/Items'
326
+ },
327
+ collectionFormat: {
328
+ $ref: '#/visitors/value'
329
+ },
330
+ default: jsonSchemaFixedFields.default,
331
+ maximum: jsonSchemaFixedFields.maximum,
332
+ exclusiveMaximum: jsonSchemaFixedFields.exclusiveMaximum,
333
+ minimum: jsonSchemaFixedFields.minimum,
334
+ exclusiveMinimum: jsonSchemaFixedFields.exclusiveMinimum,
335
+ maxLength: jsonSchemaFixedFields.maxLength,
336
+ minLength: jsonSchemaFixedFields.minLength,
337
+ pattern: jsonSchemaFixedFields.pattern,
338
+ maxItems: jsonSchemaFixedFields.maxItems,
339
+ minItems: jsonSchemaFixedFields.minItems,
340
+ uniqueItems: jsonSchemaFixedFields.uniqueItems,
341
+ enum: jsonSchemaFixedFields.enum,
342
+ multipleOf: jsonSchemaFixedFields.multipleOf
343
+ }
344
+ },
345
+ Tag: {
346
+ $visitor: TagVisitor,
347
+ fixedFields: {
348
+ name: {
349
+ $ref: '#/visitors/value'
350
+ },
351
+ description: {
352
+ $ref: '#/visitors/value'
353
+ },
354
+ externalDocs: {
355
+ $ref: '#/visitors/document/objects/ExternalDocumentation'
356
+ }
357
+ }
358
+ },
359
+ Reference: {
360
+ $visitor: ReferenceVisitor,
361
+ fixedFields: {
362
+ $ref: Reference$RefVisitor
363
+ }
364
+ },
365
+ Schema: {
366
+ $visitor: SchemaVisitor,
367
+ fixedFields: {
368
+ // the following properties are taken directly from the JSON Schema definition and follow the same specifications
369
+ format: jsonSchemaFixedFields.format,
370
+ title: jsonSchemaFixedFields.title,
371
+ description: jsonSchemaFixedFields.description,
372
+ default: jsonSchemaFixedFields.default,
373
+ multipleOf: jsonSchemaFixedFields.multipleOf,
374
+ maximum: jsonSchemaFixedFields.maximum,
375
+ exclusiveMaximum: jsonSchemaFixedFields.exclusiveMaximum,
376
+ minimum: jsonSchemaFixedFields.minimum,
377
+ exclusiveMinimum: jsonSchemaFixedFields.exclusiveMinimum,
378
+ maxLength: jsonSchemaFixedFields.maxLength,
379
+ minLength: jsonSchemaFixedFields.minLength,
380
+ pattern: jsonSchemaFixedFields.pattern,
381
+ maxItems: jsonSchemaFixedFields.maxItems,
382
+ minItems: jsonSchemaFixedFields.minItems,
383
+ uniqueItems: jsonSchemaFixedFields.uniqueItems,
384
+ maxProperties: jsonSchemaFixedFields.maxProperties,
385
+ minProperties: jsonSchemaFixedFields.minProperties,
386
+ required: jsonSchemaFixedFields.required,
387
+ enum: jsonSchemaFixedFields.enum,
388
+ type: jsonSchemaFixedFields.type,
389
+ readOnly: jsonSchemaFixedFields.readOnly,
390
+ // the following properties are taken from the JSON Schema definition but their definitions were adjusted to the Swagger Specification
391
+ items: SchemaItemsVisitor,
392
+ allOf: SchemaAllOfVisitor,
393
+ properties: SchemaPropertiesVisitor,
394
+ additionalProperties: SchemaOrJSONReferenceVisitor,
395
+ // OpenAPI vocabulary
396
+ discriminator: {
397
+ $ref: '#/visitors/value'
398
+ },
399
+ xml: {
400
+ $ref: '#/visitors/document/objects/XML'
401
+ },
402
+ externalDocs: {
403
+ $ref: '#/visitors/document/objects/ExternalDocumentation'
404
+ },
405
+ example: {
406
+ $ref: '#/visitors/value'
407
+ }
408
+ }
409
+ },
410
+ XML: {
411
+ $visitor: XmlVisitor,
412
+ fixedFields: {
413
+ name: {
414
+ $ref: '#/visitors/value'
415
+ },
416
+ namespace: {
417
+ $ref: '#/visitors/value'
418
+ },
419
+ prefix: {
420
+ $ref: '#/visitors/value'
421
+ },
422
+ attribute: {
423
+ $ref: '#/visitors/value'
424
+ },
425
+ wrapped: {
426
+ $ref: '#/visitors/value'
427
+ }
428
+ }
429
+ },
430
+ Definitions: {
431
+ $visitor: DefinitionsVisitor
432
+ },
433
+ ParametersDefinitions: {
434
+ $visitor: ParametersDefinitionsVisitor
435
+ },
436
+ ResponsesDefinitions: {
437
+ $visitor: ResponsesDefinitionsVisitor
438
+ },
439
+ SecurityDefinitions: {
440
+ $visitor: SecurityDefinitionsVisitor
441
+ },
442
+ SecurityScheme: {
443
+ $visitor: SecuritySchemeVisitor,
444
+ fixedFields: {
445
+ type: {
446
+ $ref: '#/visitors/value'
447
+ },
448
+ description: {
449
+ $ref: '#/visitors/value'
450
+ },
451
+ name: {
452
+ $ref: '#/visitors/value'
453
+ },
454
+ in: {
455
+ $ref: '#/visitors/value'
456
+ },
457
+ flow: {
458
+ $ref: '#/visitors/value'
459
+ },
460
+ authorizationUrl: {
461
+ $ref: '#/visitors/value'
462
+ },
463
+ token: {
464
+ $ref: '#/visitors/value'
465
+ },
466
+ scopes: {
467
+ $ref: '#/visitors/document/objects/Scopes'
468
+ }
469
+ }
470
+ },
471
+ Scopes: {
472
+ $visitor: ScopesVisitor
473
+ },
474
+ SecurityRequirement: {
475
+ $visitor: SecurityRequirementVisitor
476
+ }
477
+ },
478
+ extension: {
479
+ $visitor: SpecificationExtensionVisitor
480
+ }
481
+ }
482
+ }
483
+ };
484
+ export default specification;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
+ var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard").default;
5
+ exports.__esModule = true;
6
+ exports.default = void 0;
7
+ var _apidomCore = require("@speclynx/apidom-core");
8
+ var openApi2Predicates = _interopRequireWildcard(require("../predicates.cjs"));
9
+ var refractorPredicates = _interopRequireWildcard(require("./predicates.cjs"));
10
+ var _namespace = _interopRequireDefault(require("../namespace.cjs"));
11
+ const createToolbox = () => {
12
+ const namespace = (0, _apidomCore.createNamespace)(_namespace.default);
13
+ const predicates = {
14
+ ...refractorPredicates,
15
+ ...openApi2Predicates,
16
+ isStringElement: _apidomCore.isStringElement
17
+ };
18
+ return {
19
+ predicates,
20
+ namespace
21
+ };
22
+ };
23
+ var _default = exports.default = createToolbox;
@@ -0,0 +1,17 @@
1
+ import { createNamespace, isStringElement } from '@speclynx/apidom-core';
2
+ import * as openApi2Predicates from "../predicates.mjs";
3
+ import * as refractorPredicates from "./predicates.mjs";
4
+ import openApi2Namespace from "../namespace.mjs";
5
+ const createToolbox = () => {
6
+ const namespace = createNamespace(openApi2Namespace);
7
+ const predicates = {
8
+ ...refractorPredicates,
9
+ ...openApi2Predicates,
10
+ isStringElement
11
+ };
12
+ return {
13
+ predicates,
14
+ namespace
15
+ };
16
+ };
17
+ export default createToolbox;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
+ exports.__esModule = true;
5
+ exports.default = void 0;
6
+ var _apidomCore = require("@speclynx/apidom-core");
7
+ var _Visitor = _interopRequireDefault(require("./Visitor.cjs"));
8
+ /**
9
+ * This visitor is responsible for falling back to current traversed element
10
+ * Given OpenApi3_0Visitor expects ObjectElement to be traversed. If
11
+ * different Element is provided FallBackVisitor is responsible to assigning
12
+ * this Element as current element.
13
+ */
14
+
15
+ /**
16
+ * @public
17
+ */
18
+ class FallbackVisitor extends _Visitor.default {
19
+ enter(element) {
20
+ this.element = (0, _apidomCore.cloneDeep)(element);
21
+ return _apidomCore.BREAK;
22
+ }
23
+ }
24
+ var _default = exports.default = FallbackVisitor;
@@ -0,0 +1,18 @@
1
+ import { BREAK, cloneDeep } from '@speclynx/apidom-core';
2
+ import Visitor from "./Visitor.mjs";
3
+ /**
4
+ * This visitor is responsible for falling back to current traversed element
5
+ * Given OpenApi3_0Visitor expects ObjectElement to be traversed. If
6
+ * different Element is provided FallBackVisitor is responsible to assigning
7
+ * this Element as current element.
8
+ */
9
+ /**
10
+ * @public
11
+ */
12
+ class FallbackVisitor extends Visitor {
13
+ enter(element) {
14
+ this.element = cloneDeep(element);
15
+ return BREAK;
16
+ }
17
+ }
18
+ export default FallbackVisitor;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
+ exports.__esModule = true;
5
+ exports.default = void 0;
6
+ var _apidomCore = require("@speclynx/apidom-core");
7
+ var _SpecificationVisitor = _interopRequireDefault(require("./SpecificationVisitor.cjs"));
8
+ /**
9
+ * @public
10
+ */
11
+ class SpecificationExtensionVisitor extends _SpecificationVisitor.default {
12
+ MemberElement(memberElement) {
13
+ this.element = (0, _apidomCore.cloneDeep)(memberElement);
14
+ this.element.classes.push('specification-extension');
15
+ return _apidomCore.BREAK;
16
+ }
17
+ }
18
+ var _default = exports.default = SpecificationExtensionVisitor;
@@ -0,0 +1,13 @@
1
+ import { BREAK, cloneDeep } from '@speclynx/apidom-core';
2
+ import SpecificationVisitor from "./SpecificationVisitor.mjs";
3
+ /**
4
+ * @public
5
+ */
6
+ class SpecificationExtensionVisitor extends SpecificationVisitor {
7
+ MemberElement(memberElement) {
8
+ this.element = cloneDeep(memberElement);
9
+ this.element.classes.push('specification-extension');
10
+ return BREAK;
11
+ }
12
+ }
13
+ export default SpecificationExtensionVisitor;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
+ exports.__esModule = true;
5
+ exports.default = void 0;
6
+ var _ramda = require("ramda");
7
+ var _ramdaAdjunct = require("ramda-adjunct");
8
+ var _apidomCore = require("@speclynx/apidom-core");
9
+ var _Visitor = _interopRequireDefault(require("./Visitor.cjs"));
10
+ var _FallbackVisitor = _interopRequireDefault(require("./FallbackVisitor.cjs"));
11
+ /**
12
+ * This is a base Type for every visitor that does
13
+ * internal look-ups to retrieve other child visitors.
14
+ * @public
15
+ */
16
+
17
+ /**
18
+ * @public
19
+ */
20
+ class SpecificationVisitor extends _Visitor.default {
21
+ specObj;
22
+ passingOptionsNames = ['specObj'];
23
+ constructor({
24
+ specObj,
25
+ ...rest
26
+ }) {
27
+ super({
28
+ ...rest
29
+ });
30
+ this.specObj = specObj;
31
+ }
32
+ retrievePassingOptions() {
33
+ return (0, _ramda.pick)(this.passingOptionsNames, this);
34
+ }
35
+ retrieveFixedFields(specPath) {
36
+ const fixedFields = (0, _ramda.path)(['visitors', ...specPath, 'fixedFields'], this.specObj);
37
+ if (typeof fixedFields === 'object' && fixedFields !== null) {
38
+ return Object.keys(fixedFields);
39
+ }
40
+ return [];
41
+ }
42
+ retrieveVisitor(specPath) {
43
+ if ((0, _ramda.pathSatisfies)(_ramdaAdjunct.isFunction, ['visitors', ...specPath], this.specObj)) {
44
+ return (0, _ramda.path)(['visitors', ...specPath], this.specObj);
45
+ }
46
+ return (0, _ramda.path)(['visitors', ...specPath, '$visitor'], this.specObj);
47
+ }
48
+ retrieveVisitorInstance(specPath, options = {}) {
49
+ const passingOpts = this.retrievePassingOptions();
50
+ const VisitorClz = this.retrieveVisitor(specPath);
51
+ const visitorOpts = {
52
+ ...passingOpts,
53
+ ...options
54
+ };
55
+ return new VisitorClz(visitorOpts);
56
+ }
57
+ toRefractedElement(specPath, element, options = {}) {
58
+ /**
59
+ * This is `Visitor shortcut`: mechanism for short circuiting the traversal and replacing
60
+ * it by basic node cloning.
61
+ *
62
+ * Visiting the element is equivalent to cloning it if the prototype of a visitor
63
+ * is the same as the prototype of FallbackVisitor. If that's the case, we can avoid
64
+ * bootstrapping the traversal cycle for fields that don't require any special visiting.
65
+ */
66
+ const visitor = this.retrieveVisitorInstance(specPath, options);
67
+ if (visitor instanceof _FallbackVisitor.default && visitor?.constructor === _FallbackVisitor.default) {
68
+ return (0, _apidomCore.cloneDeep)(element);
69
+ }
70
+ (0, _apidomCore.visit)(element, visitor, options);
71
+ return visitor.element;
72
+ }
73
+ }
74
+ var _default = exports.default = SpecificationVisitor;