@skmtc/core 0.39.0 → 0.40.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 (343) hide show
  1. package/esm/context/CoreContext.js +22 -8
  2. package/esm/context/GenerateContext.d.ts +5 -4
  3. package/esm/context/GenerateContext.js +110 -37
  4. package/esm/context/ParseContext.d.ts +9 -1
  5. package/esm/context/ParseContext.js +12 -1
  6. package/esm/context/generateTypes.d.ts +19 -4
  7. package/esm/context/generateTypes.js +2 -0
  8. package/esm/context/toGenerationFailure.d.ts +21 -0
  9. package/esm/context/toGenerationFailure.js +38 -0
  10. package/esm/dsl/CustomValue.d.ts +4 -0
  11. package/esm/dsl/CustomValue.js +8 -0
  12. package/esm/dsl/Definition.d.ts +10 -0
  13. package/esm/dsl/Definition.js +14 -0
  14. package/esm/dsl/PendingDefinition.d.ts +47 -0
  15. package/esm/dsl/PendingDefinition.js +83 -0
  16. package/esm/dsl/model/ModelDriver.d.ts +55 -1
  17. package/esm/dsl/model/ModelDriver.js +228 -51
  18. package/esm/dsl/model/toModelEntry.d.ts +1 -1
  19. package/esm/dsl/model/toModelEntry.js +1 -1
  20. package/esm/dsl/model/types.d.ts +1 -1
  21. package/esm/dsl/operation/gql/GqlOperationDriver.js +1 -4
  22. package/esm/dsl/webhook/WebhookDriver.js +1 -4
  23. package/esm/enrichments/parseEnrichmentUmbrella.d.ts +5 -6
  24. package/esm/enrichments/parseEnrichmentUmbrella.js +23 -8
  25. package/esm/enrichments/parseEnrichmentValue.d.ts +17 -0
  26. package/esm/enrichments/parseEnrichmentValue.js +32 -0
  27. package/esm/enrichments/readEnrichments.d.ts +5 -5
  28. package/esm/enrichments/readEnrichments.js +17 -7
  29. package/esm/mod.d.ts +1 -0
  30. package/esm/mod.js +1 -0
  31. package/esm/oas/array/Array.d.ts +19 -0
  32. package/esm/oas/array/Array.js +47 -0
  33. package/esm/oas/boolean/Boolean.d.ts +19 -0
  34. package/esm/oas/boolean/Boolean.js +51 -8
  35. package/esm/oas/example/Example.d.ts +4 -0
  36. package/esm/oas/example/Example.js +8 -0
  37. package/esm/oas/header/Header.d.ts +4 -0
  38. package/esm/oas/header/Header.js +8 -0
  39. package/esm/oas/integer/Integer.d.ts +19 -0
  40. package/esm/oas/integer/Integer.js +49 -0
  41. package/esm/oas/link/Link.d.ts +4 -0
  42. package/esm/oas/link/Link.js +8 -0
  43. package/esm/oas/number/Number.d.ts +19 -0
  44. package/esm/oas/number/Number.js +49 -0
  45. package/esm/oas/object/Object.d.ts +19 -0
  46. package/esm/oas/object/Object.js +68 -18
  47. package/esm/oas/operation/Operation.d.ts +5 -1
  48. package/esm/oas/operation/Operation.js +17 -5
  49. package/esm/oas/operation/toEffectiveParameters.d.ts +16 -0
  50. package/esm/oas/operation/toEffectiveParameters.js +13 -0
  51. package/esm/oas/parameter/Parameter.d.ts +4 -0
  52. package/esm/oas/parameter/Parameter.js +8 -0
  53. package/esm/oas/ref/Ref.d.ts +147 -25
  54. package/esm/oas/ref/Ref.js +387 -25
  55. package/esm/oas/requestBody/RequestBody.d.ts +4 -0
  56. package/esm/oas/requestBody/RequestBody.js +8 -0
  57. package/esm/oas/response/Response.d.ts +4 -0
  58. package/esm/oas/response/Response.js +8 -0
  59. package/esm/oas/schema/siblings.d.ts +127 -0
  60. package/esm/oas/schema/siblings.js +240 -0
  61. package/esm/oas/securitySchemes/SecurityScheme.d.ts +16 -0
  62. package/esm/oas/securitySchemes/SecurityScheme.js +32 -0
  63. package/esm/oas/string/String.d.ts +19 -0
  64. package/esm/oas/string/String.js +47 -0
  65. package/esm/oas/union/Union.d.ts +31 -0
  66. package/esm/oas/union/Union.js +100 -0
  67. package/esm/oas/unknown/Unknown.d.ts +18 -0
  68. package/esm/oas/unknown/Unknown.js +38 -0
  69. package/esm/oas/void/Void.d.ts +4 -0
  70. package/esm/oas/void/Void.js +8 -0
  71. package/esm/oas/webhook/Webhook.d.ts +2 -2
  72. package/esm/oas/webhook/Webhook.js +6 -5
  73. package/esm/parse/allOfSystem.d.ts +32 -0
  74. package/esm/parse/allOfSystem.js +30 -0
  75. package/esm/parse/anyOfSystem.d.ts +68 -0
  76. package/esm/parse/anyOfSystem.js +107 -0
  77. package/esm/parse/toSiblingKeywords.d.ts +28 -0
  78. package/esm/parse/toSiblingKeywords.js +109 -0
  79. package/esm/parse/v3-0/_merge-all-of/decompose-union.d.ts +8 -0
  80. package/esm/parse/v3-0/_merge-all-of/decompose-union.js +9 -1
  81. package/esm/parse/v3-0/_merge-all-of/generic-merge.d.ts +2 -3
  82. package/esm/parse/v3-0/_merge-all-of/generic-merge.js +2 -2
  83. package/esm/parse/v3-0/_merge-all-of/merge-array-constraints.d.ts +2 -2
  84. package/esm/parse/v3-0/_merge-all-of/merge-array-constraints.js +5 -5
  85. package/esm/parse/v3-0/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  86. package/esm/parse/v3-0/_merge-all-of/merge-boolean-constraints.js +2 -2
  87. package/esm/parse/v3-0/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  88. package/esm/parse/v3-0/_merge-all-of/merge-integer-constraints.js +2 -2
  89. package/esm/parse/v3-0/_merge-all-of/merge-intersection.d.ts +3 -2
  90. package/esm/parse/v3-0/_merge-all-of/merge-intersection.js +2 -2
  91. package/esm/parse/v3-0/_merge-all-of/merge-number-constraints.d.ts +2 -2
  92. package/esm/parse/v3-0/_merge-all-of/merge-number-constraints.js +2 -2
  93. package/esm/parse/v3-0/_merge-all-of/merge-object-constraints.d.ts +2 -2
  94. package/esm/parse/v3-0/_merge-all-of/merge-object-constraints.js +3 -3
  95. package/esm/parse/v3-0/_merge-all-of/merge-properties.d.ts +2 -2
  96. package/esm/parse/v3-0/_merge-all-of/merge-properties.js +2 -2
  97. package/esm/parse/v3-0/_merge-all-of/merge-string-constraints.d.ts +2 -2
  98. package/esm/parse/v3-0/_merge-all-of/merge-string-constraints.js +3 -3
  99. package/esm/parse/v3-0/_merge-all-of/merge-union.d.ts +10 -3
  100. package/esm/parse/v3-0/_merge-all-of/merge-union.js +50 -12
  101. package/esm/parse/v3-0/_merge-all-of/merge.d.ts +2 -2
  102. package/esm/parse/v3-0/_merge-all-of/merge.js +78 -27
  103. package/esm/parse/v3-0/_merge-all-of/nullable-merge.d.ts +4 -0
  104. package/esm/parse/v3-0/_merge-all-of/nullable-merge.js +9 -7
  105. package/esm/parse/v3-0/_merge-all-of/types.d.ts +33 -0
  106. package/esm/parse/v3-0/ref/toRefV31.d.ts +7 -1
  107. package/esm/parse/v3-0/ref/toRefV31.js +2 -2
  108. package/esm/parse/v3-0/schema/toSchemasV3.js +107 -15
  109. package/esm/parse/v3-1/_merge-all-of/decompose-union.d.ts +7 -1
  110. package/esm/parse/v3-1/_merge-all-of/decompose-union.js +8 -2
  111. package/esm/parse/v3-1/_merge-all-of/generic-merge.d.ts +2 -3
  112. package/esm/parse/v3-1/_merge-all-of/generic-merge.js +2 -2
  113. package/esm/parse/v3-1/_merge-all-of/merge-array-constraints.d.ts +3 -2
  114. package/esm/parse/v3-1/_merge-all-of/merge-array-constraints.js +5 -5
  115. package/esm/parse/v3-1/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  116. package/esm/parse/v3-1/_merge-all-of/merge-boolean-constraints.js +2 -2
  117. package/esm/parse/v3-1/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  118. package/esm/parse/v3-1/_merge-all-of/merge-integer-constraints.js +2 -2
  119. package/esm/parse/v3-1/_merge-all-of/merge-intersection.d.ts +3 -2
  120. package/esm/parse/v3-1/_merge-all-of/merge-intersection.js +2 -2
  121. package/esm/parse/v3-1/_merge-all-of/merge-number-constraints.d.ts +2 -2
  122. package/esm/parse/v3-1/_merge-all-of/merge-number-constraints.js +2 -2
  123. package/esm/parse/v3-1/_merge-all-of/merge-object-constraints.d.ts +2 -2
  124. package/esm/parse/v3-1/_merge-all-of/merge-object-constraints.js +3 -3
  125. package/esm/parse/v3-1/_merge-all-of/merge-properties.d.ts +2 -2
  126. package/esm/parse/v3-1/_merge-all-of/merge-properties.js +2 -2
  127. package/esm/parse/v3-1/_merge-all-of/merge-string-constraints.d.ts +2 -2
  128. package/esm/parse/v3-1/_merge-all-of/merge-string-constraints.js +3 -3
  129. package/esm/parse/v3-1/_merge-all-of/merge-union.d.ts +10 -3
  130. package/esm/parse/v3-1/_merge-all-of/merge-union.js +54 -15
  131. package/esm/parse/v3-1/_merge-all-of/merge.d.ts +3 -2
  132. package/esm/parse/v3-1/_merge-all-of/merge.js +88 -29
  133. package/esm/parse/v3-1/_merge-all-of/nullable-merge.d.ts +4 -0
  134. package/esm/parse/v3-1/_merge-all-of/nullable-merge.js +9 -7
  135. package/esm/parse/v3-1/_merge-all-of/types.d.ts +37 -0
  136. package/esm/parse/v3-1/ref/toRefV31.d.ts +7 -1
  137. package/esm/parse/v3-1/ref/toRefV31.js +2 -2
  138. package/esm/parse/v3-1/schema/toSchemasV3.js +111 -16
  139. package/esm/parse/v3-2/_merge-all-of/decompose-union.d.ts +7 -1
  140. package/esm/parse/v3-2/_merge-all-of/decompose-union.js +8 -2
  141. package/esm/parse/v3-2/_merge-all-of/generic-merge.d.ts +2 -3
  142. package/esm/parse/v3-2/_merge-all-of/generic-merge.js +2 -2
  143. package/esm/parse/v3-2/_merge-all-of/merge-array-constraints.d.ts +3 -2
  144. package/esm/parse/v3-2/_merge-all-of/merge-array-constraints.js +5 -5
  145. package/esm/parse/v3-2/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  146. package/esm/parse/v3-2/_merge-all-of/merge-boolean-constraints.js +2 -2
  147. package/esm/parse/v3-2/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  148. package/esm/parse/v3-2/_merge-all-of/merge-integer-constraints.js +2 -2
  149. package/esm/parse/v3-2/_merge-all-of/merge-intersection.d.ts +3 -2
  150. package/esm/parse/v3-2/_merge-all-of/merge-intersection.js +2 -2
  151. package/esm/parse/v3-2/_merge-all-of/merge-number-constraints.d.ts +2 -2
  152. package/esm/parse/v3-2/_merge-all-of/merge-number-constraints.js +2 -2
  153. package/esm/parse/v3-2/_merge-all-of/merge-object-constraints.d.ts +2 -2
  154. package/esm/parse/v3-2/_merge-all-of/merge-object-constraints.js +3 -3
  155. package/esm/parse/v3-2/_merge-all-of/merge-properties.d.ts +2 -2
  156. package/esm/parse/v3-2/_merge-all-of/merge-properties.js +2 -2
  157. package/esm/parse/v3-2/_merge-all-of/merge-string-constraints.d.ts +2 -2
  158. package/esm/parse/v3-2/_merge-all-of/merge-string-constraints.js +3 -3
  159. package/esm/parse/v3-2/_merge-all-of/merge-union.d.ts +10 -3
  160. package/esm/parse/v3-2/_merge-all-of/merge-union.js +54 -15
  161. package/esm/parse/v3-2/_merge-all-of/merge.d.ts +3 -2
  162. package/esm/parse/v3-2/_merge-all-of/merge.js +88 -29
  163. package/esm/parse/v3-2/_merge-all-of/nullable-merge.d.ts +4 -0
  164. package/esm/parse/v3-2/_merge-all-of/nullable-merge.js +9 -7
  165. package/esm/parse/v3-2/_merge-all-of/types.d.ts +37 -0
  166. package/esm/parse/v3-2/ref/toRefV31.d.ts +7 -1
  167. package/esm/parse/v3-2/ref/toRefV31.js +2 -2
  168. package/esm/parse/v3-2/schema/toSchemasV3.js +111 -16
  169. package/esm/types/OasBase.d.ts +1 -1
  170. package/esm/types/Settings.d.ts +34 -0
  171. package/esm/types/Settings.js +8 -0
  172. package/package.json +1 -1
  173. package/script/context/CoreContext.js +22 -8
  174. package/script/context/GenerateContext.d.ts +5 -4
  175. package/script/context/GenerateContext.js +110 -37
  176. package/script/context/ParseContext.d.ts +9 -1
  177. package/script/context/ParseContext.js +12 -1
  178. package/script/context/generateTypes.d.ts +19 -4
  179. package/script/context/generateTypes.js +2 -0
  180. package/script/context/toGenerationFailure.d.ts +21 -0
  181. package/script/context/toGenerationFailure.js +43 -0
  182. package/script/dsl/CustomValue.d.ts +4 -0
  183. package/script/dsl/CustomValue.js +8 -0
  184. package/script/dsl/Definition.d.ts +10 -0
  185. package/script/dsl/Definition.js +14 -0
  186. package/script/dsl/PendingDefinition.d.ts +47 -0
  187. package/script/dsl/PendingDefinition.js +87 -0
  188. package/script/dsl/model/ModelDriver.d.ts +55 -1
  189. package/script/dsl/model/ModelDriver.js +231 -52
  190. package/script/dsl/model/toModelEntry.d.ts +1 -1
  191. package/script/dsl/model/toModelEntry.js +1 -1
  192. package/script/dsl/model/types.d.ts +1 -1
  193. package/script/dsl/operation/gql/GqlOperationDriver.js +1 -4
  194. package/script/dsl/webhook/WebhookDriver.js +1 -4
  195. package/script/enrichments/parseEnrichmentUmbrella.d.ts +5 -6
  196. package/script/enrichments/parseEnrichmentUmbrella.js +23 -41
  197. package/script/enrichments/parseEnrichmentValue.d.ts +17 -0
  198. package/script/enrichments/parseEnrichmentValue.js +69 -0
  199. package/script/enrichments/readEnrichments.d.ts +5 -5
  200. package/script/enrichments/readEnrichments.js +17 -40
  201. package/script/mod.d.ts +1 -0
  202. package/script/mod.js +1 -0
  203. package/script/oas/array/Array.d.ts +19 -0
  204. package/script/oas/array/Array.js +47 -0
  205. package/script/oas/boolean/Boolean.d.ts +19 -0
  206. package/script/oas/boolean/Boolean.js +51 -8
  207. package/script/oas/example/Example.d.ts +4 -0
  208. package/script/oas/example/Example.js +8 -0
  209. package/script/oas/header/Header.d.ts +4 -0
  210. package/script/oas/header/Header.js +8 -0
  211. package/script/oas/integer/Integer.d.ts +19 -0
  212. package/script/oas/integer/Integer.js +49 -0
  213. package/script/oas/link/Link.d.ts +4 -0
  214. package/script/oas/link/Link.js +8 -0
  215. package/script/oas/number/Number.d.ts +19 -0
  216. package/script/oas/number/Number.js +49 -0
  217. package/script/oas/object/Object.d.ts +19 -0
  218. package/script/oas/object/Object.js +68 -18
  219. package/script/oas/operation/Operation.d.ts +5 -1
  220. package/script/oas/operation/Operation.js +17 -5
  221. package/script/oas/operation/toEffectiveParameters.d.ts +16 -0
  222. package/script/oas/operation/toEffectiveParameters.js +17 -0
  223. package/script/oas/parameter/Parameter.d.ts +4 -0
  224. package/script/oas/parameter/Parameter.js +8 -0
  225. package/script/oas/ref/Ref.d.ts +147 -25
  226. package/script/oas/ref/Ref.js +387 -25
  227. package/script/oas/requestBody/RequestBody.d.ts +4 -0
  228. package/script/oas/requestBody/RequestBody.js +8 -0
  229. package/script/oas/response/Response.d.ts +4 -0
  230. package/script/oas/response/Response.js +8 -0
  231. package/script/oas/schema/siblings.d.ts +127 -0
  232. package/script/oas/schema/siblings.js +295 -0
  233. package/script/oas/securitySchemes/SecurityScheme.d.ts +16 -0
  234. package/script/oas/securitySchemes/SecurityScheme.js +32 -0
  235. package/script/oas/string/String.d.ts +19 -0
  236. package/script/oas/string/String.js +47 -0
  237. package/script/oas/union/Union.d.ts +31 -0
  238. package/script/oas/union/Union.js +100 -0
  239. package/script/oas/unknown/Unknown.d.ts +18 -0
  240. package/script/oas/unknown/Unknown.js +38 -0
  241. package/script/oas/void/Void.d.ts +4 -0
  242. package/script/oas/void/Void.js +8 -0
  243. package/script/oas/webhook/Webhook.d.ts +2 -2
  244. package/script/oas/webhook/Webhook.js +6 -5
  245. package/script/parse/allOfSystem.d.ts +32 -0
  246. package/script/parse/allOfSystem.js +35 -0
  247. package/script/parse/anyOfSystem.d.ts +68 -0
  248. package/script/parse/anyOfSystem.js +116 -0
  249. package/script/parse/toSiblingKeywords.d.ts +28 -0
  250. package/script/parse/toSiblingKeywords.js +146 -0
  251. package/script/parse/v3-0/_merge-all-of/decompose-union.d.ts +8 -0
  252. package/script/parse/v3-0/_merge-all-of/decompose-union.js +11 -2
  253. package/script/parse/v3-0/_merge-all-of/generic-merge.d.ts +2 -3
  254. package/script/parse/v3-0/_merge-all-of/generic-merge.js +2 -2
  255. package/script/parse/v3-0/_merge-all-of/merge-array-constraints.d.ts +2 -2
  256. package/script/parse/v3-0/_merge-all-of/merge-array-constraints.js +5 -5
  257. package/script/parse/v3-0/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  258. package/script/parse/v3-0/_merge-all-of/merge-boolean-constraints.js +2 -2
  259. package/script/parse/v3-0/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  260. package/script/parse/v3-0/_merge-all-of/merge-integer-constraints.js +2 -2
  261. package/script/parse/v3-0/_merge-all-of/merge-intersection.d.ts +3 -2
  262. package/script/parse/v3-0/_merge-all-of/merge-intersection.js +2 -2
  263. package/script/parse/v3-0/_merge-all-of/merge-number-constraints.d.ts +2 -2
  264. package/script/parse/v3-0/_merge-all-of/merge-number-constraints.js +2 -2
  265. package/script/parse/v3-0/_merge-all-of/merge-object-constraints.d.ts +2 -2
  266. package/script/parse/v3-0/_merge-all-of/merge-object-constraints.js +3 -3
  267. package/script/parse/v3-0/_merge-all-of/merge-properties.d.ts +2 -2
  268. package/script/parse/v3-0/_merge-all-of/merge-properties.js +2 -2
  269. package/script/parse/v3-0/_merge-all-of/merge-string-constraints.d.ts +2 -2
  270. package/script/parse/v3-0/_merge-all-of/merge-string-constraints.js +3 -3
  271. package/script/parse/v3-0/_merge-all-of/merge-union.d.ts +10 -3
  272. package/script/parse/v3-0/_merge-all-of/merge-union.js +52 -13
  273. package/script/parse/v3-0/_merge-all-of/merge.d.ts +2 -2
  274. package/script/parse/v3-0/_merge-all-of/merge.js +77 -26
  275. package/script/parse/v3-0/_merge-all-of/nullable-merge.d.ts +4 -0
  276. package/script/parse/v3-0/_merge-all-of/nullable-merge.js +9 -7
  277. package/script/parse/v3-0/_merge-all-of/types.d.ts +33 -0
  278. package/script/parse/v3-0/ref/toRefV31.d.ts +7 -1
  279. package/script/parse/v3-0/ref/toRefV31.js +2 -2
  280. package/script/parse/v3-0/schema/toSchemasV3.js +107 -15
  281. package/script/parse/v3-1/_merge-all-of/decompose-union.d.ts +7 -1
  282. package/script/parse/v3-1/_merge-all-of/decompose-union.js +8 -2
  283. package/script/parse/v3-1/_merge-all-of/generic-merge.d.ts +2 -3
  284. package/script/parse/v3-1/_merge-all-of/generic-merge.js +2 -2
  285. package/script/parse/v3-1/_merge-all-of/merge-array-constraints.d.ts +3 -2
  286. package/script/parse/v3-1/_merge-all-of/merge-array-constraints.js +5 -5
  287. package/script/parse/v3-1/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  288. package/script/parse/v3-1/_merge-all-of/merge-boolean-constraints.js +2 -2
  289. package/script/parse/v3-1/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  290. package/script/parse/v3-1/_merge-all-of/merge-integer-constraints.js +2 -2
  291. package/script/parse/v3-1/_merge-all-of/merge-intersection.d.ts +3 -2
  292. package/script/parse/v3-1/_merge-all-of/merge-intersection.js +2 -2
  293. package/script/parse/v3-1/_merge-all-of/merge-number-constraints.d.ts +2 -2
  294. package/script/parse/v3-1/_merge-all-of/merge-number-constraints.js +2 -2
  295. package/script/parse/v3-1/_merge-all-of/merge-object-constraints.d.ts +2 -2
  296. package/script/parse/v3-1/_merge-all-of/merge-object-constraints.js +3 -3
  297. package/script/parse/v3-1/_merge-all-of/merge-properties.d.ts +2 -2
  298. package/script/parse/v3-1/_merge-all-of/merge-properties.js +2 -2
  299. package/script/parse/v3-1/_merge-all-of/merge-string-constraints.d.ts +2 -2
  300. package/script/parse/v3-1/_merge-all-of/merge-string-constraints.js +3 -3
  301. package/script/parse/v3-1/_merge-all-of/merge-union.d.ts +10 -3
  302. package/script/parse/v3-1/_merge-all-of/merge-union.js +56 -16
  303. package/script/parse/v3-1/_merge-all-of/merge.d.ts +3 -2
  304. package/script/parse/v3-1/_merge-all-of/merge.js +87 -28
  305. package/script/parse/v3-1/_merge-all-of/nullable-merge.d.ts +4 -0
  306. package/script/parse/v3-1/_merge-all-of/nullable-merge.js +9 -7
  307. package/script/parse/v3-1/_merge-all-of/types.d.ts +37 -0
  308. package/script/parse/v3-1/ref/toRefV31.d.ts +7 -1
  309. package/script/parse/v3-1/ref/toRefV31.js +2 -2
  310. package/script/parse/v3-1/schema/toSchemasV3.js +111 -16
  311. package/script/parse/v3-2/_merge-all-of/decompose-union.d.ts +7 -1
  312. package/script/parse/v3-2/_merge-all-of/decompose-union.js +8 -2
  313. package/script/parse/v3-2/_merge-all-of/generic-merge.d.ts +2 -3
  314. package/script/parse/v3-2/_merge-all-of/generic-merge.js +2 -2
  315. package/script/parse/v3-2/_merge-all-of/merge-array-constraints.d.ts +3 -2
  316. package/script/parse/v3-2/_merge-all-of/merge-array-constraints.js +5 -5
  317. package/script/parse/v3-2/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  318. package/script/parse/v3-2/_merge-all-of/merge-boolean-constraints.js +2 -2
  319. package/script/parse/v3-2/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  320. package/script/parse/v3-2/_merge-all-of/merge-integer-constraints.js +2 -2
  321. package/script/parse/v3-2/_merge-all-of/merge-intersection.d.ts +3 -2
  322. package/script/parse/v3-2/_merge-all-of/merge-intersection.js +2 -2
  323. package/script/parse/v3-2/_merge-all-of/merge-number-constraints.d.ts +2 -2
  324. package/script/parse/v3-2/_merge-all-of/merge-number-constraints.js +2 -2
  325. package/script/parse/v3-2/_merge-all-of/merge-object-constraints.d.ts +2 -2
  326. package/script/parse/v3-2/_merge-all-of/merge-object-constraints.js +3 -3
  327. package/script/parse/v3-2/_merge-all-of/merge-properties.d.ts +2 -2
  328. package/script/parse/v3-2/_merge-all-of/merge-properties.js +2 -2
  329. package/script/parse/v3-2/_merge-all-of/merge-string-constraints.d.ts +2 -2
  330. package/script/parse/v3-2/_merge-all-of/merge-string-constraints.js +3 -3
  331. package/script/parse/v3-2/_merge-all-of/merge-union.d.ts +10 -3
  332. package/script/parse/v3-2/_merge-all-of/merge-union.js +56 -16
  333. package/script/parse/v3-2/_merge-all-of/merge.d.ts +3 -2
  334. package/script/parse/v3-2/_merge-all-of/merge.js +87 -28
  335. package/script/parse/v3-2/_merge-all-of/nullable-merge.d.ts +4 -0
  336. package/script/parse/v3-2/_merge-all-of/nullable-merge.js +9 -7
  337. package/script/parse/v3-2/_merge-all-of/types.d.ts +37 -0
  338. package/script/parse/v3-2/ref/toRefV31.d.ts +7 -1
  339. package/script/parse/v3-2/ref/toRefV31.js +2 -2
  340. package/script/parse/v3-2/schema/toSchemasV3.js +111 -16
  341. package/script/types/OasBase.d.ts +1 -1
  342. package/script/types/Settings.d.ts +34 -0
  343. package/script/types/Settings.js +9 -1
