@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 { OasTag } from '../../../oas/tag/Tag.js';
2
+ import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
3
+ import { toExternalDocs } from '../externalDocs/toExternalDocs.js';
4
+ export const toTagsV3 = ({ tags, stackTrail, context }) => {
5
+ if (!tags) {
6
+ return undefined;
7
+ }
8
+ const parents = new Map(tags.map(({ name, parent }) => [name, parent]));
9
+ return tags.map(tag => {
10
+ const parentError = toParentError({ name: tag.name, parent: tag.parent, parents });
11
+ if (!parentError) {
12
+ return toTagV3({ tag, stackTrail, context });
13
+ }
14
+ context.logIssue({
15
+ key: 'parent',
16
+ level: 'warning',
17
+ message: `Tag '${tag.name}' ${parentError}; dropping 'parent'`,
18
+ parent: tag,
19
+ stackTrail,
20
+ type: 'INVALID_TAG_PARENT'
21
+ });
22
+ return toTagV3({ tag: { ...tag, parent: undefined }, stackTrail, context });
23
+ });
24
+ };
25
+ /** Describes why the tag's `parent` is invalid, or returns undefined when it is valid. */
26
+ const toParentError = ({ name, parent, parents }) => {
27
+ if (parent === undefined) {
28
+ return undefined;
29
+ }
30
+ if (!parents.has(parent)) {
31
+ return `names parent '${parent}', which is not a tag`;
32
+ }
33
+ if (leadsBackTo({ name, current: parent, parents, visited: new Set() })) {
34
+ return `is in a parent cycle through '${parent}'`;
35
+ }
36
+ return undefined;
37
+ };
38
+ /** Follows the parent chain from `current` and reports whether it reaches `name`. */
39
+ const leadsBackTo = ({ name, current, parents, visited }) => {
40
+ if (current === undefined) {
41
+ return false;
42
+ }
43
+ if (current === name) {
44
+ return true;
45
+ }
46
+ // The chain loops without reaching `name`: the cycle is above this tag, and
47
+ // the tags in it report it.
48
+ if (visited.has(current)) {
49
+ return false;
50
+ }
51
+ return leadsBackTo({
52
+ name,
53
+ current: parents.get(current),
54
+ parents,
55
+ visited: new Set([...visited, current])
56
+ });
57
+ };
58
+ export const toTagV3 = ({ tag, stackTrail, context }) => {
59
+ const { name, description, summary, parent, kind, externalDocs, ...skipped } = tag;
60
+ const parsedExternalDocs = stackTrail.trace('externalDocs', st => toExternalDocs({ externalDocs, stackTrail: st, context }));
61
+ const extensionFields = toSpecificationExtensionsV3({
62
+ skipped,
63
+ parent: tag,
64
+ context,
65
+ stackTrail,
66
+ parentType: 'tag'
67
+ });
68
+ const fields = {
69
+ name,
70
+ description,
71
+ summary,
72
+ parent,
73
+ kind,
74
+ externalDocs: parsedExternalDocs,
75
+ extensionFields
76
+ };
77
+ return new OasTag(fields);
78
+ };
@@ -0,0 +1,12 @@
1
+ import type { OpenAPIV3 } from 'openapi-types';
2
+ import type { ParseContextType } from '../../../context/parseTypes.js';
3
+ import { OasUnion } from '../../../oas/union/Union.js';
4
+ import type { StackTrail } from '../../../context/StackTrail.js';
5
+ export type ToUnionArgs = {
6
+ value: OpenAPIV3.SchemaObject;
7
+ members: (OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject)[];
8
+ parentType: 'anyOf' | 'oneOf';
9
+ stackTrail: StackTrail;
10
+ context: ParseContextType;
11
+ };
12
+ export declare const toUnion: ({ value, members, parentType, stackTrail, context }: ToUnionArgs) => OasUnion;
@@ -0,0 +1,68 @@
1
+ import { OasUnion } from '../../../oas/union/Union.js';
2
+ import { toDiscriminatorV3 } from '../discriminator/toDiscriminatorV3.js';
3
+ import { toSchemaV3 } from '../schema/toSchemasV3.js';
4
+ import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
5
+ import { parseNullable } from '../_helpers/parseNullable.js';
6
+ import { parseExample } from '../_helpers/parseExample.js';
7
+ import { parseDefault } from '../_helpers/parseDefault.js';
8
+ import { toExternalDocs } from '../externalDocs/toExternalDocs.js';
9
+ export const toUnion = ({ value, members, parentType, stackTrail, context }) => {
10
+ const { nullable, value: valueWithoutNullable } = parseNullable({
11
+ value,
12
+ context,
13
+ stackTrail
14
+ });
15
+ const { discriminator, title, description, externalDocs, example: unparsedExample, default: unparsedDefaultValue, ...skipped } = valueWithoutNullable;
16
+ const example = parseExample({
17
+ value: unparsedExample,
18
+ context,
19
+ parent: value,
20
+ nullable,
21
+ check: isPresent,
22
+ toMessage: item => `Removed invalid example. Expected a non-null value, got: ${item}`,
23
+ stackTrail
24
+ });
25
+ const defaultValue = parseDefault({
26
+ value: unparsedDefaultValue,
27
+ context,
28
+ parent: value,
29
+ nullable,
30
+ check: isPresent,
31
+ toMessage: item => `Removed invalid default. Expected a non-null value, got: ${item}`,
32
+ stackTrail
33
+ });
34
+ const extensionFields = toSpecificationExtensionsV3({
35
+ skipped,
36
+ parent: value,
37
+ context,
38
+ stackTrail,
39
+ parentType: `schema:${parentType}`
40
+ });
41
+ const discriminatorParsed = stackTrail.trace('discriminator', st => toDiscriminatorV3({ discriminator, stackTrail: st, context }));
42
+ const membersParsed = members.reduce((acc, item, index) => {
43
+ if (item === undefined || item === null) {
44
+ return acc;
45
+ }
46
+ return [
47
+ ...acc,
48
+ stackTrail.trace(`${index}`, st => toSchemaV3({ schema: item, stackTrail: st, context }))
49
+ ];
50
+ }, []);
51
+ return context.withStackTrail(stackTrail, () => new OasUnion({
52
+ title,
53
+ description,
54
+ externalDocs: stackTrail.trace('externalDocs', st => toExternalDocs({ externalDocs, stackTrail: st, context })),
55
+ nullable,
56
+ default: defaultValue,
57
+ discriminator: discriminatorParsed,
58
+ members: membersParsed,
59
+ example,
60
+ extensionFields
61
+ }, context));
62
+ };
63
+ // A union (anyOf/oneOf) value may match any of its members, so the most we
64
+ // can validate without resolving members is that a present default/example
65
+ // is not a bare `null` on a non-nullable schema.
66
+ const isPresent = (value) => {
67
+ return value !== null && value !== undefined;
68
+ };
@@ -0,0 +1,10 @@
1
+ import type { OpenAPIV3 } from 'openapi-types';
2
+ import type { ParseContextType } from '../../../context/parseTypes.js';
3
+ import { OasUnknown } from '../../../oas/unknown/Unknown.js';
4
+ import type { StackTrail } from '../../../context/StackTrail.js';
5
+ export type ToUnknownArgs = {
6
+ value: OpenAPIV3.SchemaObject;
7
+ stackTrail: StackTrail;
8
+ context: ParseContextType;
9
+ };
10
+ export declare const toUnknown: ({ value, stackTrail, context }: ToUnknownArgs) => OasUnknown;
@@ -0,0 +1,19 @@
1
+ import { OasUnknown } from '../../../oas/unknown/Unknown.js';
2
+ import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
3
+ export const toUnknown = ({ value, stackTrail, context }) => {
4
+ const { type: _type, title, description, example, nullable, ...skipped } = value;
5
+ const extensionFields = toSpecificationExtensionsV3({
6
+ skipped,
7
+ parent: value,
8
+ context,
9
+ stackTrail,
10
+ parentType: 'schema:unknown'
11
+ });
12
+ return context.withStackTrail(stackTrail, () => new OasUnknown({
13
+ title,
14
+ description,
15
+ nullable,
16
+ extensionFields,
17
+ example
18
+ }, context));
19
+ };
@@ -0,0 +1,48 @@
1
+ import type { OpenAPIV3 } from 'openapi-types';
2
+ import type { Method } from '../../../types/Method.js';
3
+ import type { ParseContextType } from '../../../context/parseTypes.js';
4
+ import { OasWebhook } from '../../../oas/webhook/Webhook.js';
5
+ import type { OasPathItem } from '../../../oas/pathItem/PathItem.js';
6
+ import type { StackTrail } from '../../../context/StackTrail.js';
7
+ /**
8
+ * The 3.1 `webhooks` object: a map of webhook NAME → PathItem, identical
9
+ * in shape to `paths` but keyed by name rather than URL path. Inline
10
+ * PathItems only — a webhook PathItem `$ref` is a 3.1 edge case not yet
11
+ * handled (see the arc note §5 Refs).
12
+ */
13
+ export type WebhooksObject = Record<string, OpenAPIV3.PathItemObject>;
14
+ type WebhookInfo = {
15
+ method: Method;
16
+ name: string;
17
+ pathItem: OasPathItem | undefined;
18
+ };
19
+ export type ToWebhookV3Args = {
20
+ operation: OpenAPIV3.OperationObject;
21
+ webhookInfo: WebhookInfo;
22
+ stackTrail: StackTrail;
23
+ context: ParseContextType;
24
+ };
25
+ /**
26
+ * Parses a single webhook Operation Object into an {@link OasWebhook}.
27
+ *
28
+ * Mirrors `toOperationV3` and reuses the same leaf field parsers
29
+ * (`toParameterListV3` / `toRequestBodyV3` / `toResponsesV3` / …) — the
30
+ * inner Operation Object is structurally identical. Only the orchestration
31
+ * is duplicated (the dialect-shaped glue), and the output is an
32
+ * `OasWebhook` carrying a `name`, not an `OasOperation` carrying a `path`.
33
+ */
34
+ export declare const toWebhookV3: ({ operation, webhookInfo, stackTrail, context }: ToWebhookV3Args) => OasWebhook;
35
+ export type ToWebhooksV3Args = {
36
+ webhooks: WebhooksObject | undefined;
37
+ stackTrail: StackTrail;
38
+ context: ParseContextType;
39
+ };
40
+ /**
41
+ * Flattens the 3.1 `webhooks` map into `OasWebhook[]`, mirroring
42
+ * `toOperationsV3`'s `paths` → `OasOperation[]` flattening. Returns `[]`
43
+ * when no `webhooks` object is present (the common 3.0 / no-webhook case).
44
+ * The stack trail nests `webhooks` → `<name>` → `<method>` so
45
+ * `OasDocument.removeItem` can locate a webhook by name.
46
+ */
47
+ export declare const toWebhooksV3: ({ webhooks, stackTrail, context }: ToWebhooksV3Args) => OasWebhook[];
48
+ export {};
@@ -0,0 +1,139 @@
1
+ import { toRequestBodyV3 } from '../requestBody/toRequestBodiesV3.js';
2
+ import { toResponsesV3 } from '../response/toResponseV3.js';
3
+ import { toParameterListV3 } from '../parameter/toParameterV3.js';
4
+ import { OasWebhook } from '../../../oas/webhook/Webhook.js';
5
+ import { toPathItemResultV3 } from '../pathItem/toPathItemV3.js';
6
+ import { toPathItemMethod } from '../methods.js';
7
+ import { dropAdditionalOperationsV3 } from '../pathItem/dropAdditionalOperationsV3.js';
8
+ import { warnQuerystringConflictsV3 } from '../parameter/warnQuerystringConflictsV3.js';
9
+ import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
10
+ import { toSecurityRequirementsV3 } from '../securityRequirement/toSecurityRequirement.js';
11
+ import { toExternalDocs } from '../externalDocs/toExternalDocs.js';
12
+ import { toOptionalServersV3 } from '../server/toServerV3.js';
13
+ /**
14
+ * Parses a single webhook Operation Object into an {@link OasWebhook}.
15
+ *
16
+ * Mirrors `toOperationV3` and reuses the same leaf field parsers
17
+ * (`toParameterListV3` / `toRequestBodyV3` / `toResponsesV3` / …) — the
18
+ * inner Operation Object is structurally identical. Only the orchestration
19
+ * is duplicated (the dialect-shaped glue), and the output is an
20
+ * `OasWebhook` carrying a `name`, not an `OasOperation` carrying a `path`.
21
+ */
22
+ export const toWebhookV3 = ({ operation, webhookInfo, stackTrail, context }) => {
23
+ const { method, name, pathItem } = webhookInfo;
24
+ const { operationId, tags, summary, description, parameters, requestBody, responses, deprecated, security, externalDocs, servers, ...skipped } = operation;
25
+ const extensionFields = toSpecificationExtensionsV3({
26
+ skipped,
27
+ parent: operation,
28
+ context,
29
+ stackTrail,
30
+ parentType: 'operation'
31
+ });
32
+ const parsedParameters = stackTrail.trace('parameters', st => toParameterListV3({ parameters, stackTrail: st, context }));
33
+ warnQuerystringConflictsV3({ parameters: parsedParameters, pathItem, stackTrail, context });
34
+ const parsedRequestBody = stackTrail.trace('requestBody', st => toRequestBodyV3({ requestBody, stackTrail: st, context }));
35
+ const parsedResponses = stackTrail.trace('responses', st => toResponsesV3({ responses, stackTrail: st, context }));
36
+ const parsedSecurity = stackTrail.trace('security', st => toSecurityRequirementsV3({ security, stackTrail: st, context }));
37
+ const parsedExternalDocs = stackTrail.trace('externalDocs', st => toExternalDocs({ externalDocs, stackTrail: st, context }));
38
+ const parsedServers = stackTrail.trace('servers', st => toOptionalServersV3({ servers, stackTrail: st, context }));
39
+ return context.withStackTrail(stackTrail, () => new OasWebhook({
40
+ pathItem,
41
+ name,
42
+ method,
43
+ operationId,
44
+ summary,
45
+ tags,
46
+ description,
47
+ parameters: parsedParameters,
48
+ requestBody: parsedRequestBody,
49
+ responses: parsedResponses,
50
+ deprecated,
51
+ security: parsedSecurity,
52
+ externalDocs: parsedExternalDocs,
53
+ servers: parsedServers,
54
+ extensionFields
55
+ }, context));
56
+ };
57
+ /**
58
+ * Flattens the 3.1 `webhooks` map into `OasWebhook[]`, mirroring
59
+ * `toOperationsV3`'s `paths` → `OasOperation[]` flattening. Returns `[]`
60
+ * when no `webhooks` object is present (the common 3.0 / no-webhook case).
61
+ * The stack trail nests `webhooks` → `<name>` → `<method>` so
62
+ * `OasDocument.removeItem` can locate a webhook by name.
63
+ */
64
+ export const toWebhooksV3 = ({ webhooks, stackTrail, context }) => {
65
+ if (!webhooks) {
66
+ return [];
67
+ }
68
+ return Object.entries(webhooks).flatMap(([name, pathItem]) => {
69
+ return stackTrail.trace(name, nameStack => {
70
+ if (!pathItem) {
71
+ return [];
72
+ }
73
+ const fixedFields = dropAdditionalOperationsV3({ pathItem, stackTrail: nameStack, context });
74
+ const cleaned = Object.entries(fixedFields).reduce(({ rest, methodObject }, [key, operation]) => {
75
+ const method = toPathItemMethod(key);
76
+ if (method) {
77
+ const { [method]: _deleted, ...remaining } = rest;
78
+ return {
79
+ rest: remaining,
80
+ methodObject: {
81
+ ...methodObject,
82
+ [method]: operation
83
+ }
84
+ };
85
+ }
86
+ return { rest, methodObject };
87
+ }, {
88
+ rest: fixedFields,
89
+ methodObject: {}
90
+ });
91
+ const pathItemResult = toPathItemResultV3({
92
+ pathItem: cleaned.rest,
93
+ stackTrail: nameStack,
94
+ context
95
+ });
96
+ if (!pathItemResult.valid) {
97
+ return [];
98
+ }
99
+ const pathItemObject = pathItemResult.pathItem;
100
+ return Object.entries(cleaned.methodObject)
101
+ .map(([method, operation]) => {
102
+ // Use `nameStack` (the trail with the webhook name already
103
+ // pushed) so downstream traces record webhooks:<name>:<method>:…
104
+ // — the trail `OasDocument.removeItem` matches a webhook on.
105
+ return nameStack.trace(method, st => {
106
+ if (!operation) {
107
+ return;
108
+ }
109
+ try {
110
+ return toWebhookV3({
111
+ operation,
112
+ webhookInfo: {
113
+ method: method,
114
+ name,
115
+ pathItem: pathItemObject
116
+ },
117
+ stackTrail: st,
118
+ context
119
+ });
120
+ }
121
+ catch (error) {
122
+ const normalized = error instanceof Error ? error : new Error(String(error));
123
+ context.logIssue({
124
+ key: method,
125
+ parent: operation,
126
+ level: 'error',
127
+ message: normalized.message,
128
+ cause: normalized,
129
+ stackTrail: st,
130
+ type: 'INVALID_OPERATION'
131
+ });
132
+ return undefined;
133
+ }
134
+ });
135
+ })
136
+ .filter((item) => Boolean(item));
137
+ });
138
+ });
139
+ };
@@ -5,9 +5,11 @@ import * as v from 'valibot';
5
5
  *
