@speclynx/apidom-ns-openapi-2 4.0.2 → 4.0.3

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 (326) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/package.json +8 -9
  3. package/src/elements/Contact.cjs +33 -0
  4. package/src/elements/Contact.mjs +30 -0
  5. package/src/elements/Contact.ts +42 -0
  6. package/src/elements/Definitions.cjs +15 -0
  7. package/src/elements/Definitions.mjs +12 -0
  8. package/src/elements/Definitions.ts +13 -0
  9. package/src/elements/Example.cjs +15 -0
  10. package/src/elements/Example.mjs +12 -0
  11. package/src/elements/Example.ts +13 -0
  12. package/src/elements/ExternalDocumentation.cjs +27 -0
  13. package/src/elements/ExternalDocumentation.mjs +24 -0
  14. package/src/elements/ExternalDocumentation.ts +34 -0
  15. package/src/elements/Header.cjs +185 -0
  16. package/src/elements/Header.mjs +182 -0
  17. package/src/elements/Header.ts +261 -0
  18. package/src/elements/Headers.cjs +15 -0
  19. package/src/elements/Headers.mjs +12 -0
  20. package/src/elements/Headers.ts +13 -0
  21. package/src/elements/Info.cjs +52 -0
  22. package/src/elements/Info.mjs +48 -0
  23. package/src/elements/Info.ts +70 -0
  24. package/src/elements/Items.cjs +190 -0
  25. package/src/elements/Items.mjs +187 -0
  26. package/src/elements/Items.ts +264 -0
  27. package/src/elements/License.cjs +27 -0
  28. package/src/elements/License.mjs +24 -0
  29. package/src/elements/License.ts +34 -0
  30. package/src/elements/Operation.cjs +78 -0
  31. package/src/elements/Operation.mjs +74 -0
  32. package/src/elements/Operation.ts +106 -0
  33. package/src/elements/Parameter.cjs +230 -0
  34. package/src/elements/Parameter.mjs +226 -0
  35. package/src/elements/Parameter.ts +326 -0
  36. package/src/elements/ParametersDefinitions.cjs +15 -0
  37. package/src/elements/ParametersDefinitions.mjs +12 -0
  38. package/src/elements/ParametersDefinitions.ts +13 -0
  39. package/src/elements/PathItem.cjs +69 -0
  40. package/src/elements/PathItem.mjs +65 -0
  41. package/src/elements/PathItem.ts +93 -0
  42. package/src/elements/Paths.cjs +15 -0
  43. package/src/elements/Paths.mjs +12 -0
  44. package/src/elements/Paths.ts +13 -0
  45. package/src/elements/Reference.cjs +22 -0
  46. package/src/elements/Reference.mjs +19 -0
  47. package/src/elements/Reference.ts +27 -0
  48. package/src/elements/Response.cjs +39 -0
  49. package/src/elements/Response.mjs +35 -0
  50. package/src/elements/Response.ts +54 -0
  51. package/src/elements/Responses.cjs +21 -0
  52. package/src/elements/Responses.mjs +17 -0
  53. package/src/elements/Responses.ts +24 -0
  54. package/src/elements/ResponsesDefinitions.cjs +15 -0
  55. package/src/elements/ResponsesDefinitions.mjs +12 -0
  56. package/src/elements/ResponsesDefinitions.ts +13 -0
  57. package/src/elements/Schema.cjs +151 -0
  58. package/src/elements/Schema.mjs +147 -0
  59. package/src/elements/Schema.ts +204 -0
  60. package/src/elements/Scopes.cjs +15 -0
  61. package/src/elements/Scopes.mjs +12 -0
  62. package/src/elements/Scopes.ts +13 -0
  63. package/src/elements/SecurityDefinitions.cjs +15 -0
  64. package/src/elements/SecurityDefinitions.mjs +12 -0
  65. package/src/elements/SecurityDefinitions.ts +13 -0
  66. package/src/elements/SecurityRequirement.cjs +15 -0
  67. package/src/elements/SecurityRequirement.mjs +12 -0
  68. package/src/elements/SecurityRequirement.ts +13 -0
  69. package/src/elements/SecurityScheme.cjs +63 -0
  70. package/src/elements/SecurityScheme.mjs +60 -0
  71. package/src/elements/SecurityScheme.ts +83 -0
  72. package/src/elements/Swagger.cjs +106 -0
  73. package/src/elements/Swagger.mjs +102 -0
  74. package/src/elements/Swagger.ts +149 -0
  75. package/src/elements/SwaggerVersion.cjs +17 -0
  76. package/src/elements/SwaggerVersion.mjs +14 -0
  77. package/src/elements/SwaggerVersion.ts +15 -0
  78. package/src/elements/Tag.cjs +33 -0
  79. package/src/elements/Tag.mjs +29 -0
  80. package/src/elements/Tag.ts +44 -0
  81. package/src/elements/Xml.cjs +45 -0
  82. package/src/elements/Xml.mjs +42 -0
  83. package/src/elements/Xml.ts +59 -0
  84. package/src/elements/nces/OperationConsumes.cjs +16 -0
  85. package/src/elements/nces/OperationConsumes.mjs +13 -0
  86. package/src/elements/nces/OperationConsumes.ts +15 -0
  87. package/src/elements/nces/OperationParameters.cjs +17 -0
  88. package/src/elements/nces/OperationParameters.mjs +14 -0
  89. package/src/elements/nces/OperationParameters.ts +16 -0
  90. package/src/elements/nces/OperationProduces.cjs +16 -0
  91. package/src/elements/nces/OperationProduces.mjs +13 -0
  92. package/src/elements/nces/OperationProduces.ts +15 -0
  93. package/src/elements/nces/OperationSchemes.cjs +16 -0
  94. package/src/elements/nces/OperationSchemes.mjs +13 -0
  95. package/src/elements/nces/OperationSchemes.ts +15 -0
  96. package/src/elements/nces/OperationSecurity.cjs +17 -0
  97. package/src/elements/nces/OperationSecurity.mjs +14 -0
  98. package/src/elements/nces/OperationSecurity.ts +16 -0
  99. package/src/elements/nces/OperationTags.cjs +17 -0
  100. package/src/elements/nces/OperationTags.mjs +14 -0
  101. package/src/elements/nces/OperationTags.ts +16 -0
  102. package/src/elements/nces/PathItemParameters.cjs +17 -0
  103. package/src/elements/nces/PathItemParameters.mjs +14 -0
  104. package/src/elements/nces/PathItemParameters.ts +16 -0
  105. package/src/elements/nces/SwaggerConsumes.cjs +16 -0
  106. package/src/elements/nces/SwaggerConsumes.mjs +13 -0
  107. package/src/elements/nces/SwaggerConsumes.ts +15 -0
  108. package/src/elements/nces/SwaggerProduces.cjs +16 -0
  109. package/src/elements/nces/SwaggerProduces.mjs +13 -0
  110. package/src/elements/nces/SwaggerProduces.ts +15 -0
  111. package/src/elements/nces/SwaggerSchemes.cjs +16 -0
  112. package/src/elements/nces/SwaggerSchemes.mjs +13 -0
  113. package/src/elements/nces/SwaggerSchemes.ts +15 -0
  114. package/src/elements/nces/SwaggerSecurity.cjs +17 -0
  115. package/src/elements/nces/SwaggerSecurity.mjs +14 -0
  116. package/src/elements/nces/SwaggerSecurity.ts +16 -0
  117. package/src/elements/nces/SwaggerTags.cjs +16 -0
  118. package/src/elements/nces/SwaggerTags.mjs +13 -0
  119. package/src/elements/nces/SwaggerTags.ts +15 -0
  120. package/src/index.cjs +156 -0
  121. package/src/index.mjs +32 -0
  122. package/src/index.ts +368 -0
  123. package/src/media-types.cjs +34 -0
  124. package/src/media-types.mjs +30 -0
  125. package/src/media-types.ts +42 -0
  126. package/src/namespace.cjs +71 -0
  127. package/src/namespace.mjs +66 -0
  128. package/src/namespace.ts +70 -0
  129. package/src/predicates.cjs +193 -0
  130. package/src/predicates.mjs +161 -0
  131. package/src/predicates.ts +194 -0
  132. package/src/refractor/index.cjs +316 -0
  133. package/src/refractor/index.mjs +283 -0
  134. package/src/refractor/index.ts +330 -0
  135. package/src/refractor/inspect.cjs +157 -0
  136. package/src/refractor/inspect.mjs +126 -0
  137. package/src/refractor/inspect.ts +181 -0
  138. package/src/refractor/plugins/replace-empty-element.cjs +366 -0
  139. package/src/refractor/plugins/replace-empty-element.mjs +358 -0
  140. package/src/refractor/plugins/replace-empty-element.ts +389 -0
  141. package/src/refractor/predicates.cjs +26 -0
  142. package/src/refractor/predicates.mjs +21 -0
  143. package/src/refractor/predicates.ts +29 -0
  144. package/src/refractor/specification.cjs +519 -0
  145. package/src/refractor/specification.mjs +513 -0
  146. package/src/refractor/specification.ts +444 -0
  147. package/src/refractor/toolbox.cjs +28 -0
  148. package/src/refractor/toolbox.mjs +21 -0
  149. package/src/refractor/toolbox.ts +24 -0
  150. package/src/refractor/visitors/FallbackVisitor.cjs +24 -0
  151. package/src/refractor/visitors/FallbackVisitor.mjs +18 -0
  152. package/src/refractor/visitors/FallbackVisitor.ts +25 -0
  153. package/src/refractor/visitors/SpecificationExtensionVisitor.cjs +18 -0
  154. package/src/refractor/visitors/SpecificationExtensionVisitor.mjs +13 -0
  155. package/src/refractor/visitors/SpecificationExtensionVisitor.ts +22 -0
  156. package/src/refractor/visitors/SpecificationVisitor.cjs +75 -0
  157. package/src/refractor/visitors/SpecificationVisitor.mjs +69 -0
  158. package/src/refractor/visitors/SpecificationVisitor.ts +83 -0
  159. package/src/refractor/visitors/Visitor.cjs +36 -0
  160. package/src/refractor/visitors/Visitor.mjs +33 -0
  161. package/src/refractor/visitors/Visitor.ts +47 -0
  162. package/src/refractor/visitors/generics/AlternatingVisitor.cjs +42 -0
  163. package/src/refractor/visitors/generics/AlternatingVisitor.mjs +35 -0
  164. package/src/refractor/visitors/generics/AlternatingVisitor.ts +45 -0
  165. package/src/refractor/visitors/generics/FixedFieldsVisitor.cjs +73 -0
  166. package/src/refractor/visitors/generics/FixedFieldsVisitor.mjs +66 -0
  167. package/src/refractor/visitors/generics/FixedFieldsVisitor.ts +109 -0
  168. package/src/refractor/visitors/generics/MapVisitor.cjs +21 -0
  169. package/src/refractor/visitors/generics/MapVisitor.mjs +15 -0
  170. package/src/refractor/visitors/generics/MapVisitor.ts +25 -0
  171. package/src/refractor/visitors/generics/MixedFieldsVisitor.cjs +67 -0
  172. package/src/refractor/visitors/generics/MixedFieldsVisitor.mjs +61 -0
  173. package/src/refractor/visitors/generics/MixedFieldsVisitor.ts +77 -0
  174. package/src/refractor/visitors/generics/PatternedFieldsVisitor.cjs +72 -0
  175. package/src/refractor/visitors/generics/PatternedFieldsVisitor.mjs +66 -0
  176. package/src/refractor/visitors/generics/PatternedFieldsVisitor.ts +99 -0
  177. package/src/refractor/visitors/open-api-2/BasePathVisitor.cjs +16 -0
  178. package/src/refractor/visitors/open-api-2/BasePathVisitor.mjs +11 -0
  179. package/src/refractor/visitors/open-api-2/BasePathVisitor.ts +20 -0
  180. package/src/refractor/visitors/open-api-2/ConsumesVisitor.cjs +23 -0
  181. package/src/refractor/visitors/open-api-2/ConsumesVisitor.mjs +18 -0
  182. package/src/refractor/visitors/open-api-2/ConsumesVisitor.ts +29 -0
  183. package/src/refractor/visitors/open-api-2/HostVisitor.cjs +16 -0
  184. package/src/refractor/visitors/open-api-2/HostVisitor.mjs +11 -0
  185. package/src/refractor/visitors/open-api-2/HostVisitor.ts +20 -0
  186. package/src/refractor/visitors/open-api-2/ProducesVisitor.cjs +23 -0
  187. package/src/refractor/visitors/open-api-2/ProducesVisitor.mjs +18 -0
  188. package/src/refractor/visitors/open-api-2/ProducesVisitor.ts +29 -0
  189. package/src/refractor/visitors/open-api-2/SchemesVisitor.cjs +23 -0
  190. package/src/refractor/visitors/open-api-2/SchemesVisitor.mjs +18 -0
  191. package/src/refractor/visitors/open-api-2/SchemesVisitor.ts +29 -0
  192. package/src/refractor/visitors/open-api-2/SecurityVisitor.cjs +27 -0
  193. package/src/refractor/visitors/open-api-2/SecurityVisitor.mjs +22 -0
  194. package/src/refractor/visitors/open-api-2/SecurityVisitor.ts +34 -0
  195. package/src/refractor/visitors/open-api-2/SwaggerVisitor.cjs +21 -0
  196. package/src/refractor/visitors/open-api-2/SwaggerVisitor.mjs +16 -0
  197. package/src/refractor/visitors/open-api-2/SwaggerVisitor.ts +29 -0
  198. package/src/refractor/visitors/open-api-2/TagsVisitor.cjs +27 -0
  199. package/src/refractor/visitors/open-api-2/TagsVisitor.mjs +22 -0
  200. package/src/refractor/visitors/open-api-2/TagsVisitor.ts +34 -0
  201. package/src/refractor/visitors/open-api-2/bases.cjs +72 -0
  202. package/src/refractor/visitors/open-api-2/bases.mjs +67 -0
  203. package/src/refractor/visitors/open-api-2/bases.ts +82 -0
  204. package/src/refractor/visitors/open-api-2/contact/index.cjs +20 -0
  205. package/src/refractor/visitors/open-api-2/contact/index.mjs +15 -0
  206. package/src/refractor/visitors/open-api-2/contact/index.ts +27 -0
  207. package/src/refractor/visitors/open-api-2/definitions/index.cjs +31 -0
  208. package/src/refractor/visitors/open-api-2/definitions/index.mjs +26 -0
  209. package/src/refractor/visitors/open-api-2/definitions/index.ts +48 -0
  210. package/src/refractor/visitors/open-api-2/example/index.cjs +20 -0
  211. package/src/refractor/visitors/open-api-2/example/index.mjs +15 -0
  212. package/src/refractor/visitors/open-api-2/example/index.ts +27 -0
  213. package/src/refractor/visitors/open-api-2/external-documentation/index.cjs +20 -0
  214. package/src/refractor/visitors/open-api-2/external-documentation/index.mjs +15 -0
  215. package/src/refractor/visitors/open-api-2/external-documentation/index.ts +27 -0
  216. package/src/refractor/visitors/open-api-2/header/index.cjs +20 -0
  217. package/src/refractor/visitors/open-api-2/header/index.mjs +15 -0
  218. package/src/refractor/visitors/open-api-2/header/index.ts +27 -0
  219. package/src/refractor/visitors/open-api-2/headers/index.cjs +20 -0
  220. package/src/refractor/visitors/open-api-2/headers/index.mjs +15 -0
  221. package/src/refractor/visitors/open-api-2/headers/index.ts +27 -0
  222. package/src/refractor/visitors/open-api-2/index.cjs +21 -0
  223. package/src/refractor/visitors/open-api-2/index.mjs +16 -0
  224. package/src/refractor/visitors/open-api-2/index.ts +28 -0
  225. package/src/refractor/visitors/open-api-2/info/VersionVisitor.cjs +17 -0
  226. package/src/refractor/visitors/open-api-2/info/VersionVisitor.mjs +12 -0
  227. package/src/refractor/visitors/open-api-2/info/VersionVisitor.ts +21 -0
  228. package/src/refractor/visitors/open-api-2/info/index.cjs +20 -0
  229. package/src/refractor/visitors/open-api-2/info/index.mjs +15 -0
  230. package/src/refractor/visitors/open-api-2/info/index.ts +27 -0
  231. package/src/refractor/visitors/open-api-2/items/index.cjs +22 -0
  232. package/src/refractor/visitors/open-api-2/items/index.mjs +17 -0
  233. package/src/refractor/visitors/open-api-2/items/index.ts +27 -0
  234. package/src/refractor/visitors/open-api-2/license/index.cjs +20 -0
  235. package/src/refractor/visitors/open-api-2/license/index.mjs +15 -0
  236. package/src/refractor/visitors/open-api-2/license/index.ts +27 -0
  237. package/src/refractor/visitors/open-api-2/operation/ConsumesVisitor.cjs +23 -0
  238. package/src/refractor/visitors/open-api-2/operation/ConsumesVisitor.mjs +18 -0
  239. package/src/refractor/visitors/open-api-2/operation/ConsumesVisitor.ts +29 -0
  240. package/src/refractor/visitors/open-api-2/operation/ParametersVisitor.cjs +32 -0
  241. package/src/refractor/visitors/open-api-2/operation/ParametersVisitor.mjs +27 -0
  242. package/src/refractor/visitors/open-api-2/operation/ParametersVisitor.ts +44 -0
  243. package/src/refractor/visitors/open-api-2/operation/ProducesVisitor.cjs +23 -0
  244. package/src/refractor/visitors/open-api-2/operation/ProducesVisitor.mjs +18 -0
  245. package/src/refractor/visitors/open-api-2/operation/ProducesVisitor.ts +29 -0
  246. package/src/refractor/visitors/open-api-2/operation/SchemesVisitor.cjs +23 -0
  247. package/src/refractor/visitors/open-api-2/operation/SchemesVisitor.mjs +18 -0
  248. package/src/refractor/visitors/open-api-2/operation/SchemesVisitor.ts +29 -0
  249. package/src/refractor/visitors/open-api-2/operation/SecurityVisitor.cjs +27 -0
  250. package/src/refractor/visitors/open-api-2/operation/SecurityVisitor.mjs +22 -0
  251. package/src/refractor/visitors/open-api-2/operation/SecurityVisitor.ts +34 -0
  252. package/src/refractor/visitors/open-api-2/operation/TagsVisitor.cjs +23 -0
  253. package/src/refractor/visitors/open-api-2/operation/TagsVisitor.mjs +18 -0
  254. package/src/refractor/visitors/open-api-2/operation/TagsVisitor.ts +29 -0
  255. package/src/refractor/visitors/open-api-2/operation/index.cjs +19 -0
  256. package/src/refractor/visitors/open-api-2/operation/index.mjs +14 -0
  257. package/src/refractor/visitors/open-api-2/operation/index.ts +24 -0
  258. package/src/refractor/visitors/open-api-2/parameter/index.cjs +20 -0
  259. package/src/refractor/visitors/open-api-2/parameter/index.mjs +15 -0
  260. package/src/refractor/visitors/open-api-2/parameter/index.ts +27 -0
  261. package/src/refractor/visitors/open-api-2/parameters-definitions/index.cjs +19 -0
  262. package/src/refractor/visitors/open-api-2/parameters-definitions/index.mjs +14 -0
  263. package/src/refractor/visitors/open-api-2/parameters-definitions/index.ts +24 -0
  264. package/src/refractor/visitors/open-api-2/path-item/$RefVisitor.cjs +16 -0
  265. package/src/refractor/visitors/open-api-2/path-item/$RefVisitor.mjs +11 -0
  266. package/src/refractor/visitors/open-api-2/path-item/$RefVisitor.ts +20 -0
  267. package/src/refractor/visitors/open-api-2/path-item/ParametersVisitor.cjs +32 -0
  268. package/src/refractor/visitors/open-api-2/path-item/ParametersVisitor.mjs +27 -0
  269. package/src/refractor/visitors/open-api-2/path-item/ParametersVisitor.ts +44 -0
  270. package/src/refractor/visitors/open-api-2/path-item/index.cjs +39 -0
  271. package/src/refractor/visitors/open-api-2/path-item/index.mjs +34 -0
  272. package/src/refractor/visitors/open-api-2/path-item/index.ts +48 -0
  273. package/src/refractor/visitors/open-api-2/paths/index.cjs +37 -0
  274. package/src/refractor/visitors/open-api-2/paths/index.mjs +32 -0
  275. package/src/refractor/visitors/open-api-2/paths/index.ts +48 -0
  276. package/src/refractor/visitors/open-api-2/reference/$RefVisitor.cjs +16 -0
  277. package/src/refractor/visitors/open-api-2/reference/$RefVisitor.mjs +11 -0
  278. package/src/refractor/visitors/open-api-2/reference/$RefVisitor.ts +20 -0
  279. package/src/refractor/visitors/open-api-2/reference/index.cjs +29 -0
  280. package/src/refractor/visitors/open-api-2/reference/index.mjs +24 -0
  281. package/src/refractor/visitors/open-api-2/reference/index.ts +38 -0
  282. package/src/refractor/visitors/open-api-2/response/index.cjs +20 -0
  283. package/src/refractor/visitors/open-api-2/response/index.mjs +15 -0
  284. package/src/refractor/visitors/open-api-2/response/index.ts +27 -0
  285. package/src/refractor/visitors/open-api-2/responses/DefaultVisitor.cjs +36 -0
  286. package/src/refractor/visitors/open-api-2/responses/DefaultVisitor.mjs +31 -0
  287. package/src/refractor/visitors/open-api-2/responses/DefaultVisitor.ts +36 -0
  288. package/src/refractor/visitors/open-api-2/responses/index.cjs +45 -0
  289. package/src/refractor/visitors/open-api-2/responses/index.mjs +40 -0
  290. package/src/refractor/visitors/open-api-2/responses/index.ts +64 -0
  291. package/src/refractor/visitors/open-api-2/responses-definitions/index.cjs +19 -0
  292. package/src/refractor/visitors/open-api-2/responses-definitions/index.mjs +14 -0
  293. package/src/refractor/visitors/open-api-2/responses-definitions/index.ts +24 -0
  294. package/src/refractor/visitors/open-api-2/schema/AllOfVisitor.cjs +24 -0
  295. package/src/refractor/visitors/open-api-2/schema/AllOfVisitor.mjs +20 -0
  296. package/src/refractor/visitors/open-api-2/schema/AllOfVisitor.ts +35 -0
  297. package/src/refractor/visitors/open-api-2/schema/ItemsVisitor.cjs +26 -0
  298. package/src/refractor/visitors/open-api-2/schema/ItemsVisitor.mjs +23 -0
  299. package/src/refractor/visitors/open-api-2/schema/ItemsVisitor.ts +38 -0
  300. package/src/refractor/visitors/open-api-2/schema/PropertiesVisitor.cjs +24 -0
  301. package/src/refractor/visitors/open-api-2/schema/PropertiesVisitor.mjs +20 -0
  302. package/src/refractor/visitors/open-api-2/schema/PropertiesVisitor.ts +35 -0
  303. package/src/refractor/visitors/open-api-2/schema/SchemaOrJSONReferenceVisitor.cjs +23 -0
  304. package/src/refractor/visitors/open-api-2/schema/SchemaOrJSONReferenceVisitor.mjs +19 -0
  305. package/src/refractor/visitors/open-api-2/schema/SchemaOrJSONReferenceVisitor.ts +37 -0
  306. package/src/refractor/visitors/open-api-2/schema/index.cjs +20 -0
  307. package/src/refractor/visitors/open-api-2/schema/index.mjs +15 -0
  308. package/src/refractor/visitors/open-api-2/schema/index.ts +27 -0
  309. package/src/refractor/visitors/open-api-2/scopes/index.cjs +20 -0
  310. package/src/refractor/visitors/open-api-2/scopes/index.mjs +15 -0
  311. package/src/refractor/visitors/open-api-2/scopes/index.ts +27 -0
  312. package/src/refractor/visitors/open-api-2/security-definitions/index.cjs +20 -0
  313. package/src/refractor/visitors/open-api-2/security-definitions/index.mjs +15 -0
  314. package/src/refractor/visitors/open-api-2/security-definitions/index.ts +24 -0
  315. package/src/refractor/visitors/open-api-2/security-requirement/index.cjs +19 -0
  316. package/src/refractor/visitors/open-api-2/security-requirement/index.mjs +14 -0
  317. package/src/refractor/visitors/open-api-2/security-requirement/index.ts +24 -0
  318. package/src/refractor/visitors/open-api-2/security-scheme/index.cjs +20 -0
  319. package/src/refractor/visitors/open-api-2/security-scheme/index.mjs +15 -0
  320. package/src/refractor/visitors/open-api-2/security-scheme/index.ts +27 -0
  321. package/src/refractor/visitors/open-api-2/tag/index.cjs +20 -0
  322. package/src/refractor/visitors/open-api-2/tag/index.mjs +15 -0
  323. package/src/refractor/visitors/open-api-2/tag/index.ts +27 -0
  324. package/src/refractor/visitors/open-api-2/xml/index.cjs +20 -0
  325. package/src/refractor/visitors/open-api-2/xml/index.mjs +15 -0
  326. package/src/refractor/visitors/open-api-2/xml/index.ts +27 -0