@@ -9,7 +9,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
9
9
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
- var _CoreContext_instances, _CoreContext_phase, _CoreContext_results, _CoreContext_logLines, _CoreContext_phaseName, _CoreContext_parseIssues, _CoreContext_setupLogger, _CoreContext_toLogTrail, _CoreContext_closeFileHandlers, _CoreContext_toRunFailedIssue, _CoreContext_setupParsePhase, _CoreContext_setupGeneratePhase, _CoreContext_setupRenderPhase;
12
+ var _CoreContext_instances, _CoreContext_phase, _CoreContext_results, _CoreContext_logLines, _CoreContext_phaseName, _CoreContext_parseIssues, _CoreContext_enrichmentWarnings, _CoreContext_setupLogger, _CoreContext_toLogTrail, _CoreContext_closeFileHandlers, _CoreContext_toRunFailedIssue, _CoreContext_setupParsePhase, _CoreContext_setupGeneratePhase, _CoreContext_setupRenderPhase;
13
13
  import { GenerateContext } from './GenerateContext.js';
14
14
  import { toInspection } from '../run/toInspection.js';
15
15
  import { RenderContext } from './RenderContext.js';
@@ -22,6 +22,7 @@ import { ResultsLog } from '../helpers/ResultsLog.js';
22
22
  import { join } from '../deps/jsr.io/@std/path/1.1.6/join.js';