6
6
  * This constant array includes all HTTP methods that can be used
7
7
  * in OpenAPI path operations, as defined by the OpenAPI specification.
8
- * All methods are in lowercase to match OpenAPI conventions.
8
+ * All methods are in lowercase to match OpenAPI conventions. `query` is
9
+ * an OpenAPI 3.2 method; each parser tree reads its own list from
10
+ * `parse/v3-X/methods.ts`.
9
11
  */
10
- export declare const methodValues: readonly ["get", "put", "post", "delete", "options", "head", "patch", "trace"];
12
+ export declare const methodValues: readonly ["get", "put", "post", "delete", "options", "head", "patch", "trace", "query"];
11
13
  /**
12
14
  * Array of HTTP methods excluding TRACE.
13
15
  *
@@ -23,8 +25,9 @@ export declare const method: v.UnionSchema<[
23
25
  v.LiteralSchema<'delete', undefined>,
24
26
  v.LiteralSchema<'head', undefined>,
25
27
  v.LiteralSchema<'options', undefined>,
26
- v.LiteralSchema<'trace', undefined>
28
+ v.LiteralSchema<'trace', undefined>,
29
+ v.LiteralSchema<'query', undefined>
27
30
  ], undefined>;
28
- export type Method = 'get' | 'put' | 'post' | 'delete' | 'options' | 'head' | 'patch' | 'trace';
31
+ export type Method = 'get' | 'put' | 'post' | 'delete' | 'options' | 'head' | 'patch' | 'trace' | 'query';
29
32
  export declare const methods: v.ArraySchema<typeof method, undefined>;
30
33
  export declare const isMethod: (arg: unknown) => arg is Method;
@@ -5,7 +5,9 @@ import * as v from 'valibot';
5
5
  *
6
6
  * This constant array includes all HTTP methods that can be used
7
7
  * in OpenAPI path operations, as defined by the OpenAPI specification.
8
- * All methods are in lowercase to match OpenAPI conventions.
8
+ * All methods are in lowercase to match OpenAPI conventions. `query` is
9
+ * an OpenAPI 3.2 method; each parser tree reads its own list from
10
+ * `parse/v3-X/methods.ts`.
9
11
  */
