@skmtc/core 0.29.0 → 0.31.0

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 (409) hide show
  1. package/esm/_dnt.polyfills.d.ts +11 -0
  2. package/esm/_dnt.polyfills.js +14 -0
  3. package/esm/context/ParseContext.js +9 -1
  4. package/esm/context/generateTypes.d.ts +14 -2
  5. package/esm/context/generateTypes.js +5 -1
  6. package/esm/dsl/GeneratorKeys.d.ts +2 -2
  7. package/esm/dsl/GeneratorKeys.js +6 -3
  8. package/esm/helpers/naming.d.ts +2 -1
  9. package/esm/helpers/naming.js +4 -2
  10. package/esm/mod.d.ts +1 -0
  11. package/esm/mod.js +1 -0
  12. package/esm/oas/discriminator/Discriminator.d.ts +3 -0
  13. package/esm/oas/discriminator/Discriminator.js +7 -0
  14. package/esm/oas/document/Document.d.ts +7 -0
  15. package/esm/oas/document/Document.js +8 -0
  16. package/esm/oas/example/Example.d.ts +10 -1
  17. package/esm/oas/example/Example.js +16 -0
  18. package/esm/oas/header/Header.d.ts +4 -2
  19. package/esm/oas/header/Header.js +12 -5
  20. package/esm/oas/mediaType/MediaType.d.ts +12 -0
  21. package/esm/oas/mediaType/MediaType.js +24 -0
  22. package/esm/oas/mediaType/jsonMediaType.d.ts +50 -0
  23. package/esm/oas/mediaType/jsonMediaType.js +64 -0
  24. package/esm/oas/mediaType/toContentSchema.d.ts +8 -0
  25. package/esm/oas/mediaType/toContentSchema.js +6 -0
  26. package/esm/oas/operation/Operation.d.ts +10 -2
  27. package/esm/oas/operation/Operation.js +20 -7
  28. package/esm/oas/parameter/Parameter.d.ts +3 -2
  29. package/esm/oas/parameter/Parameter.js +11 -5
  30. package/esm/oas/parameter/parameter-types.d.ts +10 -2
  31. package/esm/oas/parameter/parameter-types.js +3 -1
  32. package/esm/oas/requestBody/RequestBody.d.ts +11 -0
  33. package/esm/oas/requestBody/RequestBody.js +16 -2
  34. package/esm/oas/response/Response.d.ts +17 -1
  35. package/esm/oas/response/Response.js +24 -2
  36. package/esm/oas/securitySchemes/SecurityScheme.d.ts +47 -4
  37. package/esm/oas/securitySchemes/SecurityScheme.js +46 -1
  38. package/esm/oas/securitySchemes/security-scheme-types.d.ts +21 -0
  39. package/esm/oas/server/Server.d.ts +8 -2
  40. package/esm/oas/server/Server.js +10 -1
  41. package/esm/oas/tag/Tag.d.ts +9 -0
  42. package/esm/oas/tag/Tag.js +9 -0
  43. package/esm/oas/webhook/Webhook.d.ts +4 -4
  44. package/esm/oas/webhook/Webhook.js +6 -6
  45. package/esm/parse/logBodyMediaTypes.d.ts +27 -0
  46. package/esm/parse/logBodyMediaTypes.js +50 -0
  47. package/esm/parse/toOasDialect.d.ts +8 -7
  48. package/esm/parse/toOasDialect.js +4 -2
  49. package/esm/parse/v3-0/methods.d.ts +11 -0
  50. package/esm/parse/v3-0/methods.js +16 -0
  51. package/esm/parse/v3-0/operation/toOperationsV3.js +5 -5
  52. package/esm/parse/v3-0/parameter/toParameterV3.d.ts +4 -2
  53. package/esm/parse/v3-0/parameter/toParameterV3.js +17 -3
  54. package/esm/parse/v3-0/requestBody/toRequestBodiesV3.js +4 -1
  55. package/esm/parse/v3-0/response/toResponseV3.js +4 -1
  56. package/esm/parse/v3-0/securitySchemes/toSecuritySchemes.js +50 -38
  57. package/esm/parse/v3-0/webhook/toWebhooksV3.js +5 -5
  58. package/esm/parse/v3-1/methods.d.ts +11 -0
  59. package/esm/parse/v3-1/methods.js +16 -0
  60. package/esm/parse/v3-1/operation/toOperationsV3.js +5 -5
  61. package/esm/parse/v3-1/parameter/toParameterV3.d.ts +4 -2
  62. package/esm/parse/v3-1/parameter/toParameterV3.js +17 -3
  63. package/esm/parse/v3-1/requestBody/toRequestBodiesV3.js +4 -1
  64. package/esm/parse/v3-1/response/toResponseV3.js +4 -1
  65. package/esm/parse/v3-1/securitySchemes/toSecuritySchemes.js +50 -38
  66. package/esm/parse/v3-1/webhook/toWebhooksV3.js +5 -5
  67. package/esm/parse/v3-2/_helpers/parseDefault.d.ts +43 -0
  68. package/esm/parse/v3-2/_helpers/parseDefault.js +39 -0
  69. package/esm/parse/v3-2/_helpers/parseEnum.d.ts +13 -0
  70. package/esm/parse/v3-2/_helpers/parseEnum.js +23 -0
  71. package/esm/parse/v3-2/_helpers/parseExample.d.ts +41 -0
  72. package/esm/parse/v3-2/_helpers/parseExample.js +37 -0
  73. package/esm/parse/v3-2/_helpers/parseNullable.d.ts +141 -0
  74. package/esm/parse/v3-2/_helpers/parseNullable.js +140 -0
  75. package/esm/parse/v3-2/_merge-all-of/check-array-item-type-conflicts.d.ts +2 -0
  76. package/esm/parse/v3-2/_merge-all-of/check-array-item-type-conflicts.js +9 -0
  77. package/esm/parse/v3-2/_merge-all-of/check-at-least-one-type-match.d.ts +4 -0
  78. package/esm/parse/v3-2/_merge-all-of/check-at-least-one-type-match.js +5 -0
  79. package/esm/parse/v3-2/_merge-all-of/check-enum-conflicts.d.ts +2 -0
  80. package/esm/parse/v3-2/_merge-all-of/check-enum-conflicts.js +11 -0
  81. package/esm/parse/v3-2/_merge-all-of/check-format-conflicts.d.ts +2 -0
  82. package/esm/parse/v3-2/_merge-all-of/check-format-conflicts.js +5 -0
  83. package/esm/parse/v3-2/_merge-all-of/check-number-constraints-conflicts.d.ts +2 -0
  84. package/esm/parse/v3-2/_merge-all-of/check-number-constraints-conflicts.js +11 -0
  85. package/esm/parse/v3-2/_merge-all-of/check-read-only-write-only-conflicts.d.ts +2 -0
  86. package/esm/parse/v3-2/_merge-all-of/check-read-only-write-only-conflicts.js +5 -0
  87. package/esm/parse/v3-2/_merge-all-of/check-type-conflicts.d.ts +2 -0
  88. package/esm/parse/v3-2/_merge-all-of/check-type-conflicts.js +5 -0
  89. package/esm/parse/v3-2/_merge-all-of/cross-product.d.ts +2 -0
  90. package/esm/parse/v3-2/_merge-all-of/cross-product.js +3 -0
  91. package/esm/parse/v3-2/_merge-all-of/decompose-intersection.d.ts +6 -0
  92. package/esm/parse/v3-2/_merge-all-of/decompose-intersection.js +27 -0
  93. package/esm/parse/v3-2/_merge-all-of/decompose-union.d.ts +12 -0
  94. package/esm/parse/v3-2/_merge-all-of/decompose-union.js +69 -0
  95. package/esm/parse/v3-2/_merge-all-of/generic-merge.d.ts +3 -0
  96. package/esm/parse/v3-2/_merge-all-of/generic-merge.js +12 -0
  97. package/esm/parse/v3-2/_merge-all-of/is-equal.d.ts +1 -0
  98. package/esm/parse/v3-2/_merge-all-of/is-equal.js +19 -0
  99. package/esm/parse/v3-2/_merge-all-of/merge-array-constraints.d.ts +2 -0
  100. package/esm/parse/v3-2/_merge-all-of/merge-array-constraints.js +44 -0
  101. package/esm/parse/v3-2/_merge-all-of/merge-boolean-constraints.d.ts +3 -0
  102. package/esm/parse/v3-2/_merge-all-of/merge-boolean-constraints.js +7 -0
  103. package/esm/parse/v3-2/_merge-all-of/merge-enum-values.d.ts +3 -0
  104. package/esm/parse/v3-2/_merge-all-of/merge-enum-values.js +32 -0
  105. package/esm/parse/v3-2/_merge-all-of/merge-integer-constraints.d.ts +3 -0
  106. package/esm/parse/v3-2/_merge-all-of/merge-integer-constraints.js +41 -0
  107. package/esm/parse/v3-2/_merge-all-of/merge-intersection.d.ts +8 -0
  108. package/esm/parse/v3-2/_merge-all-of/merge-intersection.js +16 -0
  109. package/esm/parse/v3-2/_merge-all-of/merge-number-constraints.d.ts +3 -0
  110. package/esm/parse/v3-2/_merge-all-of/merge-number-constraints.js +41 -0
  111. package/esm/parse/v3-2/_merge-all-of/merge-object-constraints.d.ts +5 -0
  112. package/esm/parse/v3-2/_merge-all-of/merge-object-constraints.js +28 -0
  113. package/esm/parse/v3-2/_merge-all-of/merge-properties.d.ts +2 -0
  114. package/esm/parse/v3-2/_merge-all-of/merge-properties.js +25 -0
  115. package/esm/parse/v3-2/_merge-all-of/merge-required.d.ts +3 -0
  116. package/esm/parse/v3-2/_merge-all-of/merge-required.js +10 -0
  117. package/esm/parse/v3-2/_merge-all-of/merge-string-constraints.d.ts +3 -0
  118. package/esm/parse/v3-2/_merge-all-of/merge-string-constraints.js +55 -0
  119. package/esm/parse/v3-2/_merge-all-of/merge-union.d.ts +15 -0
  120. package/esm/parse/v3-2/_merge-all-of/merge-union.js +53 -0
  121. package/esm/parse/v3-2/_merge-all-of/merge.d.ts +2 -0
  122. package/esm/parse/v3-2/_merge-all-of/merge.js +155 -0
  123. package/esm/parse/v3-2/_merge-all-of/nullable-merge.d.ts +3 -0
  124. package/esm/parse/v3-2/_merge-all-of/nullable-merge.js +12 -0
  125. package/esm/parse/v3-2/_merge-all-of/types.d.ts +14 -0
  126. package/esm/parse/v3-2/_merge-all-of/types.js +2 -0
  127. package/esm/parse/v3-2/array/toArray.d.ts +80 -0
  128. package/esm/parse/v3-2/array/toArray.js +165 -0
  129. package/esm/parse/v3-2/boolean/toBoolean.d.ts +78 -0
  130. package/esm/parse/v3-2/boolean/toBoolean.js +139 -0
  131. package/esm/parse/v3-2/components/toComponentsV3.d.ts +14 -0
  132. package/esm/parse/v3-2/components/toComponentsV3.js +43 -0
  133. package/esm/parse/v3-2/contact/toContactV3.d.ts +5 -0
  134. package/esm/parse/v3-2/contact/toContactV3.js +18 -0
  135. package/esm/parse/v3-2/discriminator/toDiscriminatorV3.d.ts +14 -0
  136. package/esm/parse/v3-2/discriminator/toDiscriminatorV3.js +21 -0
  137. package/esm/parse/v3-2/document/toDocumentFieldsV3.d.ts +16 -0
  138. package/esm/parse/v3-2/document/toDocumentFieldsV3.js +33 -0
  139. package/esm/parse/v3-2/example/toExamplesV3.d.ts +77 -0
  140. package/esm/parse/v3-2/example/toExamplesV3.js +143 -0
  141. package/esm/parse/v3-2/externalDocs/toExternalDocs.d.ts +10 -0
  142. package/esm/parse/v3-2/externalDocs/toExternalDocs.js +15 -0
  143. package/esm/parse/v3-2/header/toHeadersV3.d.ts +18 -0
  144. package/esm/parse/v3-2/header/toHeadersV3.js +47 -0
  145. package/esm/parse/v3-2/info/toInfoV3.d.ts +10 -0
  146. package/esm/parse/v3-2/info/toInfoV3.js +23 -0
  147. package/esm/parse/v3-2/integer/toInteger.d.ts +21 -0
  148. package/esm/parse/v3-2/integer/toInteger.js +115 -0
  149. package/esm/parse/v3-2/license/toLicenseV3.d.ts +5 -0
  150. package/esm/parse/v3-2/license/toLicenseV3.js +17 -0
  151. package/esm/parse/v3-2/link/toLinksV3.d.ts +16 -0
  152. package/esm/parse/v3-2/link/toLinksV3.js +40 -0
  153. package/esm/parse/v3-2/mediaType/toMediaTypeItemV3.d.ts +323 -0
  154. package/esm/parse/v3-2/mediaType/toMediaTypeItemV3.js +375 -0
  155. package/esm/parse/v3-2/methods.d.ts +17 -0
  156. package/esm/parse/v3-2/methods.js +21 -0
  157. package/esm/parse/v3-2/number/toNumber.d.ts +10 -0
  158. package/esm/parse/v3-2/number/toNumber.js +115 -0
  159. package/esm/parse/v3-2/object/toAdditionalPropertiesV3.d.ts +11 -0
  160. package/esm/parse/v3-2/object/toAdditionalPropertiesV3.js +10 -0
  161. package/esm/parse/v3-2/object/toObject.d.ts +10 -0
  162. package/esm/parse/v3-2/object/toObject.js +90 -0
  163. package/esm/parse/v3-2/operation/toOperationsV3.d.ts +25 -0
  164. package/esm/parse/v3-2/operation/toOperationsV3.js +129 -0
  165. package/esm/parse/v3-2/parameter/toParameterV3.d.ts +39 -0
  166. package/esm/parse/v3-2/parameter/toParameterV3.js +152 -0
  167. package/esm/parse/v3-2/parameter/warnQuerystringConflictsV3.d.ts +22 -0
  168. package/esm/parse/v3-2/parameter/warnQuerystringConflictsV3.js +39 -0
  169. package/esm/parse/v3-2/pathItem/dropAdditionalOperationsV3.d.ts +17 -0
  170. package/esm/parse/v3-2/pathItem/dropAdditionalOperationsV3.js +34 -0
  171. package/esm/parse/v3-2/pathItem/toPathItemV3.d.ts +23 -0
  172. package/esm/parse/v3-2/pathItem/toPathItemV3.js +45 -0
  173. package/esm/parse/v3-2/ref/toRefV31.d.ts +19 -0
  174. package/esm/parse/v3-2/ref/toRefV31.js +10 -0
  175. package/esm/parse/v3-2/requestBody/toRequestBodiesV3.d.ts +18 -0
  176. package/esm/parse/v3-2/requestBody/toRequestBodiesV3.js +47 -0
  177. package/esm/parse/v3-2/response/toResponseV3.d.ts +29 -0
  178. package/esm/parse/v3-2/response/toResponseV3.js +59 -0
  179. package/esm/parse/v3-2/schema/toSchemasV3.d.ts +29 -0
  180. package/esm/parse/v3-2/schema/toSchemasV3.js +511 -0
  181. package/esm/parse/v3-2/securityRequirement/toSecurityRequirement.d.ts +9 -0
  182. package/esm/parse/v3-2/securityRequirement/toSecurityRequirement.js +9 -0
  183. package/esm/parse/v3-2/securitySchemes/toSecuritySchemes.d.ts +17 -0
  184. package/esm/parse/v3-2/securitySchemes/toSecuritySchemes.js +152 -0
  185. package/esm/parse/v3-2/server/toServerV3.d.ts +26 -0
  186. package/esm/parse/v3-2/server/toServerV3.js +31 -0
  187. package/esm/parse/v3-2/serverVariable/toServerVariableV3.d.ts +22 -0
  188. package/esm/parse/v3-2/serverVariable/toServerVariableV3.js +30 -0
  189. package/esm/parse/v3-2/specificationExtensions/toSpecificationExtensionsV3.d.ts +14 -0
  190. package/esm/parse/v3-2/specificationExtensions/toSpecificationExtensionsV3.js +25 -0
  191. package/esm/parse/v3-2/string/toString.d.ts +146 -0
  192. package/esm/parse/v3-2/string/toString.js +211 -0
  193. package/esm/parse/v3-2/tag/toTagsV3.d.ts +22 -0
  194. package/esm/parse/v3-2/tag/toTagsV3.js +78 -0
  195. package/esm/parse/v3-2/union/toUnion.d.ts +12 -0
  196. package/esm/parse/v3-2/union/toUnion.js +68 -0
  197. package/esm/parse/v3-2/unknown/toUnknown.d.ts +10 -0
  198. package/esm/parse/v3-2/unknown/toUnknown.js +19 -0
  199. package/esm/parse/v3-2/webhook/toWebhooksV3.d.ts +48 -0
  200. package/esm/parse/v3-2/webhook/toWebhooksV3.js +139 -0
  201. package/esm/types/Method.d.ts +7 -4
  202. package/esm/types/Method.js +17 -4
  203. package/esm/types/Preview.d.ts +2 -1
  204. package/esm/types/SkmtcDocument.d.ts +6 -6
  205. package/package.json +1 -1
  206. package/script/_dnt.polyfills.d.ts +11 -0
  207. package/script/_dnt.polyfills.js +14 -0
  208. package/script/context/ParseContext.js +9 -1
  209. package/script/context/generateTypes.d.ts +14 -2
  210. package/script/context/generateTypes.js +5 -1
  211. package/script/dsl/GeneratorKeys.d.ts +2 -2
  212. package/script/dsl/GeneratorKeys.js +6 -3
  213. package/script/helpers/naming.d.ts +2 -1
  214. package/script/helpers/naming.js +4 -2
  215. package/script/mod.d.ts +1 -0
  216. package/script/mod.js +1 -0
  217. package/script/oas/discriminator/Discriminator.d.ts +3 -0
  218. package/script/oas/discriminator/Discriminator.js +7 -0
  219. package/script/oas/document/Document.d.ts +7 -0
  220. package/script/oas/document/Document.js +8 -0
  221. package/script/oas/example/Example.d.ts +10 -1
  222. package/script/oas/example/Example.js +16 -0
  223. package/script/oas/header/Header.d.ts +4 -2
  224. package/script/oas/header/Header.js +12 -5
  225. package/script/oas/mediaType/MediaType.d.ts +12 -0
  226. package/script/oas/mediaType/MediaType.js +24 -0
  227. package/script/oas/mediaType/jsonMediaType.d.ts +50 -0
  228. package/script/oas/mediaType/jsonMediaType.js +71 -0
  229. package/script/oas/mediaType/toContentSchema.d.ts +8 -0
  230. package/script/oas/mediaType/toContentSchema.js +10 -0
  231. package/script/oas/operation/Operation.d.ts +10 -2
  232. package/script/oas/operation/Operation.js +20 -7
  233. package/script/oas/parameter/Parameter.d.ts +3 -2
  234. package/script/oas/parameter/Parameter.js +11 -5
  235. package/script/oas/parameter/parameter-types.d.ts +10 -2
  236. package/script/oas/parameter/parameter-types.js +3 -1
  237. package/script/oas/requestBody/RequestBody.d.ts +11 -0
  238. package/script/oas/requestBody/RequestBody.js +16 -2
  239. package/script/oas/response/Response.d.ts +17 -1
  240. package/script/oas/response/Response.js +24 -2
  241. package/script/oas/securitySchemes/SecurityScheme.d.ts +47 -4
  242. package/script/oas/securitySchemes/SecurityScheme.js +46 -1
  243. package/script/oas/securitySchemes/security-scheme-types.d.ts +21 -0
  244. package/script/oas/server/Server.d.ts +8 -2
  245. package/script/oas/server/Server.js +10 -1
  246. package/script/oas/tag/Tag.d.ts +9 -0
  247. package/script/oas/tag/Tag.js +9 -0
  248. package/script/oas/webhook/Webhook.d.ts +4 -4
  249. package/script/oas/webhook/Webhook.js +6 -6
  250. package/script/parse/logBodyMediaTypes.d.ts +27 -0
  251. package/script/parse/logBodyMediaTypes.js +54 -0
  252. package/script/parse/toOasDialect.d.ts +8 -7
  253. package/script/parse/toOasDialect.js +4 -2
  254. package/script/parse/v3-0/methods.d.ts +11 -0
  255. package/script/parse/v3-0/methods.js +20 -0
  256. package/script/parse/v3-0/operation/toOperationsV3.js +5 -5
  257. package/script/parse/v3-0/parameter/toParameterV3.d.ts +4 -2
  258. package/script/parse/v3-0/parameter/toParameterV3.js +17 -3
  259. package/script/parse/v3-0/requestBody/toRequestBodiesV3.js +4 -1
  260. package/script/parse/v3-0/response/toResponseV3.js +4 -1
  261. package/script/parse/v3-0/securitySchemes/toSecuritySchemes.js +49 -37
  262. package/script/parse/v3-0/webhook/toWebhooksV3.js +5 -5
  263. package/script/parse/v3-1/methods.d.ts +11 -0
  264. package/script/parse/v3-1/methods.js +20 -0
  265. package/script/parse/v3-1/operation/toOperationsV3.js +5 -5
  266. package/script/parse/v3-1/parameter/toParameterV3.d.ts +4 -2
  267. package/script/parse/v3-1/parameter/toParameterV3.js +17 -3
  268. package/script/parse/v3-1/requestBody/toRequestBodiesV3.js +4 -1
  269. package/script/parse/v3-1/response/toResponseV3.js +4 -1
  270. package/script/parse/v3-1/securitySchemes/toSecuritySchemes.js +49 -37
  271. package/script/parse/v3-1/webhook/toWebhooksV3.js +5 -5
  272. package/script/parse/v3-2/_helpers/parseDefault.d.ts +43 -0
  273. package/script/parse/v3-2/_helpers/parseDefault.js +43 -0
  274. package/script/parse/v3-2/_helpers/parseEnum.d.ts +13 -0
  275. package/script/parse/v3-2/_helpers/parseEnum.js +27 -0
  276. package/script/parse/v3-2/_helpers/parseExample.d.ts +41 -0
  277. package/script/parse/v3-2/_helpers/parseExample.js +41 -0
  278. package/script/parse/v3-2/_helpers/parseNullable.d.ts +141 -0
  279. package/script/parse/v3-2/_helpers/parseNullable.js +144 -0
  280. package/script/parse/v3-2/_merge-all-of/check-array-item-type-conflicts.d.ts +2 -0
  281. package/script/parse/v3-2/_merge-all-of/check-array-item-type-conflicts.js +13 -0
  282. package/script/parse/v3-2/_merge-all-of/check-at-least-one-type-match.d.ts +4 -0
  283. package/script/parse/v3-2/_merge-all-of/check-at-least-one-type-match.js +9 -0
  284. package/script/parse/v3-2/_merge-all-of/check-enum-conflicts.d.ts +2 -0
  285. package/script/parse/v3-2/_merge-all-of/check-enum-conflicts.js +15 -0
  286. package/script/parse/v3-2/_merge-all-of/check-format-conflicts.d.ts +2 -0
  287. package/script/parse/v3-2/_merge-all-of/check-format-conflicts.js +9 -0
  288. package/script/parse/v3-2/_merge-all-of/check-number-constraints-conflicts.d.ts +2 -0
  289. package/script/parse/v3-2/_merge-all-of/check-number-constraints-conflicts.js +15 -0
  290. package/script/parse/v3-2/_merge-all-of/check-read-only-write-only-conflicts.d.ts +2 -0
  291. package/script/parse/v3-2/_merge-all-of/check-read-only-write-only-conflicts.js +9 -0
  292. package/script/parse/v3-2/_merge-all-of/check-type-conflicts.d.ts +2 -0
  293. package/script/parse/v3-2/_merge-all-of/check-type-conflicts.js +9 -0
  294. package/script/parse/v3-2/_merge-all-of/cross-product.d.ts +2 -0
  295. package/script/parse/v3-2/_merge-all-of/cross-product.js +7 -0
  296. package/script/parse/v3-2/_merge-all-of/decompose-intersection.d.ts +6 -0
  297. package/script/parse/v3-2/_merge-all-of/decompose-intersection.js +31 -0
  298. package/script/parse/v3-2/_merge-all-of/decompose-union.d.ts +12 -0
  299. package/script/parse/v3-2/_merge-all-of/decompose-union.js +73 -0
  300. package/script/parse/v3-2/_merge-all-of/generic-merge.d.ts +3 -0
  301. package/script/parse/v3-2/_merge-all-of/generic-merge.js +16 -0
  302. package/script/parse/v3-2/_merge-all-of/is-equal.d.ts +1 -0
  303. package/script/parse/v3-2/_merge-all-of/is-equal.js +23 -0
  304. package/script/parse/v3-2/_merge-all-of/merge-array-constraints.d.ts +2 -0
  305. package/script/parse/v3-2/_merge-all-of/merge-array-constraints.js +80 -0
  306. package/script/parse/v3-2/_merge-all-of/merge-boolean-constraints.d.ts +3 -0
  307. package/script/parse/v3-2/_merge-all-of/merge-boolean-constraints.js +43 -0
  308. package/script/parse/v3-2/_merge-all-of/merge-enum-values.d.ts +3 -0
  309. package/script/parse/v3-2/_merge-all-of/merge-enum-values.js +68 -0
  310. package/script/parse/v3-2/_merge-all-of/merge-integer-constraints.d.ts +3 -0
  311. package/script/parse/v3-2/_merge-all-of/merge-integer-constraints.js +77 -0
  312. package/script/parse/v3-2/_merge-all-of/merge-intersection.d.ts +8 -0
  313. package/script/parse/v3-2/_merge-all-of/merge-intersection.js +20 -0
  314. package/script/parse/v3-2/_merge-all-of/merge-number-constraints.d.ts +3 -0
  315. package/script/parse/v3-2/_merge-all-of/merge-number-constraints.js +77 -0
  316. package/script/parse/v3-2/_merge-all-of/merge-object-constraints.d.ts +5 -0
  317. package/script/parse/v3-2/_merge-all-of/merge-object-constraints.js +65 -0
  318. package/script/parse/v3-2/_merge-all-of/merge-properties.d.ts +2 -0
  319. package/script/parse/v3-2/_merge-all-of/merge-properties.js +29 -0
  320. package/script/parse/v3-2/_merge-all-of/merge-required.d.ts +3 -0
  321. package/script/parse/v3-2/_merge-all-of/merge-required.js +15 -0
  322. package/script/parse/v3-2/_merge-all-of/merge-string-constraints.d.ts +3 -0
  323. package/script/parse/v3-2/_merge-all-of/merge-string-constraints.js +91 -0
  324. package/script/parse/v3-2/_merge-all-of/merge-union.d.ts +15 -0
  325. package/script/parse/v3-2/_merge-all-of/merge-union.js +58 -0
  326. package/script/parse/v3-2/_merge-all-of/merge.d.ts +2 -0
  327. package/script/parse/v3-2/_merge-all-of/merge.js +159 -0
  328. package/script/parse/v3-2/_merge-all-of/nullable-merge.d.ts +3 -0
  329. package/script/parse/v3-2/_merge-all-of/nullable-merge.js +17 -0
  330. package/script/parse/v3-2/_merge-all-of/types.d.ts +14 -0
  331. package/script/parse/v3-2/_merge-all-of/types.js +38 -0
  332. package/script/parse/v3-2/array/toArray.d.ts +80 -0
  333. package/script/parse/v3-2/array/toArray.js +203 -0
  334. package/script/parse/v3-2/boolean/toBoolean.d.ts +78 -0
  335. package/script/parse/v3-2/boolean/toBoolean.js +177 -0
  336. package/script/parse/v3-2/components/toComponentsV3.d.ts +14 -0
  337. package/script/parse/v3-2/components/toComponentsV3.js +47 -0
  338. package/script/parse/v3-2/contact/toContactV3.d.ts +5 -0
  339. package/script/parse/v3-2/contact/toContactV3.js +22 -0
  340. package/script/parse/v3-2/discriminator/toDiscriminatorV3.d.ts +14 -0
  341. package/script/parse/v3-2/discriminator/toDiscriminatorV3.js +25 -0
  342. package/script/parse/v3-2/document/toDocumentFieldsV3.d.ts +16 -0
  343. package/script/parse/v3-2/document/toDocumentFieldsV3.js +37 -0
  344. package/script/parse/v3-2/example/toExamplesV3.d.ts +77 -0
  345. package/script/parse/v3-2/example/toExamplesV3.js +149 -0
  346. package/script/parse/v3-2/externalDocs/toExternalDocs.d.ts +10 -0
  347. package/script/parse/v3-2/externalDocs/toExternalDocs.js +52 -0
  348. package/script/parse/v3-2/header/toHeadersV3.d.ts +18 -0
  349. package/script/parse/v3-2/header/toHeadersV3.js +51 -0
  350. package/script/parse/v3-2/info/toInfoV3.d.ts +10 -0
  351. package/script/parse/v3-2/info/toInfoV3.js +27 -0
  352. package/script/parse/v3-2/integer/toInteger.d.ts +21 -0
  353. package/script/parse/v3-2/integer/toInteger.js +153 -0
  354. package/script/parse/v3-2/license/toLicenseV3.d.ts +5 -0
  355. package/script/parse/v3-2/license/toLicenseV3.js +21 -0
  356. package/script/parse/v3-2/link/toLinksV3.d.ts +16 -0
  357. package/script/parse/v3-2/link/toLinksV3.js +44 -0
  358. package/script/parse/v3-2/mediaType/toMediaTypeItemV3.d.ts +323 -0
  359. package/script/parse/v3-2/mediaType/toMediaTypeItemV3.js +381 -0
  360. package/script/parse/v3-2/methods.d.ts +17 -0
  361. package/script/parse/v3-2/methods.js +25 -0
  362. package/script/parse/v3-2/number/toNumber.d.ts +10 -0
  363. package/script/parse/v3-2/number/toNumber.js +152 -0
  364. package/script/parse/v3-2/object/toAdditionalPropertiesV3.d.ts +11 -0
  365. package/script/parse/v3-2/object/toAdditionalPropertiesV3.js +14 -0
  366. package/script/parse/v3-2/object/toObject.d.ts +10 -0
  367. package/script/parse/v3-2/object/toObject.js +94 -0
  368. package/script/parse/v3-2/operation/toOperationsV3.d.ts +25 -0
  369. package/script/parse/v3-2/operation/toOperationsV3.js +134 -0
  370. package/script/parse/v3-2/parameter/toParameterV3.d.ts +39 -0
  371. package/script/parse/v3-2/parameter/toParameterV3.js +191 -0
  372. package/script/parse/v3-2/parameter/warnQuerystringConflictsV3.d.ts +22 -0
  373. package/script/parse/v3-2/parameter/warnQuerystringConflictsV3.js +43 -0
  374. package/script/parse/v3-2/pathItem/dropAdditionalOperationsV3.d.ts +17 -0
  375. package/script/parse/v3-2/pathItem/dropAdditionalOperationsV3.js +38 -0
  376. package/script/parse/v3-2/pathItem/toPathItemV3.d.ts +23 -0
  377. package/script/parse/v3-2/pathItem/toPathItemV3.js +50 -0
  378. package/script/parse/v3-2/ref/toRefV31.d.ts +19 -0
  379. package/script/parse/v3-2/ref/toRefV31.js +14 -0
  380. package/script/parse/v3-2/requestBody/toRequestBodiesV3.d.ts +18 -0
  381. package/script/parse/v3-2/requestBody/toRequestBodiesV3.js +52 -0
  382. package/script/parse/v3-2/response/toResponseV3.d.ts +29 -0
  383. package/script/parse/v3-2/response/toResponseV3.js +65 -0
  384. package/script/parse/v3-2/schema/toSchemasV3.d.ts +29 -0
  385. package/script/parse/v3-2/schema/toSchemasV3.js +518 -0
  386. package/script/parse/v3-2/securityRequirement/toSecurityRequirement.d.ts +9 -0
  387. package/script/parse/v3-2/securityRequirement/toSecurityRequirement.js +13 -0
  388. package/script/parse/v3-2/securitySchemes/toSecuritySchemes.d.ts +17 -0
  389. package/script/parse/v3-2/securitySchemes/toSecuritySchemes.js +189 -0
  390. package/script/parse/v3-2/server/toServerV3.d.ts +26 -0
  391. package/script/parse/v3-2/server/toServerV3.js +37 -0
  392. package/script/parse/v3-2/serverVariable/toServerVariableV3.d.ts +22 -0
  393. package/script/parse/v3-2/serverVariable/toServerVariableV3.js +36 -0
  394. package/script/parse/v3-2/specificationExtensions/toSpecificationExtensionsV3.d.ts +14 -0
  395. package/script/parse/v3-2/specificationExtensions/toSpecificationExtensionsV3.js +30 -0
  396. package/script/parse/v3-2/string/toString.d.ts +146 -0
  397. package/script/parse/v3-2/string/toString.js +249 -0
  398. package/script/parse/v3-2/tag/toTagsV3.d.ts +22 -0
  399. package/script/parse/v3-2/tag/toTagsV3.js +83 -0
  400. package/script/parse/v3-2/union/toUnion.d.ts +12 -0
  401. package/script/parse/v3-2/union/toUnion.js +72 -0
  402. package/script/parse/v3-2/unknown/toUnknown.d.ts +10 -0
  403. package/script/parse/v3-2/unknown/toUnknown.js +23 -0
  404. package/script/parse/v3-2/webhook/toWebhooksV3.d.ts +48 -0
  405. package/script/parse/v3-2/webhook/toWebhooksV3.js +144 -0
  406. package/script/types/Method.d.ts +7 -4
  407. package/script/types/Method.js +17 -4
  408. package/script/types/Preview.d.ts +2 -1
  409. package/script/types/SkmtcDocument.d.ts +6 -6