@@ -0,0 +1,283 @@
1
+ import { resolveSpecification, dispatchRefractorPlugins } from '@speclynx/apidom-core';
2
+ import { refract as baseRefract } from '@speclynx/apidom-datamodel';
3
+ import { traverse } from '@speclynx/apidom-traverse';
4
+ import { path } from 'ramda';
5
+ import specification from "./specification.mjs";
6
+ import createToolbox from "./toolbox.mjs";
7
+ /**
8
+ * @public
9
+ */
10
+ /**
11
+ * @public
12
+ */
13
+ /**
14
+ * @public
15
+ */
16
+ const refract = (value, {
17
+ element = 'swagger',
18
+ plugins = [],
19
+ specificationObj = specification,
20
+ consume = false
21
+ } = {}) => {
22
+ const genericElement = baseRefract(value);
23
+ const resolvedSpec = resolveSpecification(specificationObj);
24
+ const elementMap = resolvedSpec.elementMap;
25
+ const specPath = elementMap[element];
26
+ if (!specPath) {
27
+ throw new Error(`Unknown element type: "${element}"`);
28
+ }
29
+
30
+ /**
31
+ * This is where generic ApiDOM becomes semantic (namespace applied).
32
+ * We don't allow consumers to hook into this translation.
33
+ * Though we allow consumers to define their own plugins on already transformed ApiDOM.
34
+ */
35
+ const RootVisitorClass = path(specPath, resolvedSpec);
36
+ const rootVisitor = new RootVisitorClass({
37
+ specObj: resolvedSpec,
38
+ consume
39
+ });
40
+ traverse(genericElement, rootVisitor);
41
+
42
+ /**
43
+ * Running plugins visitors means extra single traversal === performance hit.
44
+ */
45
+ return dispatchRefractorPlugins(rootVisitor.element, plugins, {
46
+ toolboxCreator: createToolbox
47
+ });
48
+ };
49
+
50
+ /**
51
+ * Refracts a value into a SwaggerElement.
52
+ * @public
53
+ */
54
+ export const refractSwagger = (value, options = {}) => refract(value, {
55
+ ...options,
56
+ element: 'swagger'
57
+ });
58
+
59
+ /**
60
+ * Refracts a value into an InfoElement.
61
+ * @public
62
+ */
63
+ export const refractInfo = (value, options = {}) => refract(value, {
64
+ ...options,
65
+ element: 'info'
66
+ });
67
+
68
+ /**
69
+ * Refracts a value into a ContactElement.
70
+ * @public
71
+ */
72
+ export const refractContact = (value, options = {}) => refract(value, {
73
+ ...options,
74
+ element: 'contact'
75
+ });
76
+
77
+ /**
78
+ * Refracts a value into a LicenseElement.
79
+ * @public
80
+ */
81
+ export const refractLicense = (value, options = {}) => refract(value, {
82
+ ...options,
83
+ element: 'license'
84
+ });
85
+
86
+ /**
87
+ * Refracts a value into a PathsElement.
88
+ * @public
89
+ */
90
+ export const refractPaths = (value, options = {}) => refract(value, {
91
+ ...options,
92
+ element: 'paths'
93
+ });
94
+
95
+ /**
96
+ * Refracts a value into a PathItemElement.
97
+ * @public
98
+ */
99
+ export const refractPathItem = (value, options = {}) => refract(value, {
100
+ ...options,
101
+ element: 'pathItem'
102
+ });
103
+
104
+ /**
105
+ * Refracts a value into an OperationElement.
106
+ * @public
107
+ */
108
+ export const refractOperation = (value, options = {}) => refract(value, {
109
+ ...options,
110
+ element: 'operation'
111
+ });
112
+
113
+ /**
114
+ * Refracts a value into an ExternalDocumentationElement.
115
+ * @public
116
+ */
117
+ export const refractExternalDocumentation = (value, options = {}) => refract(value, {
118
+ ...options,
119
+ element: 'externalDocumentation'
120
+ });
121
+
122
+ /**
123
+ * Refracts a value into a ParameterElement.
124
+ * @public
125
+ */
126
+ export const refractParameter = (value, options = {}) => refract(value, {
127
+ ...options,
128
+ element: 'parameter'
129
+ });
130
+
131
+ /**
132
+ * Refracts a value into an ItemsElement.
133
+ * @public
134
+ */
135
+ export const refractItems = (value, options = {}) => refract(value, {
136
+ ...options,
137
+ element: 'items'
138
+ });
139
+
140
+ /**
141
+ * Refracts a value into a ResponsesElement.
142
+ * @public
143
+ */
144
+ export const refractResponses = (value, options = {}) => refract(value, {
145
+ ...options,
146
+ element: 'responses'
147
+ });
148
+
149
+ /**
150
+ * Refracts a value into a ResponseElement.
151
+ * @public
152
+ */
153
+ export const refractResponse = (value, options = {}) => refract(value, {
154
+ ...options,
155
+ element: 'response'
156
+ });
157
+
158
+ /**
159
+ * Refracts a value into a HeadersElement.
160
+ * @public
161
+ */
162
+ export const refractHeaders = (value, options = {}) => refract(value, {
163
+ ...options,
164
+ element: 'headers'
165
+ });
166
+
167
+ /**
168
+ * Refracts a value into an ExampleElement.
169
+ * @public
170
+ */
171
+ export const refractExample = (value, options = {}) => refract(value, {
172
+ ...options,
173
+ element: 'example'
174
+ });
175
+
176
+ /**
177
+ * Refracts a value into a HeaderElement.
178
+ * @public
179
+ */
180
+ export const refractHeader = (value, options = {}) => refract(value, {
181
+ ...options,
182
+ element: 'header'
183
+ });
184
+
185
+ /**
186
+ * Refracts a value into a TagElement.
187
+ * @public
188
+ */
189
+ export const refractTag = (value, options = {}) => refract(value, {
190
+ ...options,
191
+ element: 'tag'
192
+ });
193
+
194
+ /**
195
+ * Refracts a value into a ReferenceElement.
196
+ * @public
197
+ */
198
+ export const refractReference = (value, options = {}) => refract(value, {
199
+ ...options,
200
+ element: 'reference'
201
+ });
202
+
203
+ /**
204
+ * Refracts a value into a SchemaElement.
205
+ * @public
206
+ */
207
+ export const refractSchema = (value, options = {}) => refract(value, {
208
+ ...options,
209
+ element: 'schema'
210
+ });
211
+
212
+ /**
213
+ * Refracts a value into an XmlElement.
214
+ * @public
215
+ */
216
+ export const refractXml = (value, options = {}) => refract(value, {
217
+ ...options,
218
+ element: 'xml'
219
+ });
220
+
221
+ /**
222
+ * Refracts a value into a DefinitionsElement.
223
+ * @public
224
+ */
225
+ export const refractDefinitions = (value, options = {}) => refract(value, {
226
+ ...options,
227
+ element: 'definitions'
228
+ });
229
+
230
+ /**
231
+ * Refracts a value into a ParametersDefinitionsElement.
232
+ * @public
233
+ */
234
+ export const refractParametersDefinitions = (value, options = {}) => refract(value, {
235
+ ...options,
236
+ element: 'parametersDefinitions'
237
+ });
238
+
239
+ /**
240
+ * Refracts a value into a ResponsesDefinitionsElement.
241
+ * @public
242
+ */
243
+ export const refractResponsesDefinitions = (value, options = {}) => refract(value, {
244
+ ...options,
245
+ element: 'responsesDefinitions'
246
+ });
247
+
248
+ /**
249
+ * Refracts a value into a SecurityDefinitionsElement.
250
+ * @public
251
+ */
252
+ export const refractSecurityDefinitions = (value, options = {}) => refract(value, {
253
+ ...options,
254
+ element: 'securityDefinitions'
255
+ });
256
+
257
+ /**
258
+ * Refracts a value into a SecuritySchemeElement.
259
+ * @public
260
+ */
261
+ export const refractSecurityScheme = (value, options = {}) => refract(value, {
262
+ ...options,
263
+ element: 'securityScheme'
264
+ });
265
+
266
+ /**
267
+ * Refracts a value into a ScopesElement.
268
+ * @public
269
+ */
270
+ export const refractScopes = (value, options = {}) => refract(value, {
271
+ ...options,
272
+ element: 'scopes'
273
+ });
274
+
275
+ /**
276
+ * Refracts a value into a SecurityRequirementElement.
277
+ * @public
278
+ */
279
+ export const refractSecurityRequirement = (value, options = {}) => refract(value, {
280
+ ...options,
281
+ element: 'securityRequirement'
282
+ });
283
+ export default refract;
@@ -0,0 +1,330 @@
1
+ import { resolveSpecification, dispatchRefractorPlugins } from '@speclynx/apidom-core';
2
+ import { Element, refract as baseRefract } from '@speclynx/apidom-datamodel';
3
+ import { traverse } from '@speclynx/apidom-traverse';
4
+ import { path } from 'ramda';
5
+
6
+ import type VisitorClass from './visitors/Visitor.ts';
7
+ import specification from './specification.ts';
8
+ import createToolbox, { type Toolbox } from './toolbox.ts';
9
+ import type SwaggerElement from '../elements/Swagger.ts';
10
+ import type InfoElement from '../elements/Info.ts';
11
+ import type ContactElement from '../elements/Contact.ts';
12
+ import type LicenseElement from '../elements/License.ts';
13
+ import type PathsElement from '../elements/Paths.ts';
14
+ import type PathItemElement from '../elements/PathItem.ts';
15
+ import type OperationElement from '../elements/Operation.ts';
16
+ import type ExternalDocumentationElement from '../elements/ExternalDocumentation.ts';
17
+ import type ParameterElement from '../elements/Parameter.ts';
18
+ import type ItemsElement from '../elements/Items.ts';
19
+ import type ResponsesElement from '../elements/Responses.ts';
20
+ import type ResponseElement from '../elements/Response.ts';
21
+ import type HeadersElement from '../elements/Headers.ts';
22
+ import type ExampleElement from '../elements/Example.ts';
23
+ import type HeaderElement from '../elements/Header.ts';
24
+ import type TagElement from '../elements/Tag.ts';
25
+ import type ReferenceElement from '../elements/Reference.ts';
26
+ import type SchemaElement from '../elements/Schema.ts';
27
+ import type XmlElement from '../elements/Xml.ts';
28
+ import type DefinitionsElement from '../elements/Definitions.ts';
29
+ import type ParametersDefinitionsElement from '../elements/ParametersDefinitions.ts';
30
+ import type ResponsesDefinitionsElement from '../elements/ResponsesDefinitions.ts';
31
+ import type SecurityDefinitionsElement from '../elements/SecurityDefinitions.ts';
32
+ import type SecuritySchemeElement from '../elements/SecurityScheme.ts';
33
+ import type ScopesElement from '../elements/Scopes.ts';
34
+ import type SecurityRequirementElement from '../elements/SecurityRequirement.ts';
35
+
36
+ /**
37
+ * @public
38
+ */
39
+ export type RefractorPlugin = (toolbox: Toolbox) => {
40
+ visitor?: object;
41
+ pre?: () => void;
42
+ post?: () => void;
43
+ };
44
+
45
+ /**
46
+ * @public
47
+ */
48
+ export interface RefractorOptions {
49
+ readonly element?: string;
50
+ readonly plugins?: RefractorPlugin[];
51
+ readonly specificationObj?: typeof specification;
52
+ readonly consume?: boolean;
53
+ }
54
+
55
+ /**
56
+ * @public
57
+ */
58
+ const refract = <T extends Element>(
59
+ value: unknown,
60
+ {
61
+ element = 'swagger',
62
+ plugins = [],
63
+ specificationObj = specification,
64
+ consume = false,
65
+ }: RefractorOptions = {},
66
+ ): T => {
67
+ const genericElement = baseRefract(value);
68
+ const resolvedSpec = resolveSpecification(specificationObj);
69
+ const elementMap = resolvedSpec.elementMap as Record<string, string[]>;
70
+ const specPath = elementMap[element];
71
+
72
+ if (!specPath) {
73
+ throw new Error(`Unknown element type: "${element}"`);
74
+ }
75
+
76
+ /**
77
+ * This is where generic ApiDOM becomes semantic (namespace applied).
78
+ * We don't allow consumers to hook into this translation.
79
+ * Though we allow consumers to define their own plugins on already transformed ApiDOM.
80
+ */
81
+ const RootVisitorClass = path(specPath, resolvedSpec) as new (
82
+ options: Record<string, unknown>,
83
+ ) => InstanceType<typeof VisitorClass>;
84
+ const rootVisitor = new RootVisitorClass({ specObj: resolvedSpec, consume });
85
+
86
+ traverse(genericElement, rootVisitor);
87
+
88
+ /**
89
+ * Running plugins visitors means extra single traversal === performance hit.
90
+ */
91
+ return dispatchRefractorPlugins(rootVisitor.element, plugins, {
92
+ toolboxCreator: createToolbox,
93
+ }) as T;
94
+ };
95
+
96
+ /**
97
+ * Refracts a value into a SwaggerElement.
98
+ * @public
99
+ */
100
+ export const refractSwagger = <T extends Element = SwaggerElement>(
101
+ value: unknown,
102
+ options: Omit<RefractorOptions, 'element'> = {},
103
+ ): T => refract(value, { ...options, element: 'swagger' });
104
+
105
+ /**
106
+ * Refracts a value into an InfoElement.
107
+ * @public
108
+ */
109
+ export const refractInfo = <T extends Element = InfoElement>(
110
+ value: unknown,
111
+ options: Omit<RefractorOptions, 'element'> = {},
112
+ ): T => refract(value, { ...options, element: 'info' });
113
+
114
+ /**
115
+ * Refracts a value into a ContactElement.
116
+ * @public
117
+ */
118
+ export const refractContact = <T extends Element = ContactElement>(
119
+ value: unknown,
120
+ options: Omit<RefractorOptions, 'element'> = {},
121
+ ): T => refract(value, { ...options, element: 'contact' });
122
+
123
+ /**
124
+ * Refracts a value into a LicenseElement.
125
+ * @public
126
+ */
127
+ export const refractLicense = <T extends Element = LicenseElement>(
128
+ value: unknown,
129
+ options: Omit<RefractorOptions, 'element'> = {},
130
+ ): T => refract(value, { ...options, element: 'license' });
131
+
132
+ /**
133
+ * Refracts a value into a PathsElement.
134
+ * @public
135
+ */
136
+ export const refractPaths = <T extends Element = PathsElement>(
137
+ value: unknown,
138
+ options: Omit<RefractorOptions, 'element'> = {},
139
+ ): T => refract(value, { ...options, element: 'paths' });
140
+
141
+ /**
142
+ * Refracts a value into a PathItemElement.
143
+ * @public
144
+ */
145
+ export const refractPathItem = <T extends Element = PathItemElement>(
146
+ value: unknown,
147
+ options: Omit<RefractorOptions, 'element'> = {},
148
+ ): T => refract(value, { ...options, element: 'pathItem' });
149
+
150
+ /**
151
+ * Refracts a value into an OperationElement.
152
+ * @public
153
+ */
154
+ export const refractOperation = <T extends Element = OperationElement>(
155
+ value: unknown,
156
+ options: Omit<RefractorOptions, 'element'> = {},
157
+ ): T => refract(value, { ...options, element: 'operation' });
158
+
159
+ /**
160
+ * Refracts a value into an ExternalDocumentationElement.
161
+ * @public
162
+ */
163
+ export const refractExternalDocumentation = <T extends Element = ExternalDocumentationElement>(
164
+ value: unknown,
165
+ options: Omit<RefractorOptions, 'element'> = {},
166
+ ): T => refract(value, { ...options, element: 'externalDocumentation' });
167
+
168
+ /**
169
+ * Refracts a value into a ParameterElement.
170
+ * @public
171
+ */
172
+ export const refractParameter = <T extends Element = ParameterElement>(
173
+ value: unknown,
174
+ options: Omit<RefractorOptions, 'element'> = {},
175
+ ): T => refract(value, { ...options, element: 'parameter' });
176
+
177
+ /**
178
+ * Refracts a value into an ItemsElement.
179
+ * @public
180
+ */
181
+ export const refractItems = <T extends Element = ItemsElement>(
182
+ value: unknown,
183
+ options: Omit<RefractorOptions, 'element'> = {},
184
+ ): T => refract(value, { ...options, element: 'items' });
185
+
186
+ /**
187
+ * Refracts a value into a ResponsesElement.
188
+ * @public
189
+ */
190
+ export const refractResponses = <T extends Element = ResponsesElement>(
191
+ value: unknown,
192
+ options: Omit<RefractorOptions, 'element'> = {},
193
+ ): T => refract(value, { ...options, element: 'responses' });
194
+
195
+ /**
196
+ * Refracts a value into a ResponseElement.
197
+ * @public
198
+ */
199
+ export const refractResponse = <T extends Element = ResponseElement>(
200
+ value: unknown,
201
+ options: Omit<RefractorOptions, 'element'> = {},
202
+ ): T => refract(value, { ...options, element: 'response' });
203
+
204
+ /**
205
+ * Refracts a value into a HeadersElement.
206
+ * @public
207
+ */
208
+ export const refractHeaders = <T extends Element = HeadersElement>(
209
+ value: unknown,
210
+ options: Omit<RefractorOptions, 'element'> = {},
211
+ ): T => refract(value, { ...options, element: 'headers' });
212
+
213
+ /**
214
+ * Refracts a value into an ExampleElement.
215
+ * @public
216
+ */
217
+ export const refractExample = <T extends Element = ExampleElement>(
218
+ value: unknown,
219
+ options: Omit<RefractorOptions, 'element'> = {},
220
+ ): T => refract(value, { ...options, element: 'example' });
221
+
222
+ /**
223
+ * Refracts a value into a HeaderElement.
224
+ * @public
225
+ */
226
+ export const refractHeader = <T extends Element = HeaderElement>(
227
+ value: unknown,
228
+ options: Omit<RefractorOptions, 'element'> = {},
229
+ ): T => refract(value, { ...options, element: 'header' });
230
+
231
+ /**
232
+ * Refracts a value into a TagElement.
233
+ * @public
234
+ */
235
+ export const refractTag = <T extends Element = TagElement>(
236
+ value: unknown,
237
+ options: Omit<RefractorOptions, 'element'> = {},
238
+ ): T => refract(value, { ...options, element: 'tag' });
239
+
240
+ /**
241
+ * Refracts a value into a ReferenceElement.
242
+ * @public
243
+ */
244
+ export const refractReference = <T extends Element = ReferenceElement>(
245
+ value: unknown,
246
+ options: Omit<RefractorOptions, 'element'> = {},
247
+ ): T => refract(value, { ...options, element: 'reference' });
248
+
249
+ /**
250
+ * Refracts a value into a SchemaElement.
251
+ * @public
252
+ */
253
+ export const refractSchema = <T extends Element = SchemaElement>(
254
+ value: unknown,
255
+ options: Omit<RefractorOptions, 'element'> = {},
256
+ ): T => refract(value, { ...options, element: 'schema' });
257
+
258
+ /**
259
+ * Refracts a value into an XmlElement.
260
+ * @public
261
+ */
262
+ export const refractXml = <T extends Element = XmlElement>(
263
+ value: unknown,
264
+ options: Omit<RefractorOptions, 'element'> = {},
265
+ ): T => refract(value, { ...options, element: 'xml' });
266
+
267
+ /**
268
+ * Refracts a value into a DefinitionsElement.
269
+ * @public
270
+ */
271
+ export const refractDefinitions = <T extends Element = DefinitionsElement>(
272
+ value: unknown,
273
+ options: Omit<RefractorOptions, 'element'> = {},
274
+ ): T => refract(value, { ...options, element: 'definitions' });
275
+
276
+ /**
277
+ * Refracts a value into a ParametersDefinitionsElement.
278
+ * @public
279
+ */
280
+ export const refractParametersDefinitions = <T extends Element = ParametersDefinitionsElement>(
281
+ value: unknown,
282
+ options: Omit<RefractorOptions, 'element'> = {},
283
+ ): T => refract(value, { ...options, element: 'parametersDefinitions' });
284
+
285
+ /**
286
+ * Refracts a value into a ResponsesDefinitionsElement.
287
+ * @public
288
+ */
289
+ export const refractResponsesDefinitions = <T extends Element = ResponsesDefinitionsElement>(
290
+ value: unknown,
291
+ options: Omit<RefractorOptions, 'element'> = {},
292
+ ): T => refract(value, { ...options, element: 'responsesDefinitions' });
293
+
294
+ /**
295
+ * Refracts a value into a SecurityDefinitionsElement.
296
+ * @public
297
+ */
298
+ export const refractSecurityDefinitions = <T extends Element = SecurityDefinitionsElement>(
299
+ value: unknown,
300
+ options: Omit<RefractorOptions, 'element'> = {},
301
+ ): T => refract(value, { ...options, element: 'securityDefinitions' });
302
+
303
+ /**
304
+ * Refracts a value into a SecuritySchemeElement.
305
+ * @public
306
+ */
307
+ export const refractSecurityScheme = <T extends Element = SecuritySchemeElement>(
308
+ value: unknown,
309
+ options: Omit<RefractorOptions, 'element'> = {},
310
+ ): T => refract(value, { ...options, element: 'securityScheme' });
311
+
312
+ /**
313
+ * Refracts a value into a ScopesElement.
314
+ * @public
315
+ */
316
+ export const refractScopes = <T extends Element = ScopesElement>(
317
+ value: unknown,
318
+ options: Omit<RefractorOptions, 'element'> = {},
319
+ ): T => refract(value, { ...options, element: 'scopes' });
320
+
321
+ /**
322
+ * Refracts a value into a SecurityRequirementElement.
323
+ * @public
324
+ */
325
+ export const refractSecurityRequirement = <T extends Element = SecurityRequirementElement>(
326
+ value: unknown,
327
+ options: Omit<RefractorOptions, 'element'> = {},
328
+ ): T => refract(value, { ...options, element: 'securityRequirement' });
329
+
330
+ export default refract;