@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,152 @@
1
+ import { OasHttpSecurityScheme, OasApiKeySecurityScheme, OasOAuth2SecurityScheme, OasOpenIdSecurityScheme } from '../../../oas/securitySchemes/SecurityScheme.js';
2
+ import * as v from 'valibot';
3
+ import { oasApiKeySecuritySchemeData, oasHttpSecuritySchemeData, oasOAuth2FlowsData, oasOAuth2SecuritySchemeData, oasOpenIdSecuritySchemeData } from '../../../oas/securitySchemes/security-scheme-types.js';
4
+ import { toRefV31 } from '../ref/toRefV31.js';
5
+ import { isRef } from '../../../helpers/refFns.js';
6
+ import { tryParseAt } from '../../../context/tryParseAt.js';
7
+ import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
8
+ // The shared schemas are the 3.0/3.1 shape; these add the 3.2 fields.
9
+ const deprecatedField = v.optional(v.boolean());
10
+ const httpSecuritySchemeData = v.object({
11
+ ...oasHttpSecuritySchemeData.entries,
12
+ deprecated: deprecatedField
13
+ });
14
+ const apiKeySecuritySchemeData = v.object({
15
+ ...oasApiKeySecuritySchemeData.entries,
16
+ deprecated: deprecatedField
17
+ });
18
+ const deviceAuthorizationOAuth2FlowData = v.object({
19
+ deviceAuthorizationUrl: v.string(),
20
+ tokenUrl: v.string(),
21
+ refreshUrl: v.optional(v.string()),
22
+ scopes: v.optional(v.record(v.string(), v.string()))
23
+ });
24
+ const oAuth2FlowsData = v.object({
25
+ ...oasOAuth2FlowsData.entries,
26
+ deviceAuthorization: v.optional(deviceAuthorizationOAuth2FlowData)
27
+ });
28
+ const oAuth2SecuritySchemeData = v.object({
29
+ ...oasOAuth2SecuritySchemeData.entries,
30
+ deprecated: deprecatedField,
31
+ oauth2MetadataUrl: v.optional(v.string()),
32
+ flows: oAuth2FlowsData
33
+ });
34
+ const openIdSecuritySchemeData = v.object({
35
+ ...oasOpenIdSecuritySchemeData.entries,
36
+ deprecated: deprecatedField
37
+ });
38
+ export const toSecuritySchemesV3 = ({ securitySchemes, stackTrail, context }) => {
39
+ if (!securitySchemes) {
40
+ return undefined;
41
+ }
42
+ const output = {};
43
+ for (const [key, value] of Object.entries(securitySchemes)) {
44
+ // Isolate per scheme: a single malformed security scheme is logged and
45
+ // skipped, the rest of the record continues (parity with toSchemasV3).
46
+ const parsed = tryParseAt({
47
+ stackTrail,
48
+ key,
49
+ context,
50
+ type: 'INVALID_SECURITY_SCHEME',
51
+ parent: value,
52
+ fn: st => toSecuritySchemeV3({ securityScheme: value, stackTrail: st, context })
53
+ });
54
+ if (parsed !== undefined) {
55
+ output[key] = parsed;
56
+ }
57
+ }
58
+ return output;
59
+ };
60
+ /**
61
+ * Log the keys of `value` that `known` does not name as skipped fields.
62
+ * `v.parse` on a `v.object` schema strips unknown keys, so they are read
63
+ * off the raw object. `x-` extensions are not logged.
64
+ */
65
+ const logSkippedKeys = ({ value, known, parentType, stackTrail, context }) => {
66
+ const skipped = Object.fromEntries(Object.entries(value).filter(([key]) => !Object.hasOwn(known, key)));
67
+ toSpecificationExtensionsV3({ skipped, parent: value, parentType, stackTrail, context });
68
+ };
69
+ const toSecuritySchemeV3 = ({ securityScheme, stackTrail, context }) => {
70
+ if (isRef(securityScheme)) {
71
+ return toRefV31({ ref: securityScheme, refType: 'securityScheme', stackTrail, context });
72
+ }
73
+ switch (securityScheme.type) {
74
+ case 'http': {
75
+ const { description, deprecated, scheme, bearerFormat } = v.parse(httpSecuritySchemeData, securityScheme);
76
+ logSkippedKeys({
77
+ value: securityScheme,
78
+ known: httpSecuritySchemeData.entries,
79
+ parentType: 'securityScheme:http',
80
+ stackTrail,
81
+ context
82
+ });
83
+ return new OasHttpSecurityScheme({
84
+ description,
85
+ deprecated,
86
+ scheme,
87
+ bearerFormat
88
+ });
89
+ }
90
+ case 'apiKey': {
91
+ const { in: location, description, deprecated, name } = v.parse(apiKeySecuritySchemeData, securityScheme);
92
+ logSkippedKeys({
93
+ value: securityScheme,
94
+ known: apiKeySecuritySchemeData.entries,
95
+ parentType: 'securityScheme:apiKey',
96
+ stackTrail,
97
+ context
98
+ });
99
+ return new OasApiKeySecurityScheme({
100
+ description,
101
+ deprecated,
102
+ name,
103
+ in: location
104
+ });
105
+ }
106
+ case 'oauth2': {
107
+ const { flows, description, deprecated, oauth2MetadataUrl } = v.parse(oAuth2SecuritySchemeData, securityScheme);
108
+ logSkippedKeys({
109
+ value: securityScheme,
110
+ known: oAuth2SecuritySchemeData.entries,
111
+ parentType: 'securityScheme:oauth2',
112
+ stackTrail,
113
+ context
114
+ });
115
+ stackTrail.trace('flows', st => logSkippedKeys({
116
+ value: securityScheme.flows,
117
+ known: oAuth2FlowsData.entries,
118
+ parentType: 'oauthFlows',
119
+ stackTrail: st,
120
+ context
121
+ }));
122
+ return new OasOAuth2SecurityScheme({
123
+ description,
124
+ deprecated,
125
+ oauth2MetadataUrl,
126
+ flows
127
+ });
128
+ }
129
+ case 'openIdConnect': {
130
+ const { description, deprecated, openIdConnectUrl } = v.parse(openIdSecuritySchemeData, securityScheme);
131
+ logSkippedKeys({
132
+ value: securityScheme,
133
+ known: openIdSecuritySchemeData.entries,
134
+ parentType: 'securityScheme:openIdConnect',
135
+ stackTrail,
136
+ context
137
+ });
138
+ return new OasOpenIdSecurityScheme({
139
+ description,
140
+ deprecated,
141
+ openIdConnectUrl
142
+ });
143
+ }
144
+ default: {
145
+ // Exhaustive over the discriminated union: a value reaching here has a
146
+ // `type` outside the OpenAPI set. `tryParseAt` isolates the throw to
147
+ // this one scheme.
148
+ const _exhaustiveCheck = securityScheme;
149
+ throw new Error(`Unknown security scheme type: ${JSON.stringify(_exhaustiveCheck)}`);
150
+ }
151
+ }
152
+ };
@@ -0,0 +1,26 @@
1
+ import type { ParseContextType } from '../../../context/parseTypes.js';
2
+ import type { OpenAPIV3 } from 'openapi-types';
3
+ import { OasServer } from '../../../oas/server/Server.js';
4
+ import type { StackTrail } from '../../../context/StackTrail.js';
5
+ /** A 3.2 Server Object: the 3.0 shape plus `name`. */
6
+ export type ServerObjectV32 = OpenAPIV3.ServerObject & {
7
+ name?: string;
8
+ };
9
+ export type ToServersV3Args = {
10
+ servers: ServerObjectV32[];
11
+ stackTrail: StackTrail;
12
+ context: ParseContextType;
13
+ };
14
+ export declare const toServersV3: ({ servers, stackTrail, context }: ToServersV3Args) => OasServer[];
15
+ export type ToOptionalServersV3Args = {
16
+ servers: ServerObjectV32[] | undefined;
17
+ stackTrail: StackTrail;
18
+ context: ParseContextType;
19
+ };
20
+ export declare const toOptionalServersV3: ({ servers, stackTrail, context }: ToOptionalServersV3Args) => OasServer[] | undefined;
21
+ export type ToServerV3Args = {
22
+ server: ServerObjectV32;
23
+ stackTrail: StackTrail;
24
+ context: ParseContextType;
25
+ };
26
+ export declare const toServerV3: ({ server, stackTrail, context }: ToServerV3Args) => OasServer;
@@ -0,0 +1,31 @@
1
+ import { OasServer } from '../../../oas/server/Server.js';
2
+ import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
3
+ import { toOptionalServerVariablesV3 } from '../serverVariable/toServerVariableV3.js';
4
+ export const toServersV3 = ({ servers, stackTrail, context }) => {
5
+ return servers.map((server, index) => {
6
+ return stackTrail.trace(server.url ?? index, st => toServerV3({ server, stackTrail: st, context }));
7
+ });
8
+ };
9
+ export const toOptionalServersV3 = ({ servers, stackTrail, context }) => {
10
+ if (!servers) {
11
+ return undefined;
12
+ }
13
+ return toServersV3({ servers, stackTrail, context });
14
+ };
15
+ export const toServerV3 = ({ server, stackTrail, context }) => {
16
+ const { description, name, url, variables, ...skipped } = server;
17
+ const extensionFields = toSpecificationExtensionsV3({
18
+ skipped,
19
+ parent: server,
20
+ context,
21
+ stackTrail,
22
+ parentType: 'server'
23
+ });
24
+ return new OasServer({
25
+ description,
26
+ name,
27
+ url,
28
+ variables: toOptionalServerVariablesV3({ serverVariables: variables, stackTrail, context }),
29
+ extensionFields
30
+ });
31
+ };
@@ -0,0 +1,22 @@
1
+ import type { ParseContextType } from '../../../context/parseTypes.js';
2
+ import type { OpenAPIV3 } from 'openapi-types';
3
+ import { OasServerVariable } from '../../../oas/serverVariable/ServerVariable.js';
4
+ import type { StackTrail } from '../../../context/StackTrail.js';
5
+ export type ToServerVariablesV3Args = {
6
+ serverVariables: Record<string, OpenAPIV3.ServerVariableObject>;
7
+ stackTrail: StackTrail;
8
+ context: ParseContextType;
9
+ };
10
+ export declare const toServerVariablesV3: ({ serverVariables, stackTrail, context }: ToServerVariablesV3Args) => Record<string, OasServerVariable>;
11
+ export type ToOptionalServerVariablesV3Args = {
12
+ serverVariables: Record<string, OpenAPIV3.ServerVariableObject> | undefined;
13
+ stackTrail: StackTrail;
14
+ context: ParseContextType;
15
+ };
16
+ export declare const toOptionalServerVariablesV3: ({ serverVariables, stackTrail, context }: ToOptionalServerVariablesV3Args) => Record<string, OasServerVariable> | undefined;
17
+ export type ToServerVariableV3Args = {
18
+ serverVariable: OpenAPIV3.ServerVariableObject;
19
+ stackTrail: StackTrail;
20
+ context: ParseContextType;
21
+ };
22
+ export declare const toServerVariableV3: ({ serverVariable, stackTrail, context }: ToServerVariableV3Args) => OasServerVariable;
@@ -0,0 +1,30 @@
1
+ import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
2
+ import { OasServerVariable } from '../../../oas/serverVariable/ServerVariable.js';
3
+ export const toServerVariablesV3 = ({ serverVariables, stackTrail, context }) => {
4
+ return Object.fromEntries(Object.entries(serverVariables).map(([key, serverVariable]) => [
5
+ key,
6
+ toServerVariableV3({ serverVariable, stackTrail, context })
7
+ ]));
8
+ };
9
+ export const toOptionalServerVariablesV3 = ({ serverVariables, stackTrail, context }) => {
10
+ if (!serverVariables) {
11
+ return undefined;
12
+ }
13
+ return toServerVariablesV3({ serverVariables, stackTrail, context });
14
+ };
15
+ export const toServerVariableV3 = ({ serverVariable, stackTrail, context }) => {
16
+ const { description, default: defaultValue, enum: enums, ...skipped } = serverVariable;
17
+ const extensionFields = toSpecificationExtensionsV3({
18
+ skipped,
19
+ parent: serverVariable,
20
+ context,
21
+ stackTrail,
22
+ parentType: 'serverVariable'
23
+ });
24
+ return new OasServerVariable({
25
+ description,
26
+ default: defaultValue,
27
+ enums,
28
+ extensionFields
29
+ });
30
+ };
@@ -0,0 +1,14 @@
1
+ import type { ParseContextType } from '../../../context/parseTypes.js';
2
+ import type { StackTrail } from '../../../context/StackTrail.js';
3
+ export type ToSpecificationExtensionsV3Args = {
4
+ skipped: Record<string, unknown>;
5
+ parent: unknown;
6
+ parentType: string;
7
+ stackTrail: StackTrail;
8
+ context: ParseContextType;
9
+ };
10
+ export declare const toSpecificationExtensionsV3: ({ skipped: s, parent, parentType, stackTrail, context }: ToSpecificationExtensionsV3Args) => Record<string, unknown> | undefined;
11
+ export declare const extractExtensions: (item: Record<string, unknown>) => {
12
+ skipped: Record<string, unknown> | undefined;
13
+ extensionFields: Record<string, unknown> | undefined;
14
+ };
@@ -0,0 +1,25 @@
1
+ import { isEmpty } from '../../../helpers/isEmpty.js';
2
+ export const toSpecificationExtensionsV3 = ({ skipped: s, parent, parentType, stackTrail, context }) => {
3
+ const { skipped, extensionFields } = extractExtensions(s);
4
+ if (skipped) {
5
+ context.logSkippedFields({ skipped, parent, stackTrail, parentType });
6
+ }
7
+ return extensionFields;
8
+ };
9
+ export const extractExtensions = (item) => {
10
+ const entries = Object.entries(item);
11
+ const skipped = {};
12
+ const extensionFields = {};
13
+ for (const [key, value] of entries) {
14
+ if (!key.startsWith('x-')) {
15
+ skipped[key] = value;
16
+ }
17
+ else {
18
+ extensionFields[key] = value;
19
+ }
20
+ }
21
+ return {
22
+ skipped: isEmpty(skipped) ? undefined : skipped,
23
+ extensionFields: isEmpty(extensionFields) ? undefined : extensionFields
24
+ };
25
+ };
@@ -0,0 +1,146 @@
1
+ import type { OpenAPIV3 } from 'openapi-types';
2
+ import type { ParseContextType } from '../../../context/parseTypes.js';
3
+ import { OasString } from '../../../oas/string/String.js';
4
+ import type { StackTrail } from '../../../context/StackTrail.js';
5
+ /**
6
+ * Arguments for transforming an OpenAPI string schema into OAS representation.
7
+ */
8
+ export type ToStringArgs = {
9
+ /** The OpenAPI v3 schema object to transform (must be type 'string') */
10
+ value: OpenAPIV3.SchemaObject;
11
+ /** The stack trail for tracing */
12
+ stackTrail: StackTrail;
13
+ /** Parse context providing utilities and tracing capabilities */
14
+ context: ParseContextType;
15
+ };
16
+ /**
17
+ * Transforms an OpenAPI v3 string schema object into an internal OAS string representation.
18
+ *
19
+ * This function processes OpenAPI string schemas by extracting and parsing nullable values,
20
+ * examples, enumerations, and default values. It handles the complete transformation from
21
+ * raw OpenAPI JSON to the SKMTC internal string representation with proper validation
22
+ * of string formats and constraints.
23
+ *
24
+ * The transformation follows a pipeline approach:
25
+ * 1. Parse nullable flag and extract base value
26
+ * 2. Parse example values with nullable support
27
+ * 3. Parse enumeration constraints
28
+ * 4. Parse default values
29
+ * 5. Create final OasString instance with format validation
30
+ *
31
+ * @param args - Transformation arguments
32
+ * @param args.context - Parse context providing utilities and tracing
33
+ * @param args.value - The OpenAPI v3 string schema object to transform
34
+ * @returns Transformed OAS string object with parsed properties
35
+ *
36
+ * @example Basic string transformation
37
+ * ```typescript
38
+ * import { toString } from '@skmtc/core';
39
+ *
40
+ * const openApiString = {
41
+ * type: 'string',
42
+ * format: 'email',
43
+ * maxLength: 255,
44
+ * pattern: '^[\\w.-]+@[\\w.-]+\\.[a-zA-Z]{2,}$'
45
+ * };
46
+ *
47
+ * const oasString = toString({
48
+ * context: parseContext,
49
+ * value: openApiString
50
+ * });
51
+ *
52
+ * console.log(oasString.format); // 'email'
53
+ * console.log(oasString.maxLength); // 255
54
+ * ```
55
+ *
56
+ * @example String with nullable and enums
57
+ * ```typescript
58
+ * const statusString = {
59
+ * type: 'string',
60
+ * nullable: true,
61
+ * enum: ['active', 'inactive', 'pending', null],
62
+ * default: 'active',
63
+ * example: 'pending'
64
+ * };
65
+ *
66
+ * const oasString = toString({
67
+ * context: parseContext,
68
+ * value: statusString
69
+ * });
70
+ *
71
+ * console.log(oasString.nullable); // true
72
+ * console.log(oasString.enums); // ['active', 'inactive', 'pending', null]
73
+ * ```
74
+ */
75
+ export declare const toString: ({ context, value, stackTrail }: ToStringArgs) => OasString;
76
+ type ToParsedStringArgs<Nullable extends boolean | undefined> = {
77
+ value: Omit<OpenAPIV3.SchemaObject, 'nullable' | 'example' | 'enums' | 'default'>;
78
+ context: ParseContextType;
79
+ nullable: Nullable;
80
+ example: Nullable extends true ? string | null | undefined : string | undefined;
81
+ enums: Nullable extends true ? (string | null)[] | undefined : string[] | undefined;
82
+ defaultValue: Nullable extends true ? string | null | undefined : string | undefined;
83
+ stackTrail: StackTrail;
84
+ };
85
+ /**
86
+ * Creates an OAS string instance from pre-parsed string schema components.
87
+ *
88
+ * This function is the final step in the string transformation pipeline, taking
89
+ * already-parsed nullable, example, enum, and default values and combining them
90
+ * with the remaining string properties to create the complete OasString instance.
91
+ *
92
+ * The function handles format validation against known OpenAPI string formats,
93
+ * length constraints parsing, pattern validation, and specification extension
94
+ * processing. It logs warnings for unrecognized formats while still preserving
95
+ * them in the output.
96
+ *
97
+ * @template Nullable - Boolean type indicating if the string can be null
98
+ * @param args - Pre-parsed string components
99
+ * @param args.context - Parse context for tracing and issue logging
100
+ * @param args.nullable - Parsed nullable flag
101
+ * @param args.example - Parsed example value (type-safe with nullable)
102
+ * @param args.enums - Parsed enumeration constraints (type-safe with nullable)
103
+ * @param args.defaultValue - Parsed default value (type-safe with nullable)
104
+ * @param args.value - OpenAPI string object without parsed fields
105
+ * @returns Complete OAS string instance with all properties and validation
106
+ *
107
+ * @example Date-time string with validation
108
+ * ```typescript
109
+ * const dateTimeString = toParsedString({
110
+ * context: parseContext,
111
+ * nullable: false,
112
+ * example: '2023-12-25T10:00:00Z',
113
+ * enums: undefined,
114
+ * defaultValue: undefined,
115
+ * value: {
116
+ * type: 'string',
117
+ * format: 'date-time',
118
+ * title: 'Event Date',
119
+ * description: 'When the event occurs'
120
+ * }
121
+ * });
122
+ *
123
+ * console.log(dateTimeString.format); // 'date-time'
124
+ * ```
125
+ *
126
+ * @example String with custom format (generates warning)
127
+ * ```typescript
128
+ * const customFormatString = toParsedString({
129
+ * context: parseContext,
130
+ * nullable: false,
131
+ * example: 'ABC123',
132
+ * enums: undefined,
133
+ * defaultValue: undefined,
134
+ * value: {
135
+ * type: 'string',
136
+ * format: 'custom-id', // Unknown format, will log warning
137
+ * pattern: '^[A-Z]{3}[0-9]{3}$'
138
+ * }
139
+ * });
140
+ *
141
+ * // Logs: "Unexpected format: custom-id"
142
+ * console.log(customFormatString.format); // 'custom-id' (still preserved)
143
+ * ```
144
+ */
145
+ export declare const toParsedString: <Nullable extends boolean | undefined>({ context, nullable, example, enums, defaultValue, value, stackTrail }: ToParsedStringArgs<Nullable>) => OasString<Nullable>;
146
+ export {};
@@ -0,0 +1,211 @@
1
+ import { OasString } from '../../../oas/string/String.js';
2
+ import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
3
+ import { oasStringData } from '../../../oas/string/string-types.js';
4
+ import * as v from 'valibot';
5
+ import { parseNullable } from '../_helpers/parseNullable.js';
6
+ import { parseEnum } from '../_helpers/parseEnum.js';
7
+ import { parseExample } from '../_helpers/parseExample.js';
8
+ import { parseDefault } from '../_helpers/parseDefault.js';
9
+ /**
10
+ * Transforms an OpenAPI v3 string schema object into an internal OAS string representation.
11
+ *
12
+ * This function processes OpenAPI string 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 string representation with proper validation
15
+ * of string formats and constraints.
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
21
+ * 4. Parse default values
22
+ * 5. Create final OasString instance with format validation
23
+ *
24
+ * @param args - Transformation arguments
25
+ * @param args.context - Parse context providing utilities and tracing
26
+ * @param args.value - The OpenAPI v3 string schema object to transform
27
+ * @returns Transformed OAS string object with parsed properties
28
+ *
29
+ * @example Basic string transformation
30
+ * ```typescript
31
+ * import { toString } from '@skmtc/core';
32
+ *
33
+ * const openApiString = {
34
+ * type: 'string',
35
+ * format: 'email',
36
+ * maxLength: 255,
37
+ * pattern: '^[\\w.-]+@[\\w.-]+\\.[a-zA-Z]{2,}$'
38
+ * };
39
+ *
40
+ * const oasString = toString({
41
+ * context: parseContext,
42
+ * value: openApiString
43
+ * });
44
+ *
45
+ * console.log(oasString.format); // 'email'
46
+ * console.log(oasString.maxLength); // 255
47
+ * ```
48
+ *
49
+ * @example String with nullable and enums
50
+ * ```typescript
51
+ * const statusString = {
52
+ * type: 'string',
53
+ * nullable: true,
54
+ * enum: ['active', 'inactive', 'pending', null],
55
+ * default: 'active',
56
+ * example: 'pending'
57
+ * };
58
+ *
59
+ * const oasString = toString({
60
+ * context: parseContext,
61
+ * value: statusString
62
+ * });
63
+ *
64
+ * console.log(oasString.nullable); // true
65
+ * console.log(oasString.enums); // ['active', 'inactive', 'pending', null]
66
+ * ```
67
+ */
68
+ export const toString = ({ context, value, stackTrail }) => {
69
+ if (value.type === 'string' && Object.keys(value).length === 1) {
70
+ return context.withStackTrail(stackTrail, () => new OasString({}, context));
71
+ }
72
+ const { nullable, value: valueWithoutNullable } = parseNullable({
73
+ value,
74
+ context,
75
+ stackTrail
76
+ });
77
+ const { example: unparsedExample, ...valueWithoutExample } = valueWithoutNullable;
78
+ const example = parseExample({
79
+ value: unparsedExample,
80
+ context,
81
+ parent: valueWithoutNullable,
82
+ nullable,
83
+ check: isString,
84
+ toMessage: item => `Removed invalid example. Expected "string", got: ${item}`,
85
+ stackTrail
86
+ });
87
+ const { enum: unparsedEnums, ...valueWithoutEnums } = valueWithoutExample;
88
+ const enums = parseEnum({
89
+ value: unparsedEnums,
90
+ nullable,
91
+ parent: valueWithoutExample,
92
+ context,
93
+ check: isString,
94
+ toMessage: item => `Removed invalid enum. Expected "string", got: ${item}`,
95
+ stackTrail
96
+ });
97
+ const { default: unparsedDefaultValue, ...valueWithoutDefault } = valueWithoutEnums;
98
+ const defaultValue = parseDefault({
99
+ value: unparsedDefaultValue,
100
+ context,
101
+ parent: valueWithoutEnums,
102
+ nullable,
103
+ check: isString,
104
+ toMessage: item => `Removed invalid default. Expected "string", got: ${item}`,
105
+ stackTrail
106
+ });
107
+ return toParsedString({
108
+ context,
109
+ nullable,
110
+ example,
111
+ enums,
112
+ defaultValue,
113
+ value: valueWithoutDefault,
114
+ stackTrail
115
+ });
116
+ };
117
+ /**
118
+ * Creates an OAS string instance from pre-parsed string schema components.
119
+ *
120
+ * This function is the final step in the string transformation pipeline, taking
121
+ * already-parsed nullable, example, enum, and default values and combining them
122
+ * with the remaining string properties to create the complete OasString instance.
123
+ *
124
+ * The function handles format validation against known OpenAPI string formats,
125
+ * length constraints parsing, pattern validation, and specification extension
126
+ * processing. It logs warnings for unrecognized formats while still preserving
127
+ * them in the output.
128
+ *
129
+ * @template Nullable - Boolean type indicating if the string can be null
130
+ * @param args - Pre-parsed string components
131
+ * @param args.context - Parse context for tracing and issue logging
132
+ * @param args.nullable - Parsed nullable flag
133
+ * @param args.example - Parsed example value (type-safe with nullable)
134
+ * @param args.enums - Parsed enumeration constraints (type-safe with nullable)
135
+ * @param args.defaultValue - Parsed default value (type-safe with nullable)
136
+ * @param args.value - OpenAPI string object without parsed fields
137
+ * @returns Complete OAS string instance with all properties and validation
138
+ *
139
+ * @example Date-time string with validation
140
+ * ```typescript
141
+ * const dateTimeString = toParsedString({
142
+ * context: parseContext,
143
+ * nullable: false,
144
+ * example: '2023-12-25T10:00:00Z',
145
+ * enums: undefined,
146
+ * defaultValue: undefined,
147
+ * value: {
148
+ * type: 'string',
149
+ * format: 'date-time',
150
+ * title: 'Event Date',
151
+ * description: 'When the event occurs'
152
+ * }
153
+ * });
154
+ *
155
+ * console.log(dateTimeString.format); // 'date-time'
156
+ * ```
157
+ *
158
+ * @example String with custom format (generates warning)
159
+ * ```typescript
160
+ * const customFormatString = toParsedString({
161
+ * context: parseContext,
162
+ * nullable: false,
163
+ * example: 'ABC123',
164
+ * enums: undefined,
165
+ * defaultValue: undefined,
166
+ * value: {
167
+ * type: 'string',
168
+ * format: 'custom-id', // Unknown format, will log warning
169
+ * pattern: '^[A-Z]{3}[0-9]{3}$'
170
+ * }
171
+ * });
172
+ *
173
+ * // Logs: "Unexpected format: custom-id"
174
+ * console.log(customFormatString.format); // 'custom-id' (still preserved)
175
+ * ```
176
+ */
177
+ export const toParsedString = ({ context, nullable, example, enums, defaultValue, value, stackTrail }) => {
178
+ if (!v.is(oasStringData, value)) {
179
+ v.parse(oasStringData, value);
180
+ }
181
+ const { type: _type, title, description, format, maxLength, minLength, pattern, readOnly, writeOnly, deprecated, ...skipped } = value;
182
+ const extensionFields = toSpecificationExtensionsV3({
183
+ skipped,
184
+ parent: value,
185
+ context,
186
+ stackTrail,
187
+ parentType: 'schema:string'
188
+ });
189
+ // `format` is an open vocabulary — custom string formats (e.g. `decimal`,
190
+ // `utc_datetime`) are spec-legal. The value is preserved on the OasString
191
+ // below, so an unrecognised format is passed through, not warned.
192
+ return context.withStackTrail(stackTrail, () => new OasString({
193
+ title,
194
+ description,
195
+ enums,
196
+ nullable,
197
+ example,
198
+ format,
199
+ maxLength,
200
+ minLength,
201
+ pattern,
202
+ readOnly,
203
+ writeOnly,
204
+ default: defaultValue,
205
+ extensionFields,
206
+ deprecated
207
+ }, context));
208
+ };
209
+ const isString = (value) => {
210
+ return typeof value === 'string';
211
+ };
@@ -0,0 +1,22 @@
1
+ import type { OpenAPIV3 } from 'openapi-types';
2
+ import type { ParseContextType } from '../../../context/parseTypes.js';
3
+ import { OasTag } from '../../../oas/tag/Tag.js';
4
+ import type { StackTrail } from '../../../context/StackTrail.js';
5
+ /** A 3.2 Tag Object: the 3.0 shape plus `summary`, `parent` and `kind`. */
6
+ export type TagObjectV32 = OpenAPIV3.TagObject & {
7
+ summary?: string;
8
+ parent?: string;
9
+ kind?: string;
10
+ };
11
+ export type ToTagsV3Args = {
12
+ tags: TagObjectV32[] | undefined;
13
+ stackTrail: StackTrail;
14
+ context: ParseContextType;
15
+ };
16
+ export declare const toTagsV3: ({ tags, stackTrail, context }: ToTagsV3Args) => OasTag[] | undefined;
17
+ export type ToTagV3Args = {
18
+ tag: TagObjectV32;
19
+ stackTrail: StackTrail;
20
+ context: ParseContextType;
21
+ };
22
+ export declare const toTagV3: ({ tag, stackTrail, context }: ToTagV3Args) => OasTag;