@@ -0,0 +1,78 @@
1
+ import type { OpenAPIV3 } from 'openapi-types';
2
+ import type { ParseContextType } from '../../../context/parseTypes.js';
3
+ import { OasBoolean } from '../../../oas/boolean/Boolean.js';
4
+ import type { StackTrail } from '../../../context/StackTrail.js';
5
+ export type ToBooleanArgs = {
6
+ value: OpenAPIV3.SchemaObject;
7
+ stackTrail: StackTrail;
8
+ context: ParseContextType;
9
+ };
10
+ /**
11
+ * Transforms an OpenAPI v3 boolean schema object into an internal OAS boolean representation.
12
+ *
13
+ * This function processes OpenAPI boolean schemas by extracting and parsing nullable values,
14
+ * examples, enumerations, and default values. It handles the complete transformation from
15
+ * raw OpenAPI JSON to the SKMTC internal boolean representation with proper validation.
16
+ *
17
+ * The transformation follows a pipeline approach:
18
+ * 1. Parse nullable flag and extract base value
19
+ * 2. Parse example values with nullable support
20
+ * 3. Parse enumeration constraints (typically [true], [false], or [true, false])
21
+ * 4. Parse default values
22
+ * 5. Create final OasBoolean instance
23
+ *
24
+ * @param args - Transformation arguments
25
+ * @param args.value - The OpenAPI v3 boolean schema object to transform
26
+ * @param args.context - Parse context providing utilities and tracing
27
+ * @returns Transformed OAS boolean object with parsed properties
28
+ *
29
+ * @example Basic boolean transformation
30
+ * ```typescript
31
+ * import { toBoolean } from '@skmtc/core';
32
+ *
33
+ * const openApiBoolean = {
34
+ * type: 'boolean',
35
+ * default: false
36
+ * };
37
+ *
38
+ * const oasBoolean = toBoolean({
39
+ * value: openApiBoolean,
40
+ * context: parseContext
41
+ * });
42
+ *
43
+ * console.log(oasBoolean.default); // false
44
+ * ```
45
+ *
46
+ * @example Boolean with nullable and enum
47
+ * ```typescript
48
+ * const flagBoolean = {
49
+ * type: 'boolean',
50
+ * nullable: true,
51
+ * enum: [true, null],
52
+ * default: null,
53
+ * example: true,
54
+ * title: 'Feature Flag',
55
+ * description: 'Whether the feature is enabled'
56
+ * };
57
+ *
58
+ * const oasBoolean = toBoolean({
59
+ * value: flagBoolean,
60
+ * context: parseContext
61
+ * });
62
+ *
63
+ * console.log(oasBoolean.nullable); // true
64
+ * console.log(oasBoolean.enums); // [true, null]
65
+ * ```
66
+ */
67
+ export declare const toBoolean: ({ value, stackTrail, context }: ToBooleanArgs) => OasBoolean;
68
+ type ToParsedBooleanArgs<Nullable extends boolean | undefined> = {
69
+ value: Omit<OpenAPIV3.SchemaObject, 'nullable' | 'example' | 'enums'>;
70
+ context: ParseContextType;
71
+ nullable: Nullable;
72
+ example: Nullable extends true ? boolean | null | undefined : boolean | undefined;
73
+ enums: Nullable extends true ? (boolean | null)[] | undefined : boolean[] | undefined;
74
+ defaultValue: Nullable extends true ? boolean | null | undefined : boolean | undefined;
75
+ stackTrail: StackTrail;
76
+ };
77
+ export declare const toParsedBoolean: <Nullable extends boolean | undefined>({ context, nullable, example, enums, defaultValue, value, stackTrail }: ToParsedBooleanArgs<Nullable>) => OasBoolean<Nullable>;
78
+ export {};
@@ -0,0 +1,139 @@
1
+ import { OasBoolean } from '../../../oas/boolean/Boolean.js';
2
+ import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
3
+ import { oasBooleanData } from '../../../oas/boolean/boolean-types.js';
4
+ import { parseNullable } from '../_helpers/parseNullable.js';
5
+ import { parseEnum } from '../_helpers/parseEnum.js';
6
+ import { parseExample } from '../_helpers/parseExample.js';
7
+ import { parseDefault } from '../_helpers/parseDefault.js';
8
+ import * as v from 'valibot';
9
+ /**
10
+ * Transforms an OpenAPI v3 boolean schema object into an internal OAS boolean representation.
11
+ *
12
+ * This function processes OpenAPI boolean schemas by extracting and parsing nullable values,
13
+ * examples, enumerations, and default values. It handles the complete transformation from
14
+ * raw OpenAPI JSON to the SKMTC internal boolean representation with proper validation.
15
+ *
16
+ * The transformation follows a pipeline approach:
17
+ * 1. Parse nullable flag and extract base value
18
+ * 2. Parse example values with nullable support
19
+ * 3. Parse enumeration constraints (typically [true], [false], or [true, false])
20
+ * 4. Parse default values
21
+ * 5. Create final OasBoolean instance
22
+ *
23
+ * @param args - Transformation arguments
24
+ * @param args.value - The OpenAPI v3 boolean schema object to transform
25
+ * @param args.context - Parse context providing utilities and tracing
26
+ * @returns Transformed OAS boolean object with parsed properties
27
+ *
28
+ * @example Basic boolean transformation
29
+ * ```typescript
30
+ * import { toBoolean } from '@skmtc/core';
31
+ *
32
+ * const openApiBoolean = {
33
+ * type: 'boolean',
34
+ * default: false
35
+ * };
36
+ *
37
+ * const oasBoolean = toBoolean({
38
+ * value: openApiBoolean,
39
+ * context: parseContext
40
+ * });
41
+ *
42
+ * console.log(oasBoolean.default); // false
43
+ * ```
44
+ *
45
+ * @example Boolean with nullable and enum
46
+ * ```typescript
47
+ * const flagBoolean = {
48
+ * type: 'boolean',
49
+ * nullable: true,
50
+ * enum: [true, null],
51
+ * default: null,
52
+ * example: true,
53
+ * title: 'Feature Flag',
54
+ * description: 'Whether the feature is enabled'
55
+ * };
56
+ *
57
+ * const oasBoolean = toBoolean({
58
+ * value: flagBoolean,
59
+ * context: parseContext
60
+ * });
61
+ *
62
+ * console.log(oasBoolean.nullable); // true
63
+ * console.log(oasBoolean.enums); // [true, null]
64
+ * ```
65
+ */
66
+ export const toBoolean = ({ value, stackTrail, context }) => {
67
+ const { nullable, value: valueWithoutNullable } = parseNullable({
68
+ value,
69
+ context,
70
+ stackTrail
71
+ });
72
+ const { example: unparsedExample, ...valueWithoutExample } = valueWithoutNullable;
73
+ const example = parseExample({
74
+ value: unparsedExample,
75
+ context,
76
+ parent: valueWithoutNullable,
77
+ nullable,
78
+ check: isBoolean,
79
+ toMessage: item => `Removed invalid example. Expected "boolean", got: ${item}`,
80
+ stackTrail
81
+ });
82
+ const { enum: unparsedEnums, ...valueWithoutEnums } = valueWithoutExample;
83
+ const enums = parseEnum({
84
+ value: unparsedEnums,
85
+ nullable,
86
+ parent: valueWithoutExample,
87
+ stackTrail,
88
+ context,
89
+ check: isBoolean,
90
+ toMessage: item => `Removed invalid enum. Expected "boolean", got: ${item}`
91
+ });
92
+ const { default: unparsedDefaultValue, ...valueWithoutDefault } = valueWithoutEnums;
93
+ const defaultValue = parseDefault({
94
+ value: unparsedDefaultValue,
95
+ context,
96
+ parent: valueWithoutEnums,
97
+ nullable,
98
+ check: isBoolean,
99
+ toMessage: item => `Removed invalid default. Expected "boolean", got: ${item}`,
100
+ stackTrail
101
+ });
102
+ return toParsedBoolean({
103
+ context,
104
+ nullable,
105
+ example,
106
+ enums,
107
+ defaultValue,
108
+ value: valueWithoutDefault,
109
+ stackTrail
110
+ });
111
+ };
112
+ export const toParsedBoolean = ({ context, nullable, example, enums, defaultValue, value, stackTrail }) => {
113
+ if (!v.is(oasBooleanData, value)) {
114
+ v.parse(oasBooleanData, value);
115
+ }
116
+ const { type: _type, title, description, readOnly, writeOnly, deprecated, ...skipped } = value;
117
+ const extensionFields = toSpecificationExtensionsV3({
118
+ skipped,
119
+ parent: value,
120
+ context,
121
+ stackTrail,
122
+ parentType: 'schema:boolean'
123
+ });
124
+ return context.withStackTrail(stackTrail, () => new OasBoolean({
125
+ nullable,
126
+ title,
127
+ description,
128
+ example,
129
+ enums: enums,
130
+ default: defaultValue,
131
+ extensionFields,
132
+ readOnly,
133
+ writeOnly,
134
+ deprecated
135
+ }, context));
136
+ };
137
+ const isBoolean = (value) => {
138
+ return typeof value === 'boolean';
139
+ };
@@ -0,0 +1,14 @@
1
+ import type { OpenAPIV3 } from 'openapi-types';
2
+ import type { ParseContextType } from '../../../context/parseTypes.js';
3
+ import { OasComponents } from '../../../oas/components/Components.js';
4
+ import type { StackTrail } from '../../../context/StackTrail.js';
5
+ /** An OpenAPI 3.2 Components Object: the 3.0/3.1 maps plus `mediaTypes`. */
6
+ export type ComponentsObjectV32 = OpenAPIV3.ComponentsObject & {
7
+ mediaTypes?: Record<string, unknown>;
8
+ };
9
+ export type ToComponentsV3Args = {
10
+ components: ComponentsObjectV32 | undefined;
11
+ stackTrail: StackTrail;
12
+ context: ParseContextType;
13
+ };
14
+ export declare const toComponentsV3: ({ components, stackTrail, context }: ToComponentsV3Args) => OasComponents | undefined;
@@ -0,0 +1,43 @@
1
+ import { toOptionalResponsesV3 } from '../response/toResponseV3.js';
2
+ import { toHeadersV3 } from '../header/toHeadersV3.js';
3
+ import { toLinksV3 } from '../link/toLinksV3.js';
4
+ import { toOptionalSchemasV3 } from '../schema/toSchemasV3.js';
5
+ import { toOptionalParametersV3 } from '../parameter/toParameterV3.js';
6
+ import { toExamplesV3 } from '../example/toExamplesV3.js';
7
+ import { toRequestBodiesV3 } from '../requestBody/toRequestBodiesV3.js';
8
+ import { OasComponents } from '../../../oas/components/Components.js';
9
+ import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
10
+ import { toSecuritySchemesV3 } from '../securitySchemes/toSecuritySchemes.js';
11
+ export const toComponentsV3 = ({ components, stackTrail, context }) => {
12
+ if (!components) {
13
+ return undefined;
14
+ }
15
+ // `mediaTypes` is resolved where it is referenced, inside
16
+ // `toMediaTypeItemsV3`, so it is read here only to keep it off `skipped`.
17
+ const { schemas, responses, parameters, examples, requestBodies, headers, securitySchemes, links, mediaTypes: _mediaTypes, ...skipped } = components;
18
+ const extensionFields = toSpecificationExtensionsV3({
19
+ skipped,
20
+ parent: components,
21
+ context,
22
+ stackTrail,
23
+ parentType: 'components'
24
+ });
25
+ const fields = {
26
+ schemas: stackTrail.trace('schemas', st => toOptionalSchemasV3({ schemas, stackTrail: st, context })),
27
+ responses: stackTrail.trace('responses', st => toOptionalResponsesV3({ responses, stackTrail: st, context })),
28
+ parameters: stackTrail.trace('parameters', st => toOptionalParametersV3({ parameters, stackTrail: st, context })),
29
+ examples: toExamplesV3({
30
+ examples,
31
+ example: undefined,
32
+ exampleKey: 'TEMP',
33
+ stackTrail,
34
+ context
35
+ }),
36
+ requestBodies: stackTrail.trace('requestBodies', st => toRequestBodiesV3({ requestBodies, stackTrail: st, context })),
37
+ headers: stackTrail.trace('headers', st => toHeadersV3({ headers, stackTrail: st, context })),
38
+ securitySchemes: stackTrail.trace('securitySchemes', st => toSecuritySchemesV3({ securitySchemes, stackTrail: st, context })),
39
+ links: stackTrail.trace('links', st => toLinksV3({ links, stackTrail: st, context })),
40
+ extensionFields
41
+ };
42
+ return new OasComponents(fields);
43
+ };
@@ -0,0 +1,5 @@
1
+ import type { OpenAPIV3 } from 'openapi-types';
2
+ import type { ParseContextType } from '../../../context/parseTypes.js';
3
+ import { OasContact } from '../../../oas/contact/Contact.js';
4
+ import type { StackTrail } from '../../../context/StackTrail.js';
5
+ export declare const toContactV3: (contact: OpenAPIV3.ContactObject, stackTrail: StackTrail, context: ParseContextType) => OasContact;
@@ -0,0 +1,18 @@
1
+ import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
2
+ import { OasContact } from '../../../oas/contact/Contact.js';
3
+ export const toContactV3 = (contact, stackTrail, context) => {
4
+ const { name, url, email, ...skipped } = contact;
5
+ const extensionFields = toSpecificationExtensionsV3({
6
+ skipped,
7
+ parent: contact,
8
+ context,
9
+ stackTrail,
10
+ parentType: 'contact'
11
+ });
12
+ return new OasContact({
13
+ name,
14
+ url,
15
+ email,
16
+ extensionFields
17
+ });
18
+ };
@@ -0,0 +1,14 @@
1
+ import type { OpenAPIV3 } from 'openapi-types';
2
+ import type { ParseContextType } from '../../../context/parseTypes.js';
3
+ import { OasDiscriminator } from '../../../oas/discriminator/Discriminator.js';
4
+ import type { StackTrail } from '../../../context/StackTrail.js';
5
+ /** A 3.2 Discriminator Object: the 3.0 shape plus `defaultMapping`. */
6
+ export type DiscriminatorObjectV32 = OpenAPIV3.DiscriminatorObject & {
7
+ defaultMapping?: string;
8
+ };
9
+ export type ToDiscriminatorV3Args = {
10
+ discriminator: DiscriminatorObjectV32 | undefined;
11
+ stackTrail: StackTrail;
12
+ context: ParseContextType;
13
+ };
14
+ export declare const toDiscriminatorV3: ({ discriminator, stackTrail, context }: ToDiscriminatorV3Args) => OasDiscriminator | undefined;
@@ -0,0 +1,21 @@
1
+ import { OasDiscriminator } from '../../../oas/discriminator/Discriminator.js';
2
+ import { isEmpty } from '../../../helpers/isEmpty.js';
3
+ export const toDiscriminatorV3 = ({ discriminator, stackTrail, context }) => {
4
+ if (!discriminator) {
5
+ return undefined;
6
+ }
7
+ const { propertyName, mapping, defaultMapping, ...skipped } = discriminator;
8
+ if (!isEmpty(skipped)) {
9
+ context.logSkippedFields({
10
+ skipped,
11
+ parent: discriminator,
12
+ parentType: 'discriminator',
13
+ stackTrail
14
+ });
15
+ }
16
+ return new OasDiscriminator({
17
+ propertyName,
18
+ mapping,
19
+ defaultMapping
20
+ });
21
+ };
@@ -0,0 +1,16 @@
1
+ import type { OpenAPIV3 } from 'openapi-types';
2
+ import type { ParseContextType } from '../../../context/parseTypes.js';
3
+ import { type WebhooksObject } from '../webhook/toWebhooksV3.js';
4
+ import type { DocumentFields } from '../../../oas/document/Document.js';
5
+ import type { StackTrail } from '../../../context/StackTrail.js';
6
+ export type ToDocumentV3Args = {
7
+ documentObject: Omit<OpenAPIV3.Document, 'paths'> & {
8
+ paths?: OpenAPIV3.PathsObject;
9
+ webhooks?: WebhooksObject;
10
+ /** The document's own URI (3.2) */
11
+ $self?: string;
12
+ };
13
+ stackTrail: StackTrail;
14
+ context: ParseContextType;
15
+ };
16
+ export declare const toDocumentFieldsV3: ({ documentObject, stackTrail, context }: ToDocumentV3Args) => DocumentFields;
@@ -0,0 +1,33 @@
1
+ import { toTagsV3 } from '../tag/toTagsV3.js';
2
+ import { toOperationsV3 } from '../operation/toOperationsV3.js';
3
+ import { toWebhooksV3 } from '../webhook/toWebhooksV3.js';
4
+ import { toComponentsV3 } from '../components/toComponentsV3.js';
5
+ import { toInfoV3 } from '../info/toInfoV3.js';
6
+ import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
7
+ import { toOptionalServersV3 } from '../server/toServerV3.js';
8
+ import { toSecurityRequirementsV3 } from '../securityRequirement/toSecurityRequirement.js';
9
+ import { toExternalDocs } from '../externalDocs/toExternalDocs.js';
10
+ export const toDocumentFieldsV3 = ({ documentObject, stackTrail, context }) => {
11
+ const { openapi, $self, info, paths, components, tags, servers, security, externalDocs, webhooks, ...skipped } = documentObject;
12
+ const extensionFields = toSpecificationExtensionsV3({
13
+ skipped,
14
+ parent: documentObject,
15
+ context,
16
+ stackTrail,
17
+ parentType: 'document'
18
+ });
19
+ return {
20
+ openapi,
21
+ $self,
22
+ info: stackTrail.trace('info', st => toInfoV3({ info, stackTrail: st, context })),
23
+ servers: stackTrail.trace('servers', st => toOptionalServersV3({ servers, stackTrail: st, context })),
24
+ operations: stackTrail.trace('paths', st => toOperationsV3({ paths, stackTrail: st, context })),
25
+ webhooks: stackTrail.trace('webhooks', st => toWebhooksV3({ webhooks, stackTrail: st, context })),
26
+ components: stackTrail.trace('components', st => toComponentsV3({ components, stackTrail: st, context })),
27
+ tags: stackTrail.trace('tags', st => toTagsV3({ tags, stackTrail: st, context })),
28
+ security: stackTrail.trace('security', st => toSecurityRequirementsV3({ security, stackTrail: st, context })),
29
+ extensionFields,
30
+ externalDocs: stackTrail.trace('externalDocs', st => toExternalDocs({ externalDocs, stackTrail: st, context }))
31
+ };
32
+ };
33
+ // stackTrail.trace('info', (x) => formatNumber(x))
@@ -0,0 +1,77 @@
1
+ import type { ParseContextType } from '../../../context/parseTypes.js';
2
+ import type { OpenAPIV3 } from 'openapi-types';
3
+ import { OasExample } from '../../../oas/example/Example.js';
4
+ import type { OasRef } from '../../../oas/ref/Ref.js';
5
+ import type { StackTrail } from '../../../context/StackTrail.js';
6
+ /** A 3.2 Example Object: the 3.0 shape plus `dataValue` and `serializedValue`. */
7
+ export type ExampleObjectV32 = OpenAPIV3.ExampleObject & {
8
+ dataValue?: unknown;
9
+ serializedValue?: string;
10
+ };
11
+ export type ToExampleSimpleV3Args = {
12
+ /**
13
+ * The example value itself. The singular `example` field of a media type,
14
+ * parameter or header is a LITERAL value — not an Example Object — so it
15
+ * carries no `summary`, `description` or `externalValue` to read.
16
+ */
17
+ example: unknown;
18
+ /** The stack trail for tracing */
19
+ stackTrail: StackTrail;
20
+ /** Parse context for tracing and error handling */
21
+ context: ParseContextType;
22
+ };
23
+ /**
24
+ * Creates a simple OAS example from a value.
25
+ *
26
+ * Wraps a literal example value as an {@link OasExample}. Used for the singular
27
+ * `example` field, where only the value exists.
28
+ *
29
+ * @param args - Arguments containing the example value
30
+ * @returns OasExample object with the provided value
31
+ */
32
+ export declare const toExampleSimpleV3: ({ example }: ToExampleSimpleV3Args) => OasExample | OasRef<"example">;
33
+ /**
34
+ * Arguments for processing OpenAPI v3 examples into OAS example objects.
35
+ *
36
+ * Handles both single example and examples collection scenarios,
37
+ * with context for tracing and error handling.
38
+ */
39
+ export type ToExamplesV3Args = {
40
+ /** The singular `example` field — a literal value, not an Example Object */
41
+ example: unknown;
42
+ /** Collection of named examples (OpenAPI v3 format) */
43
+ examples: Record<string, ExampleObjectV32 | OpenAPIV3.ReferenceObject> | undefined;
44
+ /** Key name for the example context */
45
+ exampleKey: string;
46
+ /** The stack trail for tracing */
47
+ stackTrail: StackTrail;
48
+ /** Parse context for tracing and error handling */
49
+ context: ParseContextType;
50
+ };
51
+ /**
52
+ * Processes OpenAPI v3 examples into OAS example objects.
53
+ *
54
+ * Handles both single example and examples collection scenarios,
55
+ * converting them to the internal OAS representation. Provides
56
+ * warnings when both formats are specified simultaneously.
57
+ *
58
+ * @param args - Arguments containing example data and context
59
+ * @returns Record of processed examples, or undefined if no examples
60
+ */
61
+ export declare const toExamplesV3: ({ example, examples, exampleKey, stackTrail, context }: ToExamplesV3Args) => Record<string, OasExample | OasRef<"example">> | undefined;
62
+ export type ToExampleV3Args = {
63
+ example: ExampleObjectV32 | OpenAPIV3.ReferenceObject;
64
+ stackTrail: StackTrail;
65
+ context: ParseContextType;
66
+ };
67
+ /**
68
+ * Processes a single OpenAPI v3 example into an OAS example object.
69
+ *
70
+ * Converts OpenAPI v3 example objects or references into the internal
71
+ * OAS representation, handling both direct examples and $ref references.
72
+ * Processes specification extensions and maintains all example metadata.
73
+ *
74
+ * @param args - Arguments containing the example and parsing context
75
+ * @returns OasExample object or reference to an example
76
+ */
77
+ export declare const toExampleV3: ({ example, stackTrail, context }: ToExampleV3Args) => OasExample | OasRef<"example">;
@@ -0,0 +1,143 @@
1
+ import { isRef } from '../../../helpers/refFns.js';
2
+ import { toRefV31 } from '../ref/toRefV31.js';
3
+ import { OasExample } from '../../../oas/example/Example.js';
4
+ import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
5
+ /**
6
+ * Creates a simple OAS example from a value.
7
+ *
8
+ * Wraps a literal example value as an {@link OasExample}. Used for the singular
9
+ * `example` field, where only the value exists.
10
+ *
11
+ * @param args - Arguments containing the example value
12
+ * @returns OasExample object with the provided value
13
+ */
14
+ export const toExampleSimpleV3 = ({ example }) => {
15
+ const fields = { value: example };
16
+ return new OasExample(fields);
17
+ };
18
+ /**
19
+ * Processes OpenAPI v3 examples into OAS example objects.
20
+ *
21
+ * Handles both single example and examples collection scenarios,
22
+ * converting them to the internal OAS representation. Provides
23
+ * warnings when both formats are specified simultaneously.
24
+ *
25
+ * @param args - Arguments containing example data and context
26
+ * @returns Record of processed examples, or undefined if no examples
27
+ */
28
+ export const toExamplesV3 = ({ example, examples, exampleKey, stackTrail, context }) => {
29
+ // An empty map is declared but carries nothing, so it cannot be the richer
30
+ // field — letting it win would discard the singular in favour of no examples
31
+ // at all.
32
+ const namedExamples = examples && Object.keys(examples).length > 0 ? examples : undefined;
33
+ // `example` is a literal, so test presence rather than truthiness — `false`,
34
+ // `0` and `''` are all valid example values.
35
+ if (example !== undefined && examples !== undefined) {
36
+ context.logIssue({
37
+ key: 'example',
38
+ level: 'warning',
39
+ message: `Both example and examples are defined for ${exampleKey}; using ${namedExamples ? 'examples' : 'example'}`,
40
+ parent: examples,
41
+ stackTrail,
42
+ type: 'EXAMPLE_AND_EXAMPLES_DEFINED'
43
+ });
44
+ }
45
+ // The spec makes the two mutually exclusive, so reaching here with both is
46
+ // malformed input. Prefer `examples`: it is the richer field — many entries,
47
+ // each with a summary and description — and the singular carries nothing it
48
+ // cannot express, so this discards strictly less.
49
+ if (namedExamples) {
50
+ return stackTrail.trace('examples', st => {
51
+ const output = {};
52
+ const entries = Object.entries(namedExamples);
53
+ for (const [key, value] of entries) {
54
+ output[key] = st.trace(key, st2 => toExampleV3({ example: value, stackTrail: st2, context }));
55
+ }
56
+ return output;
57
+ });
58
+ }
59
+ if (example !== undefined) {
60
+ return {
61
+ [exampleKey]: stackTrail.trace('example', st => toExampleSimpleV3({ example, stackTrail: st, context }))
62
+ };
63
+ }
64
+ return undefined;
65
+ };
66
+ /**
67
+ * Processes a single OpenAPI v3 example into an OAS example object.
68
+ *
69
+ * Converts OpenAPI v3 example objects or references into the internal
70
+ * OAS representation, handling both direct examples and $ref references.
71
+ * Processes specification extensions and maintains all example metadata.
72
+ *
73
+ * @param args - Arguments containing the example and parsing context
74
+ * @returns OasExample object or reference to an example
75
+ */
76
+ export const toExampleV3 = ({ example, stackTrail, context }) => {
77
+ if (isRef(example)) {
78
+ return toRefV31({ ref: example, refType: 'example', stackTrail, context });
79
+ }
80
+ // `externalValue` is the alternative to `value` — an example too large or too
81
+ // awkward to inline. Leaving it in `skipped` both loses it and reports a
82
+ // standard field as an unexpected property.
83
+ const { summary, description, value, dataValue, serializedValue, externalValue, ...skipped } = example;
84
+ const extensionFields = toSpecificationExtensionsV3({
85
+ skipped,
86
+ parent: example,
87
+ context,
88
+ stackTrail,
89
+ parentType: 'example'
90
+ });
91
+ const kept = toKeptValueFields({
92
+ present: { dataValue, value, serializedValue, externalValue },
93
+ example,
94
+ stackTrail,
95
+ context
96
+ });
97
+ return new OasExample({
98
+ summary,
99
+ description,
100
+ value: kept.has('value') ? value : undefined,
101
+ dataValue: kept.has('dataValue') ? dataValue : undefined,
102
+ serializedValue: kept.has('serializedValue') ? serializedValue : undefined,
103
+ externalValue: kept.has('externalValue') ? externalValue : undefined,
104
+ extensionFields
105
+ });
106
+ };
107
+ /** The value fields in the order they are kept when two conflict. */
108
+ const valueFieldPrecedence = [
109
+ 'dataValue',
110
+ 'value',
111
+ 'serializedValue',
112
+ 'externalValue'
113
+ ];
114
+ /** The fields the 3.2 spec forbids next to each value field. */
115
+ const valueFieldExclusions = {
116
+ dataValue: ['value'],
117
+ value: ['dataValue', 'serializedValue', 'externalValue'],
118
+ serializedValue: ['value', 'externalValue'],
119
+ externalValue: ['value', 'serializedValue']
120
+ };
121
+ /**
122
+ * Picks the value fields to keep. A field that conflicts with one already
123
+ * kept is logged as `INVALID_EXAMPLE` and dropped.
124
+ */
125
+ const toKeptValueFields = ({ present, example, stackTrail, context }) => {
126
+ return valueFieldPrecedence
127
+ .filter(field => present[field] !== undefined)
128
+ .reduce((kept, field) => {
129
+ const conflict = valueFieldExclusions[field].find(other => kept.has(other));
130
+ if (conflict === undefined) {
131
+ return new Set([...kept, field]);
132
+ }
133
+ context.logIssue({
134
+ key: field,
135
+ level: 'warning',
136
+ message: `Example has both '${conflict}' and '${field}', which are mutually exclusive; keeping '${conflict}'`,
137
+ parent: example,
138
+ stackTrail,
139
+ type: 'INVALID_EXAMPLE'
140
+ });
141
+ return kept;
142
+ }, new Set());
143
+ };
@@ -0,0 +1,10 @@
1
+ import { OasExternalDocs } from '../../../oas/externalDocs/ExternalDocs.js';
2
+ import type { OpenAPIV3 } from 'openapi-types';
3
+ import type { ParseContextType } from '../../../context/parseTypes.js';
4
+ import type { StackTrail } from '../../../context/StackTrail.js';
5
+ export type ToExternalDocsArgs = {
6
+ externalDocs: OpenAPIV3.ExternalDocumentationObject | undefined;
7
+ stackTrail: StackTrail;
8
+ context: ParseContextType;
9
+ };
10
+ export declare const toExternalDocs: ({ externalDocs, stackTrail }: ToExternalDocsArgs) => OasExternalDocs | undefined;
@@ -0,0 +1,15 @@
1
+ import { OasExternalDocs } from '../../../oas/externalDocs/ExternalDocs.js';
2
+ import * as v from 'valibot';
3
+ import { oasExternalDocsData } from '../../../oas/externalDocs/externalDocsTypes.js';
4
+ export const toExternalDocs = ({ externalDocs, stackTrail }) => {
5
+ if (!externalDocs) {
6
+ return undefined;
7
+ }
8
+ if (!v.is(oasExternalDocsData, externalDocs)) {
9
+ v.parse(oasExternalDocsData, externalDocs);
10
+ }
11
+ return new OasExternalDocs({
12
+ url: externalDocs.url,
13
+ description: externalDocs.description
14
+ });
15
+ };
@@ -0,0 +1,18 @@
1
+ import type { ParseContextType } from '../../../context/parseTypes.js';
2
+ import type { OpenAPIV3 } from 'openapi-types';
3
+ import { OasHeader } from '../../../oas/header/Header.js';
4
+ import type { OasRef } from '../../../oas/ref/Ref.js';
5
+ import type { StackTrail } from '../../../context/StackTrail.js';
6
+ export type ToHeadersV3Args = {
7
+ headers: Record<string, OpenAPIV3.ReferenceObject | OpenAPIV3.HeaderObject> | undefined;
8
+ stackTrail: StackTrail;
9
+ context: ParseContextType;
10
+ };
11
+ export declare const toHeadersV3: ({ headers, stackTrail, context }: ToHeadersV3Args) => Record<string, OasHeader | OasRef<"header">> | undefined;
12
+ export type ToHeaderV3Args = {
13
+ header: OpenAPIV3.ReferenceObject | OpenAPIV3.HeaderObject;
14
+ /** The header's name, used to key a singular `example` */
15
+ name: string;
16
+ stackTrail: StackTrail;
17
+ context: ParseContextType;
18
+ };