23
23
  import { bold, gray, red, yellow, blue } from '../deps/jsr.io/@std/fmt/1.0.10/colors.js';
24
24
  import { toSerializedError } from '../types/SerializedError.js';
25
+ import { GenerationFailure } from './toGenerationFailure.js';
25
26
  /**
26
27
  * The main orchestration class for the SKMTC transformation pipeline.
27
28
  *
@@ -130,6 +131,16 @@ export class CoreContext {
130
131
  * render phases replace `#phase`, so a later failure still returns them.
131
132
  */
132
133
  _CoreContext_parseIssues.set(this, []
134
+ /**
135
+ * The enrichment warnings of this run, kept so a failure in generate or
136
+ * render still returns them: a misaddressed enrichment is often the cause.
137
+ */
138
+ );
139
+ /**
140
+ * The enrichment warnings of this run, kept so a failure in generate or
141
+ * render still returns them: a misaddressed enrichment is often the cause.
142
+ */
143
+ _CoreContext_enrichmentWarnings.set(this, []
133
144
  /**
134
145
  * Creates a new CoreContext instance.
135
146
  *
@@ -284,7 +295,8 @@ export class CoreContext {
284
295
  // A throw while the parse context is set up counts as parse.
285
296
  __classPrivateFieldSet(this, _CoreContext_phaseName, 'parse', "f");
286
297
  __classPrivateFieldSet(this, _CoreContext_parseIssues, [], "f");
287
- const phase = __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupParsePhase).call(this, document);
298
+ __classPrivateFieldSet(this, _CoreContext_enrichmentWarnings, [], "f");
299
+ const phase = __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupParsePhase).call(this, document, settings);
288
300
  __classPrivateFieldSet(this, _CoreContext_phase, phase, "f");
289
301
  __classPrivateFieldSet(this, _CoreContext_parseIssues, phase.context.issues, "f");
290
302
  const parsedDocument = stackTrail.trace('parse', st => phase.context.parse(st));
@@ -303,6 +315,7 @@ export class CoreContext {
303
315
  });
304
316
  __classPrivateFieldSet(this, _CoreContext_phase, generatePhase, "f");
305
317
  const generated = generatePhase.context.toArtifacts(st);
318
+ __classPrivateFieldSet(this, _CoreContext_enrichmentWarnings, generated.enrichmentWarnings, "f");
306
319
  // Opt-in snapshot of the live files graph, taken after generate populates
307
320
  // it and before render replaces the phase. Off unless `inspect` is set.
308
321
  return {
@@ -358,7 +371,7 @@ export class CoreContext {
358
371
  previews: {},
359
372
  results: __classPrivateFieldGet(this, _CoreContext_results, "f").toTree(),
360
373
  parseIssues: [...priorIssues, fatalIssue],
361
- enrichmentWarnings: [],
374
+ enrichmentWarnings: error instanceof GenerationFailure ? error.enrichmentWarnings : __classPrivateFieldGet(this, _CoreContext_enrichmentWarnings, "f"),
362
375
  logs: [...__classPrivateFieldGet(this, _CoreContext_logLines, "f").lines]
363
376
  };
364
377
  }
@@ -375,7 +388,7 @@ export class CoreContext {
375
388
  try {
376
389
  __classPrivateFieldSet(this, _CoreContext_phaseName, 'parse', "f");
377
390
  __classPrivateFieldSet(this, _CoreContext_parseIssues, [], "f");
378
- const phase = __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupParsePhase).call(this, document);
391
+ const phase = __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupParsePhase).call(this, document, settings);
379
392
  __classPrivateFieldSet(this, _CoreContext_phase, phase, "f");
380
393
  __classPrivateFieldSet(this, _CoreContext_parseIssues, phase.context.issues, "f");
381
394
  const parsedDocument = stackTrail.trace('parse', st => phase.context.parse(st));
@@ -421,7 +434,7 @@ export class CoreContext {
421
434
  try {
422
435
  __classPrivateFieldSet(this, _CoreContext_phaseName, 'parse', "f");
423
436
  __classPrivateFieldSet(this, _CoreContext_parseIssues, [], "f");
424
- const phase = __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupParsePhase).call(this, document);
437
+ const phase = __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupParsePhase).call(this, document, settings);
425
438
  __classPrivateFieldSet(this, _CoreContext_phase, phase, "f");
426
439
  __classPrivateFieldSet(this, _CoreContext_parseIssues, phase.context.issues, "f");
427
440
  const parsedDocument = stackTrail.trace('parse', st => phase.context.parse(st));
@@ -474,7 +487,7 @@ export class CoreContext {
474
487
  __classPrivateFieldGet(this, _CoreContext_results, "f").capture(stackTrail, result);
475
488
  }
476
489
  }
477
- _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreContext_logLines = new WeakMap(), _CoreContext_phaseName = new WeakMap(), _CoreContext_parseIssues = new WeakMap(), _CoreContext_instances = new WeakSet(), _CoreContext_setupLogger = function _CoreContext_setupLogger({ spanId, logsPath, logLines }) {
490
+ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreContext_logLines = new WeakMap(), _CoreContext_phaseName = new WeakMap(), _CoreContext_parseIssues = new WeakMap(), _CoreContext_enrichmentWarnings = new WeakMap(), _CoreContext_instances = new WeakSet(), _CoreContext_setupLogger = function _CoreContext_setupLogger({ spanId, logsPath, logLines }) {
478
491
  const fileHandlers = logsPath
479
492
  ? [
480
493
  new log.FileHandler('DEBUG', {
@@ -522,11 +535,12 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
522
535
  throw new Error(`Unhandled protocol type: ${JSON.stringify(_exhaustive)}`);
523
536
  }
524
537
  }
525
- }, _CoreContext_setupParsePhase = function _CoreContext_setupParsePhase(input) {
538
+ }, _CoreContext_setupParsePhase = function _CoreContext_setupParsePhase(input, settings) {
526
539
  const parseContext = new ParseContext({
527
540
  input,
528
541
  logger: this.logger,
529
- silent: this.silent
542
+ silent: this.silent,
543
+ system: settings?.system
530
544
  });
531
545
  return { type: 'parse', context: parseContext };
532
546
  }, _CoreContext_setupGeneratePhase = function _CoreContext_setupGeneratePhase({ document, settings, toGeneratorConfigMap, captureChannel }) {
@@ -1,4 +1,5 @@
1
1
  import type { DefinitionBase } from '../dsl/Definition.js';
2
+ import type { PendingDefinition } from '../dsl/PendingDefinition.js';
2
3
  import type { OasSchema } from '../oas/schema/Schema.js';
3
4
  import type { OasRef } from '../oas/ref/Ref.js';
4
5
  import type { SkmtcParsedDocument } from '../types/SkmtcDocument.js';
@@ -6,7 +7,7 @@ import type { SupportedSubjects } from '../types/SupportedSubjects.js';
6
7
  import type { EnrichmentDefaults } from '../types/EnrichmentDefaults.js';
7
8
  import type { BuildModelSettingsArgs, GenerateContextType, GenerateResult, InsertModelOptions, InsertNormalizedModelArgs, InsertNormalizedModelOptions, InsertNormalizedModelReturn, InsertOperationArgs, InsertWebhookArgs, FindDefinitionArgs, ContextRegisterArgs, RegisterJsonArgs, RegisterMarkdownArgs, ToOperationSettingsArgs, ToWebhookSettingsArgs } from './generateTypes.js';
8
9
  import type { ClientSettings } from '../types/Settings.js';
9
- import type { Method } from '../types/Method.js';
10
+ import { type Method } from '../types/Method.js';
10
11
  import type { OasOperation } from '../oas/operation/Operation.js';
11
12
  import type { OasWebhook } from '../oas/webhook/Webhook.js';
12
13
  import { type ProjectionOptionsRest } from '../types/ProjectionOptions.js';
@@ -149,8 +150,8 @@ export declare class GenerateContext implements GenerateContextType {
149
150
  captureCurrentResult: (result: ResultType, stackTrail: StackTrail) => void;
150
151
  /** Function that returns the generator configuration map */
151
152
  toGeneratorConfigMap: <EnrichmentType = undefined>() => GeneratorsMapContainer<EnrichmentType>;
152
- /** Tracking model nesting depth to prevent infinite recursion */
153
- modelDepth: Record<string, number>;
153
+ /** The pending models, outermost first: the last is the model whose projection constructor is running. */
154
+ pendingStack: PendingDefinition[];
154
155
  constructor({ document, settings, logger, captureCurrentResult, toGeneratorConfigMap, captureChannel }: ConstructorArgs);
155
156
  /**
156
157
  * The recording enrichment accessor — the single choke point every
@@ -329,7 +330,7 @@ export declare class GenerateContext implements GenerateContextType {
329
330
  * @returns Matching schema or ref
330
331
  * @throws if schema is not found
331
332
  */
332
- resolveSchemaRefOnce(refName: RefName, generatorId: string): OasSchema | OasRef<'schema'>;
333
+ resolveSchemaRefOnce(refName: RefName): OasSchema | OasRef<'schema'>;
333
334
  /**
334
335
  * Check if definition name `name` in file with path `exportPath`
335
336
  * has already been created and registered.
@@ -9,9 +9,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
9
9
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
- var _GenerateContext_instances, _GenerateContext_files, _GenerateContext_previews, _GenerateContext_captureChannel, _GenerateContext_enrichmentAudit, _GenerateContext_currentSubjectTrail, _GenerateContext_reportSkippedEnrichment, _GenerateContext_logError, _GenerateContext_schemaRefNames, _GenerateContext_subjectDefaults, _GenerateContext_runOasOperationGenerator, _GenerateContext_runWebhookGenerator, _GenerateContext_runGqlOperationGenerator, _GenerateContext_runModelGenerator, _GenerateContext_addPreview, _GenerateContext_toContentSettingsExportPath, _GenerateContext_ejectedBySuffixedPath_get, _GenerateContext_ejectedBySuffixedPathCache, _GenerateContext_findContainer, _GenerateContext_toContainer;
12
+ var _GenerateContext_instances, _GenerateContext_files, _GenerateContext_failedItems, _GenerateContext_foldedPaths, _GenerateContext_previews, _GenerateContext_captureChannel, _GenerateContext_enrichmentAudit, _GenerateContext_currentSubjectTrail, _GenerateContext_reportSkippedEnrichment, _GenerateContext_logError, _GenerateContext_failItem, _GenerateContext_schemaRefNames, _GenerateContext_subjectDefaults, _GenerateContext_runOasOperationGenerator, _GenerateContext_runWebhookGenerator, _GenerateContext_runGqlOperationGenerator, _GenerateContext_runModelGenerator, _GenerateContext_addPreview, _GenerateContext_toContentSettingsExportPath, _GenerateContext_ejectedBySuffixedPath_get, _GenerateContext_ejectedBySuffixedPathCache, _GenerateContext_findContainer, _GenerateContext_toContainer;
13
13
  import { normalizeWorkspacePath } from '../helpers/normalizeWorkspacePath.js';
14
14
  import { applyGeneratedSuffix, DEFAULT_GENERATED_SUFFIX } from '../helpers/applyGeneratedSuffix.js';
15
+ import { isMethod } from '../types/Method.js';
15
16
  import { OasOperationDriver } from '../dsl/operation/oas/OasOperationDriver.js';
16
17
  import { WebhookDriver } from '../dsl/webhook/WebhookDriver.js';
17
18
  import { GqlOperationDriver } from '../dsl/operation/gql/GqlOperationDriver.js';
@@ -30,6 +31,7 @@ import { MarkdownFile } from '../dsl/MarkdownFile.js';
30
31
  import invariant from 'tiny-invariant';
31
32
  import { EnrichmentAudit, hasVariantEnrichment } from '../enrichments/EnrichmentAudit.js';
32
33
  import { toSerializedError } from '../types/SerializedError.js';
34
+ import { GenerationFailure } from './toGenerationFailure.js';
33
35
  import { formatEnrichmentPath } from '../enrichments/EnrichmentWarning.js';
34
36
  /**
35
37
  * The generation context for the second phase of the SKMTC transformation pipeline.
@@ -83,6 +85,12 @@ export class GenerateContext {
83
85
  constructor({ document, settings, logger, captureCurrentResult, toGeneratorConfigMap, captureChannel }) {
84
86
  _GenerateContext_instances.add(this);
85
87
  _GenerateContext_files.set(this, void 0);
88
+ /** Each subject whose generation threw: its trail and the error message. */
89
+ _GenerateContext_failedItems.set(this, []
90
+ /** Each file's path folded (case, Unicode form) → the path: a file system that ignores case sees one file. */
91
+ );
92
+ /** Each file's path folded (case, Unicode form) → the path: a file system that ignores case sees one file. */
93
+ _GenerateContext_foldedPaths.set(this, new Map());
86
94
  _GenerateContext_previews.set(this, void 0);
87
95
  /**
88
96
  * Parsed source document, wrapped in the {@link SkmtcParsedDocument}
@@ -123,12 +131,12 @@ export class GenerateContext {
123
131
  writable: true,
124
132
  value: void 0
125
133
  });
126
- /** Tracking model nesting depth to prevent infinite recursion */
127
- Object.defineProperty(this, "modelDepth", {
134
+ /** The pending models, outermost first: the last is the model whose projection constructor is running. */
135
+ Object.defineProperty(this, "pendingStack", {
128
136
  enumerable: true,
129
137
  configurable: true,
130
138
  writable: true,
131
- value: void 0
139
+ value: []
132
140
  });
133
141
  /**
134
142
  * Creates a new GenerateContext instance for the generation phase.
@@ -152,7 +160,6 @@ export class GenerateContext {
152
160
  this.settings = settings;
153
161
  this.captureCurrentResult = captureCurrentResult;
154
162
  this.toGeneratorConfigMap = toGeneratorConfigMap;
155
- this.modelDepth = {};
156
163
  __classPrivateFieldSet(this, _GenerateContext_captureChannel, captureChannel, "f");
157
164
  __classPrivateFieldSet(this, _GenerateContext_enrichmentAudit, new EnrichmentAudit(), "f");
158
165
  }
@@ -228,18 +235,15 @@ export class GenerateContext {
228
235
  // extracted below is applied per-operation in the run* arms.
229
236
  // (Whole-generator opt-out is `skip`. A bare-string `include`
230
237
  // entry carries no per-operation filter and is a no-op.)
231
- const skip = this.settings?.skip?.find((skip) => {
232
- return typeof skip === 'object' && Boolean(skip[generatorConfig.id]);
233
- });
238
+ // skmtc#330: every object entry for this generator, merged, not only the first one.
239
+ const skip = toGeneratorFilter(this.settings?.skip, generatorConfig.id);
234
240
  // Extract the per-generator include slice (if any). Same
235
241
  // dispatch shape as skip: object entries get matched by key,
236
242
  // string entries don't produce a per-op filter (they mean
237
243
  // "everything from this generator is included", which is
238
244
  // semantically equivalent to "no per-op filter" once the
239
245
  // whole-generator gate above has admitted us).
240
- const include = this.settings?.include?.find((entry) => {
241
- return typeof entry === 'object' && Boolean(entry[generatorConfig.id]);
242
- });
246
+ const include = toGeneratorFilter(this.settings?.include, generatorConfig.id);
243
247
  switch (generatorConfig.type) {
244
248
  case 'oasOperation':
245
249
  if (this.document.type !== 'oas') {
@@ -289,6 +293,13 @@ export class GenerateContext {
289
293
  generators: generators.map(({ id, type }) => ({ id, type })),
290
294
  skippedGeneratorIds: (this.settings?.skip ?? []).filter((entry) => typeof entry === 'string')
291
295
  });
296
+ // Generation runs our code over a document parsing has already made
297
+ // safe, so an error here is a bug to fix, not data to tolerate: the run
298
+ // fails, and writes nothing. Every subject that failed is in the log
299
+ // and in the results.
300
+ if (__classPrivateFieldGet(this, _GenerateContext_failedItems, "f").length > 0) {
301
+ throw new GenerationFailure(__classPrivateFieldGet(this, _GenerateContext_failedItems, "f"), enrichmentWarnings);
302
+ }
292
303
  return {
293
304
  files: __classPrivateFieldGet(this, _GenerateContext_files, "f"),
294
305
  previews: __classPrivateFieldGet(this, _GenerateContext_previews, "f"),
@@ -496,7 +507,16 @@ export class GenerateContext {
496
507
  if (__classPrivateFieldGet(this, _GenerateContext_files, "f").has(normalizedPath)) {
497
508
  throw new Error(`File already exists: ${normalizedPath}`);
498
509
  }
510
+ // Two paths that differ only in case are one file on a file system that
511
+ // ignores case, as macOS's and Windows' do by default: writing the
512
+ // second would replace the first without a word.
513
+ const foldedPath = normalizedPath.normalize('NFD').toLowerCase();
514
+ const existingPath = __classPrivateFieldGet(this, _GenerateContext_foldedPaths, "f").get(foldedPath);
515
+ if (existingPath !== undefined) {
516
+ throw new Error(`File '${normalizedPath}' differs from '${existingPath}' only in case. On a file system that ignores case, as macOS's and Windows' do by default, they are one file.`);
517
+ }
499
518
  __classPrivateFieldGet(this, _GenerateContext_files, "f").set(normalizedPath, file);
519
+ __classPrivateFieldGet(this, _GenerateContext_foldedPaths, "f").set(foldedPath, normalizedPath);
500
520
  return file;
501
521
  }
502
522
  /**
@@ -634,10 +654,7 @@ export class GenerateContext {
634
654
  // @TODO Using mapped types would help avoid generics casting
635
655
  return definition;
636
656
  }
637
- const cachedDefinition = this.findDefinition({
638
- name: fallbackName,
639
- exportPath: destinationPath
640
- });
657
+ const cachedDefinition = this.findDefinition({ name: fallbackName, exportPath: destinationPath });
641
658
  // @TODO add check to make sure retrieved definition
642
659
  // used same generator and same schema #SKM-47
643
660
  if (cachedDefinition) {
@@ -815,20 +832,34 @@ export class GenerateContext {
815
832
  * @returns Matching schema or ref
816
833
  * @throws if schema is not found
817
834
  */
818
- resolveSchemaRefOnce(refName, generatorId) {
819
- this.modelDepth[`${generatorId}:${refName}`]++;
820
- const schema = this.document.type === 'oas'
821
- ? this.document.value.components?.schemas?.[refName]?.resolveOnce()
822
- : this.document.value.registry.schemas[refName];
823
- if (!schema) {
824
- throw new Error(`Schema not found: ${refName}`);
825
- }
826
- // GqlRegistry stores raw OasSchema | OasRef entries that we need to
827
- // resolve once for parity with the OAS code path.
828
- if (this.document.type === 'gql' && 'resolveOnce' in schema) {
829
- return schema.resolveOnce();
835
+ resolveSchemaRefOnce(refName) {
836
+ switch (this.document.type) {
837
+ case 'oas': {
838
+ const component = this.document.value.components?.schemas?.[refName];
839
+ if (!component) {
840
+ throw new Error(`Schema not found: ${refName}`);
841
+ }
842
+ const target = component.resolveOnce();
843
+ // One step, with what the component adds next to its reference
844
+ // (`{ allOf: [{ $ref: Name }], maxLength: 10, nullable: true }`)
845
+ // applied to a copy: the model is the target at this site. When the
846
+ // step is itself a reference, the copy is a reference, and the
847
+ // model's router decides whether it renders inline or by name.
848
+ return component.isRef() && component.hasSiblings() ? target.clone(component) : target;
849
+ }
850
+ case 'gql': {
851
+ const schema = this.document.value.registry.schemas[refName];
852
+ if (!schema) {
853
+ throw new Error(`Schema not found: ${refName}`);
854
+ }
855
+ // GqlRegistry stores OasSchema | OasRef entries: one step, as for OAS.
856
+ return schema.resolveOnce();
857
+ }
858
+ default: {
859
+ const _exhaustive = this.document;
860
+ throw new Error(`Unhandled document type: ${JSON.stringify(_exhaustive)}`);
861
+ }
830
862
  }
831
- return schema;
832
863
  }
833
864
  /**
834
865
  * Check if definition name `name` in file with path `exportPath`
@@ -853,7 +884,7 @@ export class GenerateContext {
853
884
  return place?.findDefinitions({ name })?.[0];
854
885
  }
855
886
  }
856
- _GenerateContext_files = new WeakMap(), _GenerateContext_previews = new WeakMap(), _GenerateContext_captureChannel = new WeakMap(), _GenerateContext_enrichmentAudit = new WeakMap(), _GenerateContext_currentSubjectTrail = new WeakMap(), _GenerateContext_ejectedBySuffixedPathCache = new WeakMap(), _GenerateContext_instances = new WeakSet(), _GenerateContext_reportSkippedEnrichment = function _GenerateContext_reportSkippedEnrichment(block, variant, path) {
887
+ _GenerateContext_files = new WeakMap(), _GenerateContext_failedItems = new WeakMap(), _GenerateContext_foldedPaths = new WeakMap(), _GenerateContext_previews = new WeakMap(), _GenerateContext_captureChannel = new WeakMap(), _GenerateContext_enrichmentAudit = new WeakMap(), _GenerateContext_currentSubjectTrail = new WeakMap(), _GenerateContext_ejectedBySuffixedPathCache = new WeakMap(), _GenerateContext_instances = new WeakSet(), _GenerateContext_reportSkippedEnrichment = function _GenerateContext_reportSkippedEnrichment(block, variant, path) {
857
888
  if (!hasVariantEnrichment(block, variant))
858
889
  return;
859
890
  __classPrivateFieldGet(this, _GenerateContext_enrichmentAudit, "f").report({
@@ -865,6 +896,10 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_previews = new WeakMap(
865
896
  });
866
897
  }, _GenerateContext_logError = function _GenerateContext_logError(error) {
867
898
  this.logger.error(toSerializedError(error).message, error);
899
+ }, _GenerateContext_failItem = function _GenerateContext_failItem(error, stackTrail) {
900
+ __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_logError).call(this, error);
901
+ this.captureCurrentResult('error', stackTrail);
902
+ __classPrivateFieldGet(this, _GenerateContext_failedItems, "f").push({ trail: `${stackTrail}`, message: toSerializedError(error).message });
868
903
  }, _GenerateContext_schemaRefNames = function _GenerateContext_schemaRefNames() {
869
904
  switch (this.document.type) {
870
905
  case 'oas':
@@ -971,8 +1006,7 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_previews = new WeakMap(
971
1006
  this.captureCurrentResult('success', st);
972
1007
  }
973
1008
  catch (error) {
974
- __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_logError).call(this, error);
975
- this.captureCurrentResult('error', st);
1009
+ __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_failItem).call(this, error, st);
976
1010
  }
977
1011
  }));
978
1012
  });
@@ -1052,8 +1086,7 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_previews = new WeakMap(
1052
1086
  this.captureCurrentResult('success', st);
1053
1087
  }
1054
1088
  catch (error) {
1055
- __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_logError).call(this, error);
1056
- this.captureCurrentResult('error', st);
1089
+ __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_failItem).call(this, error, st);
1057
1090
  }
1058
1091
  }));
1059
1092
  });
@@ -1096,8 +1129,7 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_previews = new WeakMap(
1096
1129
  this.captureCurrentResult('success', st);
1097
1130
  }
1098
1131
  catch (error) {
1099
- __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_logError).call(this, error);
1100
- this.captureCurrentResult('error', st);
1132
+ __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_failItem).call(this, error, st);
1101
1133
  }
1102
1134
  }));
1103
1135
  });
@@ -1171,8 +1203,7 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_previews = new WeakMap(
1171
1203
  this.captureCurrentResult('success', st);
1172
1204
  }
1173
1205
  catch (error) {
1174
- __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_logError).call(this, error);
1175
- this.captureCurrentResult('error', st);
1206
+ __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_failItem).call(this, error, st);
1176
1207
  }
1177
1208
  }));
1178
1209
  });
@@ -1330,6 +1361,48 @@ export const toModelSource = ({ refName, generatorId, variant }) => ({
1330
1361
  refName,
1331
1362
  variant
1332
1363
  });
1364
+ /** Variants of one subject. `[]` is every variant, so it wins a merge. */
1365
+ const mergeVariants = (a, b) => a.length === 0 || b.length === 0 ? [] : [...new Set([...a, ...b])];
1366
+ /** Whether a filter is operation-shaped: its values are records of methods, not lists of variants. */
1367
+ const isPathsFilter = (filter) => Object.values(filter).every(value => !Array.isArray(value));
1368
+ const mergePathsFilters = (a, b) => Object.entries(b).reduce((merged, [path, methods]) => {
1369
+ const existing = merged[path] ?? {};
1370
+ const combined = Object.entries(methods).reduce((acc, [method, variants]) => {
1371
+ if (!isMethod(method) || variants === undefined) {
1372
+ return acc;
1373
+ }
1374
+ const current = acc[method];
1375
+ return { ...acc, [method]: current === undefined ? variants : mergeVariants(current, variants) };
1376
+ }, { ...existing });
1377
+ return { ...merged, [path]: combined };
1378
+ }, { ...a });
1379
+ const mergeModelsFilters = (a, b) => Object.entries(b).reduce((merged, [refName, variants]) => {
1380
+ const current = merged[refName];
1381
+ return { ...merged, [refName]: current === undefined ? variants : mergeVariants(current, variants) };
1382
+ }, { ...a });
1383
+ /** Two filters of one generator, merged. Filters of two shapes cannot merge: the first stays. */
1384
+ const mergeFilters = (a, b) => {
1385
+ if (isPathsFilter(a) && isPathsFilter(b)) {
1386
+ return mergePathsFilters(a, b);
1387
+ }
1388
+ if (!isPathsFilter(a) && !isPathsFilter(b)) {
1389
+ return mergeModelsFilters(a, b);
1390
+ }
1391
+ return a;
1392
+ };
1393
+ /**
1394
+ * The `skip` or `include` filter of one generator: every object entry that
1395
+ * names it, merged (skmtc#330). Before, only the first entry applied, and a
1396
+ * later one was ignored with no warning. `undefined` when no entry names it.
1397
+ */
1398
+ const toGeneratorFilter = (entries, generatorId) => {
1399
+ const filters = (entries ?? []).flatMap(entry => {
1400
+ const filter = typeof entry === 'object' ? entry[generatorId] : undefined;
1401
+ return filter === undefined ? [] : [filter];
1402
+ });
1403
+ const [first, ...rest] = filters;
1404
+ return first === undefined ? undefined : { [generatorId]: rest.reduce(mergeFilters, first) };
1405
+ };
1333
1406
  const toSkipPaths = (skip, generatorId) => {
1334
1407
  const generatorSkip = skip?.[generatorId];
1335
1408
  // Operation-shaped entries have records-of-records at the inner
@@ -18,6 +18,7 @@
18
18
  import "../_dnt.polyfills.js";
19
19
  import type { OpenAPIV3 } from 'openapi-types';
20
20
  import { type GraphQLSchema } from 'graphql';
21
+ import type { SystemSettings } from '../types/Settings.js';
21
22
  import { OasDocument } from '../oas/document/Document.js';
22
23
  import { GqlRegistry } from '../gql/registry/GqlRegistry.js';
23
24
  import { GqlDocument } from '../gql/document/GqlDocument.js';
@@ -61,6 +62,8 @@ type ConstructorArgs = {
61
62
  options?: {
62
63
  gql?: GqlParseOptions;
63
64
  };
65
+ /** `client.json#settings.system`: how the OpenAPI parsers treat what they cannot read faithfully. */
66
+ system?: SystemSettings;
64
67
  };
65
68
  export declare class ParseContext {
66
69
  #private;
@@ -75,7 +78,12 @@ export declare class ParseContext {
75
78
  * `undefined` outside an active `withStackTrail` scope.
76
79
  */
77
80
  currentStackTrail: StackTrail | undefined;
78
- constructor({ input, logger, silent, options }: ConstructorArgs);
81
+ /**
82
+ * How the OpenAPI parsers treat what they cannot read faithfully
83
+ * (`client.json#settings.system`). Each setting left out is `strict`.
84
+ */
85
+ system: SystemSettings;
86
+ constructor({ input, logger, silent, options, system }: ConstructorArgs);
79
87
  /**
80
88
  * OAS-only accessor. Throws when called on a GQL-protocol context —
81
89
  * deliberate, because OAS parser code uses this and a misroute is a
@@ -60,7 +60,7 @@ const toParseIssue = (issue) => {
60
60
  }
61
61
  };
62
62
  export class ParseContext {
63
- constructor({ input, logger, silent = true, options }) {
63
+ constructor({ input, logger, silent = true, options, system }) {
64
64
  _ParseContext_instances.add(this);
65
65
  Object.defineProperty(this, "issues", {
66
66
  enumerable: true,
@@ -98,6 +98,16 @@ export class ParseContext {
98
98
  writable: true,
99
99
  value: void 0
100
100
  });
101
+ /**
102
+ * How the OpenAPI parsers treat what they cannot read faithfully
103
+ * (`client.json#settings.system`). Each setting left out is `strict`.
104
+ */
105
+ Object.defineProperty(this, "system", {
106
+ enumerable: true,
107
+ configurable: true,
108
+ writable: true,
109
+ value: void 0
110
+ });
101
111
  // Universal dependency-ref tracking. Populated by parsers as they
102
112
  // encounter references. OAS uses `$ref` strings as keys; GQL would
103
113
  // use type names. The maps don't care about the encoding.
@@ -117,6 +127,7 @@ export class ParseContext {
117
127
  _ParseContext_rootFrames.set(this, []);
118
128
  this.logger = logger;
119
129
  this.silent = silent;
130
+ this.system = system ?? {};
120
131
  switch (input.type) {
121
132
  case 'oas': {
122
133
  this.protocol = {
@@ -6,6 +6,7 @@ import type { ResultsItem } from '../types/Results.js';
6
6
  import type { OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';
7
7
  import type { GeneratedValue } from '../dsl/GeneratedValue.js';
8
8
  import type { DefinitionBase } from '../dsl/Definition.js';
9
+ import type { PendingDefinition } from '../dsl/PendingDefinition.js';
9
10
  import type { OasOperation } from '../oas/operation/Operation.js';
10
11
  import type { OasOperationProjection } from '../dsl/operation/oas/types.js';
11
12
  import type { OasWebhook } from '../oas/webhook/Webhook.js';
@@ -176,11 +177,19 @@ export type AnyOasDocument = OpenAPIV2.Document | OpenAPIV3.Document | OpenAPIV3
176
177
  * scalar schema (a text body or a file). A body with only specific
177
178
  * non-JSON types (`multipart/form-data`, `text/plain`) logs nothing.
178
179
  *
180
+ * `ALLOF_CONTRADICTION` (`warning`) — `allOf` members contradict, and
181
+ * `system.allOf: latestWins` kept the later member's keywords. One for each
182
+ * schema; the message names the keywords.
183
+ *
184
+ * `ANYOF_AS_UNKNOWN` (`warning`) — `system.anyOf: unknown` read an `anyOf`
185
+ * of two or more members as any value. The schema keeps its other keywords.
186
+ * One for each schema.
187
+ *
179
188
  * `RUN_FAILED` (`error`) — the run itself failed outside the per-item
180
189
  * catches. Its `location` names the entry and phase, for example
181
190
  * `toArtifacts:render`.
182
191
  */
183
- export type OasIssueType = 'UNEXPECTED_PROPERTY' | 'MISSING_OBJECT_TYPE' | 'MISSING_STRING_TYPE' | 'MISSING_ARRAY_TYPE' | 'MISSING_BOOLEAN_TYPE' | 'MISSING_RESPONSES' | 'MISSING_INFO' | 'EMPTY_PARAMETER' | 'INVALID_EXAMPLE' | 'INVALID_ENUM' | 'INVALID_DEFAULT' | 'INVALID_NULLABLE' | 'UNEXPECTED_FORMAT' | 'INVALID_RESPONSE' | 'INVALID_REQUEST_BODY' | 'INVALID_HEADER' | 'INVALID_FORMAT' | 'INVALID_OPERATION' | 'INVALID_SCHEMA' | 'INVALID_PARAMETER' | 'INVALID_SECURITY_SCHEME' | 'INVALID_DEPENDENCY_REF' | 'EXAMPLE_AND_EXAMPLES_DEFINED' | 'INVALID_TAG_PARENT' | 'INVALID_TAG' | 'INVALID_EXTERNAL_DOCS' | 'UNSUPPORTED_OPERATION_METHOD' | 'WILDCARD_MEDIA_TYPE' | 'NO_JSON_MEDIA_TYPE' | 'RUN_FAILED';
192
+ export type OasIssueType = 'UNEXPECTED_PROPERTY' | 'MISSING_OBJECT_TYPE' | 'MISSING_STRING_TYPE' | 'MISSING_ARRAY_TYPE' | 'MISSING_BOOLEAN_TYPE' | 'MISSING_RESPONSES' | 'MISSING_INFO' | 'EMPTY_PARAMETER' | 'INVALID_EXAMPLE' | 'INVALID_ENUM' | 'INVALID_DEFAULT' | 'INVALID_NULLABLE' | 'UNEXPECTED_FORMAT' | 'INVALID_RESPONSE' | 'INVALID_REQUEST_BODY' | 'INVALID_HEADER' | 'INVALID_FORMAT' | 'INVALID_OPERATION' | 'INVALID_SCHEMA' | 'INVALID_PARAMETER' | 'INVALID_SECURITY_SCHEME' | 'INVALID_DEPENDENCY_REF' | 'EXAMPLE_AND_EXAMPLES_DEFINED' | 'INVALID_TAG_PARENT' | 'INVALID_TAG' | 'INVALID_EXTERNAL_DOCS' | 'UNSUPPORTED_OPERATION_METHOD' | 'WILDCARD_MEDIA_TYPE' | 'NO_JSON_MEDIA_TYPE' | 'ALLOF_CONTRADICTION' | 'ANYOF_AS_UNKNOWN' | 'RUN_FAILED';
184
193
  /**
185
194
  * Valibot schema for {@link OasIssueType}. Annotation deliberately omitted
186
195
  * so the precise literal-union output type flows through to consumers
@@ -188,7 +197,7 @@ export type OasIssueType = 'UNEXPECTED_PROPERTY' | 'MISSING_OBJECT_TYPE' | 'MISS
188
197
  * this list and {@link OasIssueType} is caught by `assertSchemaMatchesType`
189
198
  * below.
190
199
  */
191
- 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<"MISSING_RESPONSES", undefined>, v.LiteralSchema<"MISSING_INFO", undefined>, v.LiteralSchema<"EMPTY_PARAMETER", 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_REQUEST_BODY", undefined>, v.LiteralSchema<"INVALID_HEADER", 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<"INVALID_TAG", undefined>, v.LiteralSchema<"INVALID_EXTERNAL_DOCS", undefined>, v.LiteralSchema<"UNSUPPORTED_OPERATION_METHOD", undefined>, v.LiteralSchema<"WILDCARD_MEDIA_TYPE", undefined>, v.LiteralSchema<"NO_JSON_MEDIA_TYPE", undefined>, v.LiteralSchema<"RUN_FAILED", undefined>], undefined>;
200
+ 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<"MISSING_RESPONSES", undefined>, v.LiteralSchema<"MISSING_INFO", undefined>, v.LiteralSchema<"EMPTY_PARAMETER", 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_REQUEST_BODY", undefined>, v.LiteralSchema<"INVALID_HEADER", 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<"INVALID_TAG", undefined>, v.LiteralSchema<"INVALID_EXTERNAL_DOCS", undefined>, v.LiteralSchema<"UNSUPPORTED_OPERATION_METHOD", undefined>, v.LiteralSchema<"WILDCARD_MEDIA_TYPE", undefined>, v.LiteralSchema<"NO_JSON_MEDIA_TYPE", undefined>, v.LiteralSchema<"ALLOF_CONTRADICTION", undefined>, v.LiteralSchema<"ANYOF_AS_UNKNOWN", undefined>, v.LiteralSchema<"RUN_FAILED", undefined>], undefined>;
192
201
  export type GenerateResult = {
193
202
  files: Map<string, FileBase>;
194
203
  previews: Record<string, Preview>;
@@ -415,7 +424,12 @@ export type GenerateContextType = {
415
424
  * subject's result to `'warning'` or `'error'`.
416
425
  */
417
426
  logger: Logger;
418
- modelDepth: Record<string, number>;
427
+ /**
428
+ * The pending models, outermost first: the last is the model whose
429
+ * projection constructor is running, the source of any reference made now.
430
+ * Kept by the `ModelDriver`.
431
+ */
432
+ pendingStack: PendingDefinition[];
419
433
  document: SkmtcParsedDocument;
420
434
  /**
421
435
  * Attribution (gen-maps) state. When set, every `SnippetBase`
@@ -451,7 +465,8 @@ export type GenerateContextType = {
451
465
  insertWebhook: <V extends GeneratedValue, EnrichmentType = undefined, ProjectionOptions = undefined>(args: InsertWebhookArgs<V, EnrichmentType, ProjectionOptions>) => Inserted<V, EnrichmentType>;
452
466
  toWebhookContentSettings: <V extends GeneratedValue, EnrichmentType, ProjectionOptions>(args: ToWebhookSettingsArgs<V, EnrichmentType, ProjectionOptions>) => ContentSettings<EnrichmentType>;
453
467
  toModelContentSettings: <V extends GeneratedValue, EnrichmentType, ProjectionOptions>(args: BuildModelSettingsArgs<V, EnrichmentType, ProjectionOptions>) => ContentSettings<EnrichmentType>;
454
- resolveSchemaRefOnce: (refName: RefName, generatorId: string) => OasSchema | OasRef<'schema'>;
468
+ resolveSchemaRefOnce: (refName: RefName) => OasSchema | OasRef<'schema'>;
469
+ /** The Definition named `name` in `exportPath` (or inside the declaration `into`), or `undefined`. */
455
470
  findDefinition: ({ name, exportPath, into }: FindDefinitionArgs) => DefinitionBase | undefined;
456
471
  /**
457
472
  * The recording enrichment accessor — the single choke point every
@@ -36,6 +36,8 @@ export const oasIssueType = v.union([
36
36
  v.literal('UNSUPPORTED_OPERATION_METHOD'),
37
37
  v.literal('WILDCARD_MEDIA_TYPE'),
38
38
  v.literal('NO_JSON_MEDIA_TYPE'),
39
+ v.literal('ALLOF_CONTRADICTION'),
40
+ v.literal('ANYOF_AS_UNKNOWN'),
39
41
  v.literal('RUN_FAILED')
40
42
  ]);
41
43
  // Compile-time drift detector: this binding fails to type-check if
@@ -0,0 +1,21 @@
1
+ import type { EnrichmentWarning } from '../enrichments/EnrichmentWarning.js';
2
+ /** A subject whose generation threw: its trail and the error message. */
3
+ export type FailedItem = {
4
+ trail: string;
5
+ message: string;
6
+ };
7
+ /**
8
+ * The message of a run that failed in generate. Each distinct error is
9
+ * written once, with the subjects it failed: one wrong enrichment fails
10
+ * every subject that reads it, and the user needs to read it only once.
11
+ */
12
+ export declare const toGenerationFailure: (failedItems: readonly FailedItem[]) => string;
13
+ /**
14
+ * The error a run that failed in generate throws. It carries the
15
+ * enrichment warnings the audit found, since a misaddressed enrichment is
16
+ * often why a subject failed.
17
+ */
18
+ export declare class GenerationFailure extends Error {
19
+ enrichmentWarnings: EnrichmentWarning[];
20
+ constructor(failedItems: readonly FailedItem[], enrichmentWarnings: EnrichmentWarning[]);
21
+ }
@@ -0,0 +1,38 @@
1
+ /** How many trails each message lists before it counts the rest. */
2
+ const SHOWN_TRAILS = 5;
3
+ /**
4
+ * The message of a run that failed in generate. Each distinct error is
5
+ * written once, with the subjects it failed: one wrong enrichment fails
6
+ * every subject that reads it, and the user needs to read it only once.
7
+ */
8
+ export const toGenerationFailure = (failedItems) => {
9
+ const byMessage = Map.groupBy(failedItems, ({ message }) => message);
10
+ const paragraphs = [...byMessage].map(([message, items]) => {
11
+ const trails = items.map(({ trail }) => ` in ${trail}`);
12
+ const hidden = trails.length - SHOWN_TRAILS;
13
+ return [
14
+ message,
15
+ ...trails.slice(0, SHOWN_TRAILS),
16
+ ...(hidden > 0 ? [` and ${hidden} more`] : [])
17
+ ].join('\n');
18
+ });
19
+ return `Generation failed for ${failedItems.length} subject(s):\n${paragraphs.join('\n\n')}`;
20
+ };
21
+ /**
22
+ * The error a run that failed in generate throws. It carries the
23
+ * enrichment warnings the audit found, since a misaddressed enrichment is
24
+ * often why a subject failed.
25
+ */
26
+ export class GenerationFailure extends Error {
27
+ constructor(failedItems, enrichmentWarnings) {
28
+ super(toGenerationFailure(failedItems));
29
+ Object.defineProperty(this, "enrichmentWarnings", {
30
+ enumerable: true,
31
+ configurable: true,
32
+ writable: true,
33
+ value: void 0
34
+ });
35
+ this.name = 'GenerationFailure';
36
+ this.enrichmentWarnings = enrichmentWarnings;
37
+ }
38
+ }
@@ -44,6 +44,10 @@ export declare class CustomValue extends SnippetBase {
44
44
  * @returns Always false since custom values are concrete content, not references
45
45
  */
46
46
  isRef(): this is OasRef<'schema'>;
47
+ /** Always `false`: this value has no `readOnly`. */
48
+ isReadOnly(): boolean;
49
+ /** Always `false`: this value has no `writeOnly`. */
50
+ isWriteOnly(): boolean;
47
51
  /**
48
52
  * Resolves this custom value.
49
53
  *