10
12
  export const methodValues = [
11
13
  'get',
@@ -15,7 +17,8 @@ export const methodValues = [
15
17
  'options',
16
18
  'head',
17
19
  'patch',
18
- 'trace'
20
+ 'trace',
21
+ 'query'
19
22
  ];
20
23
  /**
21
24
  * Array of HTTP methods excluding TRACE.
@@ -23,7 +26,16 @@ export const methodValues = [
23
26
  * This is a filtered version of {@link methodValues} that excludes the TRACE method,
24
27
  * which is sometimes excluded from API operations for security reasons.
25
28
  */
26
- export const methodValuesNoTrace = ['get', 'put', 'post', 'delete', 'options', 'head', 'patch'];
29
+ export const methodValuesNoTrace = [
30
+ 'get',
31
+ 'put',
32
+ 'post',
33
+ 'delete',
34
+ 'options',
35
+ 'head',
36
+ 'patch',
37
+ 'query'
38
+ ];
27
39
  export const method = v.union([
28
40
  v.literal('get'),
29
41
  v.literal('post'),
@@ -32,7 +44,8 @@ export const method = v.union([
32
44
  v.literal('delete'),
33
45
  v.literal('head'),
34
46
  v.literal('options'),
35
- v.literal('trace')
47
+ v.literal('trace'),
48
+ v.literal('query')
36
49
  ]);
37
50
  export const methods = v.array(method);
38
51
  export const isMethod = (arg) => {
@@ -139,7 +139,8 @@ export declare const oasOperationSource: v.ObjectSchema<{
139
139
  v.LiteralSchema<'delete', undefined>,
140
140
  v.LiteralSchema<'head', undefined>,
141
141
  v.LiteralSchema<'options', undefined>,
142
- v.LiteralSchema<'trace', undefined>
142
+ v.LiteralSchema<'trace', undefined>,
143
+ v.LiteralSchema<'query', undefined>
143
144
  ], undefined>;
144
145
  readonly variant: v.StringSchema<undefined>;
145
146
  }, undefined>;
@@ -59,12 +59,12 @@ export declare const toGqlParsedDocument: (value: GqlDocument) => SkmtcParsedDoc
59
59
  * pipeline runs the protocol-appropriate parser before handing the
60
60
  * post-parse {@link SkmtcParsedDocument} to the generate phase.
61
61
  *
62
- * - `oas.value` is an `OpenAPIV3.Document`. Schema versions other than
63
- * 3.0 (Swagger 2, OpenAPI 3.1) are normalized to 3.0 by
64
- * `@skmtc/convert` before reaching `toArtifacts`. 3.1 `webhooks` ride
65
- * *on* that document as a retained member (the 3.0 base type omits
66
- * `webhooks`, so it is widened here) — the parser flattens them into
67
- * {@link OasDocument.webhooks}.
62
+ * - `oas.value` is an `OpenAPIV3.Document` carrying an OpenAPI 3.0, 3.1 or
63
+ * 3.2 document; each is parsed natively by its own parser tree. Swagger 2
64
+ * is converted to 3.0 by `@skmtc/convert` before reaching `toArtifacts`.
65
+ * 3.1 and 3.2 `webhooks` ride *on* that document as a retained member
66
+ * (the 3.0 base type omits `webhooks`, so it is widened here) — the
67
+ * parser flattens them into {@link OasDocument.webhooks}.
68
68
  * - `gql.value` is either a raw SDL string or a pre-built
69
69
  * `GraphQLSchema`. Strings are run through `buildSchema` inside the
70
70
  * pipeline; pre-built `GraphQLSchema` instances are used as-is.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skmtc/core",
3
- "version": "0.29.0",
3
+ "version": "0.31.0",
4
4
  "description": "Skmtc is a declarative code generation framework",
5
5
  "keywords": [
6
6
  "openapi",
@@ -4,6 +4,17 @@ declare global {
4
4
  }
5
5
  }
6
6
  export {};
7
+ declare global {
8
+ interface Object {
9
+ /**
10
+ * Determines whether an object has a property with the specified name.
11
+ * @param o An object.
12
+ * @param v A property name.
13
+ */
14
+ hasOwn(o: object, v: PropertyKey): boolean;
15
+ }
16
+ }
17
+ export {};
7
18
  /**
8
19
  * Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
9
20
  * but instead of using npm to install additional dependencies,
@@ -1,6 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.import_meta_ponyfill = exports.import_meta_ponyfill_esmodule = exports.import_meta_ponyfill_commonjs = void 0;
4
+ // https://github.com/tc39/proposal-accessible-object-hasownproperty/blob/main/polyfill.js
5
+ if (!Object.hasOwn) {
6
+ Object.defineProperty(Object, "hasOwn", {
7
+ value: function (object, property) {
8
+ if (object == null) {
9
+ throw new TypeError("Cannot convert undefined or null to object");
10
+ }
11
+ return Object.prototype.hasOwnProperty.call(Object(object), property);
12
+ },
13
+ configurable: true,
14
+ enumerable: false,
15
+ writable: true,
16
+ });
17
+ }
4
18
  /**
5
19
  * Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
6
20
  * but instead of using npm to install additional dependencies,
@@ -32,6 +32,7 @@ require("../_dnt.polyfills.js");
32
32
  const graphql_1 = require("graphql");
33
33
  const toDocumentFieldsV3_js_1 = require("../parse/v3-0/document/toDocumentFieldsV3.js");
34
34
  const toDocumentFieldsV3_js_2 = require("../parse/v3-1/document/toDocumentFieldsV3.js");
35
+ const toDocumentFieldsV3_js_3 = require("../parse/v3-2/document/toDocumentFieldsV3.js");
35
36
  const toOasDialect_js_1 = require("../parse/toOasDialect.js");
36
37
  const Document_js_1 = require("../oas/document/Document.js");
37
38
  const GqlRegistry_js_1 = require("../gql/registry/GqlRegistry.js");
@@ -187,7 +188,7 @@ class ParseContext {
187
188
  const oasState = this.protocol;
188
189
  // The ONE place the OpenAPI version is examined: pick the dialect's
189
190
  // parser tree. Everything downstream is version-specific code living
190
- // in its own tree (v3-0 / v3-1) and never re-checks the version.
191
+ // in its own tree (v3-0 / v3-1 / v3-2) and never re-checks the version.
191
192
  const dialect = (0, toOasDialect_js_1.toOasDialect)(oasState.documentObject.openapi);
192
193
  switch (dialect) {
193
194
  case '3.0':
@@ -204,6 +205,13 @@ class ParseContext {
204
205
  context: this
205
206
  });
206
207
  break;
208
+ case '3.2':
209
+ oasState.oasDocument.fields = (0, toDocumentFieldsV3_js_3.toDocumentFieldsV3)({
210
+ documentObject: oasState.documentObject,
211
+ stackTrail,
212
+ context: this
213
+ });
214
+ break;
207
215
  default: {
208
216
  const _exhaustive = dialect;
209
217
  throw new Error(`Unhandled OAS dialect: ${JSON.stringify(_exhaustive)}`);
@@ -154,8 +154,20 @@ export type AnyOasDocument = OpenAPIV2.Document | OpenAPIV3.Document | OpenAPIV3
154
154
  * The TS type and the valibot schema below stay in sync via the
155
155
  * `v.GenericSchema<OasIssueType>` annotation — adding a variant in one
156
156
  * place without the other fails to type-check.
157
+ *
158
+ * Media type issues, at most one per response or request body, from the
159
+ * choice `toJsonContent` makes on its parsed `content`:
160
+ *
161
+ * - `WILDCARD_MEDIA_TYPE` (`warning`) — the body has no JSON media type
162
+ * (see `isJsonMediaType`) and is read from `*\/*` as JSON, since its schema
163
+ * there is an object, array, union or `$ref`. The document does not say the
164
+ * format; springdoc writes `*\/*` for every response.
165
+ * - `NO_JSON_MEDIA_TYPE` (`debug`) — no lookup without a media type reads the
166
+ * body, and its keys include a range: `application/*`, or `*\/*` with a
167
+ * scalar schema (a text body or a file). A body with only specific
168
+ * non-JSON types (`multipart/form-data`, `text/plain`) logs nothing.
157
169
  */
158
- export type OasIssueType = 'UNEXPECTED_PROPERTY' | 'MISSING_OBJECT_TYPE' | 'MISSING_STRING_TYPE' | 'MISSING_ARRAY_TYPE' | 'MISSING_BOOLEAN_TYPE' | 'INVALID_EXAMPLE' | 'INVALID_ENUM' | 'INVALID_DEFAULT' | 'INVALID_NULLABLE' | 'UNEXPECTED_FORMAT' | 'INVALID_RESPONSE' | 'INVALID_FORMAT' | 'INVALID_OPERATION' | 'INVALID_SCHEMA' | 'INVALID_PARAMETER' | 'INVALID_SECURITY_SCHEME' | 'INVALID_DEPENDENCY_REF' | 'EXAMPLE_AND_EXAMPLES_DEFINED';
170
+ export type OasIssueType = 'UNEXPECTED_PROPERTY' | 'MISSING_OBJECT_TYPE' | 'MISSING_STRING_TYPE' | 'MISSING_ARRAY_TYPE' | 'MISSING_BOOLEAN_TYPE' | 'INVALID_EXAMPLE' | 'INVALID_ENUM' | 'INVALID_DEFAULT' | 'INVALID_NULLABLE' | 'UNEXPECTED_FORMAT' | 'INVALID_RESPONSE' | 'INVALID_FORMAT' | 'INVALID_OPERATION' | 'INVALID_SCHEMA' | 'INVALID_PARAMETER' | 'INVALID_SECURITY_SCHEME' | 'INVALID_DEPENDENCY_REF' | 'EXAMPLE_AND_EXAMPLES_DEFINED' | 'INVALID_TAG_PARENT' | 'UNSUPPORTED_OPERATION_METHOD' | 'WILDCARD_MEDIA_TYPE' | 'NO_JSON_MEDIA_TYPE';
159
171
  /**
160
172
  * Valibot schema for {@link OasIssueType}. Annotation deliberately omitted
161
173
  * so the precise literal-union output type flows through to consumers
@@ -163,7 +175,7 @@ export type OasIssueType = 'UNEXPECTED_PROPERTY' | 'MISSING_OBJECT_TYPE' | 'MISS
163
175
  * this list and {@link OasIssueType} is caught by `assertSchemaMatchesType`
164
176
  * below.
165
177
  */
166
- export declare const oasIssueType: v.UnionSchema<[v.LiteralSchema<"UNEXPECTED_PROPERTY", undefined>, v.LiteralSchema<"MISSING_OBJECT_TYPE", undefined>, v.LiteralSchema<"MISSING_STRING_TYPE", undefined>, v.LiteralSchema<"MISSING_ARRAY_TYPE", undefined>, v.LiteralSchema<"MISSING_BOOLEAN_TYPE", undefined>, v.LiteralSchema<"INVALID_EXAMPLE", undefined>, v.LiteralSchema<"INVALID_ENUM", undefined>, v.LiteralSchema<"INVALID_DEFAULT", undefined>, v.LiteralSchema<"INVALID_NULLABLE", undefined>, v.LiteralSchema<"UNEXPECTED_FORMAT", undefined>, v.LiteralSchema<"INVALID_RESPONSE", undefined>, v.LiteralSchema<"INVALID_FORMAT", undefined>, v.LiteralSchema<"INVALID_OPERATION", undefined>, v.LiteralSchema<"INVALID_SCHEMA", undefined>, v.LiteralSchema<"INVALID_PARAMETER", undefined>, v.LiteralSchema<"INVALID_SECURITY_SCHEME", undefined>, v.LiteralSchema<"INVALID_DEPENDENCY_REF", undefined>, v.LiteralSchema<"EXAMPLE_AND_EXAMPLES_DEFINED", undefined>], undefined>;
178
+ export declare const oasIssueType: v.UnionSchema<[v.LiteralSchema<"UNEXPECTED_PROPERTY", undefined>, v.LiteralSchema<"MISSING_OBJECT_TYPE", undefined>, v.LiteralSchema<"MISSING_STRING_TYPE", undefined>, v.LiteralSchema<"MISSING_ARRAY_TYPE", undefined>, v.LiteralSchema<"MISSING_BOOLEAN_TYPE", undefined>, v.LiteralSchema<"INVALID_EXAMPLE", undefined>, v.LiteralSchema<"INVALID_ENUM", undefined>, v.LiteralSchema<"INVALID_DEFAULT", undefined>, v.LiteralSchema<"INVALID_NULLABLE", undefined>, v.LiteralSchema<"UNEXPECTED_FORMAT", undefined>, v.LiteralSchema<"INVALID_RESPONSE", undefined>, v.LiteralSchema<"INVALID_FORMAT", undefined>, v.LiteralSchema<"INVALID_OPERATION", undefined>, v.LiteralSchema<"INVALID_SCHEMA", undefined>, v.LiteralSchema<"INVALID_PARAMETER", undefined>, v.LiteralSchema<"INVALID_SECURITY_SCHEME", undefined>, v.LiteralSchema<"INVALID_DEPENDENCY_REF", undefined>, v.LiteralSchema<"EXAMPLE_AND_EXAMPLES_DEFINED", undefined>, v.LiteralSchema<"INVALID_TAG_PARENT", undefined>, v.LiteralSchema<"UNSUPPORTED_OPERATION_METHOD", undefined>, v.LiteralSchema<"WILDCARD_MEDIA_TYPE", undefined>, v.LiteralSchema<"NO_JSON_MEDIA_TYPE", undefined>], undefined>;
167
179
  export type GenerateResult = {
168
180
  files: Map<string, FileBase>;
169
181
  previews: Record<string, Preview>;
@@ -60,7 +60,11 @@ exports.oasIssueType = v.union([
60
60
  v.literal('INVALID_PARAMETER'),
61
61
  v.literal('INVALID_SECURITY_SCHEME'),
62
62
  v.literal('INVALID_DEPENDENCY_REF'),
63
- v.literal('EXAMPLE_AND_EXAMPLES_DEFINED')
63
+ v.literal('EXAMPLE_AND_EXAMPLES_DEFINED'),
64
+ v.literal('INVALID_TAG_PARENT'),
65
+ v.literal('UNSUPPORTED_OPERATION_METHOD'),
66
+ v.literal('WILDCARD_MEDIA_TYPE'),
67
+ v.literal('NO_JSON_MEDIA_TYPE')
64
68
  ]);
65
69
  // Compile-time drift detector: this binding fails to type-check if
66
70
  // `OasIssueType` and the literal list above disagree in either
@@ -466,8 +466,8 @@ export declare const isGeneratorKey: (arg: unknown) => arg is GeneratorKey;
466
466
  * Type guard to check if a value is a valid OasOperationGeneratorKey.
467
467
  *
468
468
  * Validates that the argument is a string with the correct format:
469
- * `generatorId|path|method` where each part is non-empty and method
470
- * is a valid HTTP method.
469
+ * `generatorId|path|method|variant` where each part is non-empty, path
470
+ * starts with `/` and method is a valid HTTP method.
471
471
  *
472
472
  * @param arg - Value to check
473
473
  * @returns True if the value is a valid OasOperationGeneratorKey
@@ -263,8 +263,8 @@ exports.isGeneratorKey = isGeneratorKey;
263
263
  * Type guard to check if a value is a valid OasOperationGeneratorKey.
264
264
  *
265
265
  * Validates that the argument is a string with the correct format:
266
- * `generatorId|path|method` where each part is non-empty and method
267
- * is a valid HTTP method.
266
+ * `generatorId|path|method|variant` where each part is non-empty, path
267
+ * starts with `/` and method is a valid HTTP method.
268
268
  *
269
269
  * @param arg - Value to check
270
270
  * @returns True if the value is a valid OasOperationGeneratorKey
@@ -295,7 +295,10 @@ const isOasOperationGeneratorKey = (arg) => {
295
295
  if (typeof generatorId !== 'string' || !generatorId.length) {
296
296
  return false;
297
297
  }
298
- if (typeof path !== 'string' || !path.length) {
298
+ // An OpenAPI path starts with `/`. Checking it keeps a GraphQL key whose
299
+ // field name is also an HTTP method (`gen|mutation|query|main`) from
300
+ // parsing as an operation.
301
+ if (typeof path !== 'string' || !path.startsWith('/')) {
299
302
  return false;
300
303
  }
301
304
  if (!(0, Method_js_1.isMethod)(method)) {