@skmtc/core 0.39.0 → 0.41.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 (373) hide show
  1. package/esm/context/CoreContext.js +22 -8
  2. package/esm/context/GenerateContext.d.ts +6 -5
  3. package/esm/context/GenerateContext.js +112 -38
  4. package/esm/context/ParseContext.d.ts +18 -1
  5. package/esm/context/ParseContext.js +102 -3
  6. package/esm/context/generateTypes.d.ts +33 -4
  7. package/esm/context/generateTypes.js +4 -0
  8. package/esm/context/toGenerationFailure.d.ts +21 -0
  9. package/esm/context/toGenerationFailure.js +38 -0
  10. package/esm/context/tryParseAt.d.ts +4 -1
  11. package/esm/context/tryParseAt.js +10 -3
  12. package/esm/dsl/CustomValue.d.ts +4 -0
  13. package/esm/dsl/CustomValue.js +8 -0
  14. package/esm/dsl/Definition.d.ts +10 -0
  15. package/esm/dsl/Definition.js +14 -0
  16. package/esm/dsl/PendingDefinition.d.ts +47 -0
  17. package/esm/dsl/PendingDefinition.js +83 -0
  18. package/esm/dsl/model/ModelDriver.d.ts +55 -1
  19. package/esm/dsl/model/ModelDriver.js +228 -51
  20. package/esm/dsl/model/toModelEntry.d.ts +1 -1
  21. package/esm/dsl/model/toModelEntry.js +1 -1
  22. package/esm/dsl/model/types.d.ts +1 -1
  23. package/esm/dsl/operation/gql/GqlOperationDriver.js +1 -4
  24. package/esm/dsl/webhook/WebhookDriver.js +1 -4
  25. package/esm/enrichments/parseEnrichmentUmbrella.d.ts +5 -6
  26. package/esm/enrichments/parseEnrichmentUmbrella.js +23 -8
  27. package/esm/enrichments/parseEnrichmentValue.d.ts +17 -0
  28. package/esm/enrichments/parseEnrichmentValue.js +32 -0
  29. package/esm/enrichments/readEnrichments.d.ts +5 -5
  30. package/esm/enrichments/readEnrichments.js +17 -7
  31. package/esm/helpers/collateExamples.js +15 -5
  32. package/esm/helpers/refFns.d.ts +6 -2
  33. package/esm/helpers/refFns.js +24 -7
  34. package/esm/mod.d.ts +2 -0
  35. package/esm/mod.js +2 -0
  36. package/esm/oas/array/Array.d.ts +19 -0
  37. package/esm/oas/array/Array.js +47 -0
  38. package/esm/oas/boolean/Boolean.d.ts +19 -0
  39. package/esm/oas/boolean/Boolean.js +51 -8
  40. package/esm/oas/example/Example.d.ts +4 -0
  41. package/esm/oas/example/Example.js +8 -0
  42. package/esm/oas/header/Header.d.ts +4 -0
  43. package/esm/oas/header/Header.js +8 -0
  44. package/esm/oas/integer/Integer.d.ts +19 -0
  45. package/esm/oas/integer/Integer.js +49 -0
  46. package/esm/oas/link/Link.d.ts +4 -0
  47. package/esm/oas/link/Link.js +8 -0
  48. package/esm/oas/number/Number.d.ts +19 -0
  49. package/esm/oas/number/Number.js +49 -0
  50. package/esm/oas/object/Object.d.ts +19 -0
  51. package/esm/oas/object/Object.js +68 -18
  52. package/esm/oas/operation/Operation.d.ts +8 -1
  53. package/esm/oas/operation/Operation.js +18 -5
  54. package/esm/oas/operation/toEffectiveParameters.d.ts +24 -0
  55. package/esm/oas/operation/toEffectiveParameters.js +42 -0
  56. package/esm/oas/parameter/Parameter.d.ts +4 -0
  57. package/esm/oas/parameter/Parameter.js +8 -0
  58. package/esm/oas/ref/DanglingRefError.d.ts +22 -0
  59. package/esm/oas/ref/DanglingRefError.js +33 -0
  60. package/esm/oas/ref/Ref.d.ts +152 -25
  61. package/esm/oas/ref/Ref.js +414 -26
  62. package/esm/oas/requestBody/RequestBody.d.ts +4 -0
  63. package/esm/oas/requestBody/RequestBody.js +8 -0
  64. package/esm/oas/response/Response.d.ts +4 -0
  65. package/esm/oas/response/Response.js +8 -0
  66. package/esm/oas/schema/siblings.d.ts +127 -0
  67. package/esm/oas/schema/siblings.js +250 -0
  68. package/esm/oas/securitySchemes/SecurityScheme.d.ts +16 -0
  69. package/esm/oas/securitySchemes/SecurityScheme.js +32 -0
  70. package/esm/oas/string/String.d.ts +19 -0
  71. package/esm/oas/string/String.js +47 -0
  72. package/esm/oas/union/Union.d.ts +32 -0
  73. package/esm/oas/union/Union.js +111 -0
  74. package/esm/oas/unknown/Unknown.d.ts +18 -0
  75. package/esm/oas/unknown/Unknown.js +38 -0
  76. package/esm/oas/void/Void.d.ts +4 -0
  77. package/esm/oas/void/Void.js +8 -0
  78. package/esm/oas/webhook/Webhook.d.ts +2 -2
  79. package/esm/oas/webhook/Webhook.js +4 -5
  80. package/esm/parse/allOfSystem.d.ts +32 -0
  81. package/esm/parse/allOfSystem.js +30 -0
  82. package/esm/parse/anyOfSystem.d.ts +68 -0
  83. package/esm/parse/anyOfSystem.js +107 -0
  84. package/esm/parse/securityRequirements.d.ts +6 -0
  85. package/esm/parse/securityRequirements.js +8 -0
  86. package/esm/parse/toSiblingKeywords.d.ts +28 -0
  87. package/esm/parse/toSiblingKeywords.js +109 -0
  88. package/esm/parse/v3-0/_merge-all-of/decompose-union.d.ts +8 -0
  89. package/esm/parse/v3-0/_merge-all-of/decompose-union.js +9 -1
  90. package/esm/parse/v3-0/_merge-all-of/generic-merge.d.ts +2 -3
  91. package/esm/parse/v3-0/_merge-all-of/generic-merge.js +2 -2
  92. package/esm/parse/v3-0/_merge-all-of/merge-array-constraints.d.ts +2 -2
  93. package/esm/parse/v3-0/_merge-all-of/merge-array-constraints.js +5 -5
  94. package/esm/parse/v3-0/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  95. package/esm/parse/v3-0/_merge-all-of/merge-boolean-constraints.js +2 -2
  96. package/esm/parse/v3-0/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  97. package/esm/parse/v3-0/_merge-all-of/merge-integer-constraints.js +2 -2
  98. package/esm/parse/v3-0/_merge-all-of/merge-intersection.d.ts +3 -2
  99. package/esm/parse/v3-0/_merge-all-of/merge-intersection.js +2 -2
  100. package/esm/parse/v3-0/_merge-all-of/merge-number-constraints.d.ts +2 -2
  101. package/esm/parse/v3-0/_merge-all-of/merge-number-constraints.js +2 -2
  102. package/esm/parse/v3-0/_merge-all-of/merge-object-constraints.d.ts +2 -2
  103. package/esm/parse/v3-0/_merge-all-of/merge-object-constraints.js +3 -3
  104. package/esm/parse/v3-0/_merge-all-of/merge-properties.d.ts +2 -2
  105. package/esm/parse/v3-0/_merge-all-of/merge-properties.js +2 -2
  106. package/esm/parse/v3-0/_merge-all-of/merge-string-constraints.d.ts +2 -2
  107. package/esm/parse/v3-0/_merge-all-of/merge-string-constraints.js +3 -3
  108. package/esm/parse/v3-0/_merge-all-of/merge-union.d.ts +10 -3
  109. package/esm/parse/v3-0/_merge-all-of/merge-union.js +50 -12
  110. package/esm/parse/v3-0/_merge-all-of/merge.d.ts +2 -2
  111. package/esm/parse/v3-0/_merge-all-of/merge.js +78 -27
  112. package/esm/parse/v3-0/_merge-all-of/nullable-merge.d.ts +4 -0
  113. package/esm/parse/v3-0/_merge-all-of/nullable-merge.js +9 -7
  114. package/esm/parse/v3-0/_merge-all-of/types.d.ts +33 -0
  115. package/esm/parse/v3-0/mediaType/toMediaTypeItemV3.js +4 -3
  116. package/esm/parse/v3-0/parameter/toParameterV3.js +4 -3
  117. package/esm/parse/v3-0/ref/toRefV31.d.ts +7 -1
  118. package/esm/parse/v3-0/ref/toRefV31.js +6 -3
  119. package/esm/parse/v3-0/schema/toSchemasV3.js +107 -15
  120. package/esm/parse/v3-1/_merge-all-of/decompose-union.d.ts +7 -1
  121. package/esm/parse/v3-1/_merge-all-of/decompose-union.js +8 -2
  122. package/esm/parse/v3-1/_merge-all-of/generic-merge.d.ts +2 -3
  123. package/esm/parse/v3-1/_merge-all-of/generic-merge.js +2 -2
  124. package/esm/parse/v3-1/_merge-all-of/merge-array-constraints.d.ts +3 -2
  125. package/esm/parse/v3-1/_merge-all-of/merge-array-constraints.js +5 -5
  126. package/esm/parse/v3-1/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  127. package/esm/parse/v3-1/_merge-all-of/merge-boolean-constraints.js +2 -2
  128. package/esm/parse/v3-1/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  129. package/esm/parse/v3-1/_merge-all-of/merge-integer-constraints.js +2 -2
  130. package/esm/parse/v3-1/_merge-all-of/merge-intersection.d.ts +3 -2
  131. package/esm/parse/v3-1/_merge-all-of/merge-intersection.js +2 -2
  132. package/esm/parse/v3-1/_merge-all-of/merge-number-constraints.d.ts +2 -2
  133. package/esm/parse/v3-1/_merge-all-of/merge-number-constraints.js +2 -2
  134. package/esm/parse/v3-1/_merge-all-of/merge-object-constraints.d.ts +2 -2
  135. package/esm/parse/v3-1/_merge-all-of/merge-object-constraints.js +3 -3
  136. package/esm/parse/v3-1/_merge-all-of/merge-properties.d.ts +2 -2
  137. package/esm/parse/v3-1/_merge-all-of/merge-properties.js +2 -2
  138. package/esm/parse/v3-1/_merge-all-of/merge-string-constraints.d.ts +2 -2
  139. package/esm/parse/v3-1/_merge-all-of/merge-string-constraints.js +3 -3
  140. package/esm/parse/v3-1/_merge-all-of/merge-union.d.ts +10 -3
  141. package/esm/parse/v3-1/_merge-all-of/merge-union.js +54 -15
  142. package/esm/parse/v3-1/_merge-all-of/merge.d.ts +3 -2
  143. package/esm/parse/v3-1/_merge-all-of/merge.js +88 -29
  144. package/esm/parse/v3-1/_merge-all-of/nullable-merge.d.ts +4 -0
  145. package/esm/parse/v3-1/_merge-all-of/nullable-merge.js +9 -7
  146. package/esm/parse/v3-1/_merge-all-of/types.d.ts +37 -0
  147. package/esm/parse/v3-1/mediaType/toMediaTypeItemV3.js +4 -3
  148. package/esm/parse/v3-1/parameter/toParameterV3.js +4 -3
  149. package/esm/parse/v3-1/ref/toRefV31.d.ts +7 -1
  150. package/esm/parse/v3-1/ref/toRefV31.js +6 -3
  151. package/esm/parse/v3-1/schema/toSchemasV3.js +111 -16
  152. package/esm/parse/v3-2/_merge-all-of/decompose-union.d.ts +7 -1
  153. package/esm/parse/v3-2/_merge-all-of/decompose-union.js +8 -2
  154. package/esm/parse/v3-2/_merge-all-of/generic-merge.d.ts +2 -3
  155. package/esm/parse/v3-2/_merge-all-of/generic-merge.js +2 -2
  156. package/esm/parse/v3-2/_merge-all-of/merge-array-constraints.d.ts +3 -2
  157. package/esm/parse/v3-2/_merge-all-of/merge-array-constraints.js +5 -5
  158. package/esm/parse/v3-2/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  159. package/esm/parse/v3-2/_merge-all-of/merge-boolean-constraints.js +2 -2
  160. package/esm/parse/v3-2/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  161. package/esm/parse/v3-2/_merge-all-of/merge-integer-constraints.js +2 -2
  162. package/esm/parse/v3-2/_merge-all-of/merge-intersection.d.ts +3 -2
  163. package/esm/parse/v3-2/_merge-all-of/merge-intersection.js +2 -2
  164. package/esm/parse/v3-2/_merge-all-of/merge-number-constraints.d.ts +2 -2
  165. package/esm/parse/v3-2/_merge-all-of/merge-number-constraints.js +2 -2
  166. package/esm/parse/v3-2/_merge-all-of/merge-object-constraints.d.ts +2 -2
  167. package/esm/parse/v3-2/_merge-all-of/merge-object-constraints.js +3 -3
  168. package/esm/parse/v3-2/_merge-all-of/merge-properties.d.ts +2 -2
  169. package/esm/parse/v3-2/_merge-all-of/merge-properties.js +2 -2
  170. package/esm/parse/v3-2/_merge-all-of/merge-string-constraints.d.ts +2 -2
  171. package/esm/parse/v3-2/_merge-all-of/merge-string-constraints.js +3 -3
  172. package/esm/parse/v3-2/_merge-all-of/merge-union.d.ts +10 -3
  173. package/esm/parse/v3-2/_merge-all-of/merge-union.js +54 -15
  174. package/esm/parse/v3-2/_merge-all-of/merge.d.ts +3 -2
  175. package/esm/parse/v3-2/_merge-all-of/merge.js +88 -29
  176. package/esm/parse/v3-2/_merge-all-of/nullable-merge.d.ts +4 -0
  177. package/esm/parse/v3-2/_merge-all-of/nullable-merge.js +9 -7
  178. package/esm/parse/v3-2/_merge-all-of/types.d.ts +37 -0
  179. package/esm/parse/v3-2/mediaType/toMediaTypeItemV3.js +4 -3
  180. package/esm/parse/v3-2/parameter/toParameterV3.js +4 -3
  181. package/esm/parse/v3-2/ref/toRefV31.d.ts +7 -1
  182. package/esm/parse/v3-2/ref/toRefV31.js +6 -3
  183. package/esm/parse/v3-2/schema/toSchemasV3.js +111 -16
  184. package/esm/types/OasBase.d.ts +1 -1
  185. package/esm/types/Settings.d.ts +44 -0
  186. package/esm/types/Settings.js +9 -0
  187. package/package.json +5 -1
  188. package/script/context/CoreContext.js +22 -8
  189. package/script/context/GenerateContext.d.ts +6 -5
  190. package/script/context/GenerateContext.js +112 -38
  191. package/script/context/ParseContext.d.ts +18 -1
  192. package/script/context/ParseContext.js +102 -3
  193. package/script/context/generateTypes.d.ts +33 -4
  194. package/script/context/generateTypes.js +4 -0
  195. package/script/context/toGenerationFailure.d.ts +21 -0
  196. package/script/context/toGenerationFailure.js +43 -0
  197. package/script/context/tryParseAt.d.ts +4 -1
  198. package/script/context/tryParseAt.js +10 -3
  199. package/script/dsl/CustomValue.d.ts +4 -0
  200. package/script/dsl/CustomValue.js +8 -0
  201. package/script/dsl/Definition.d.ts +10 -0
  202. package/script/dsl/Definition.js +14 -0
  203. package/script/dsl/PendingDefinition.d.ts +47 -0
  204. package/script/dsl/PendingDefinition.js +87 -0
  205. package/script/dsl/model/ModelDriver.d.ts +55 -1
  206. package/script/dsl/model/ModelDriver.js +231 -52
  207. package/script/dsl/model/toModelEntry.d.ts +1 -1
  208. package/script/dsl/model/toModelEntry.js +1 -1
  209. package/script/dsl/model/types.d.ts +1 -1
  210. package/script/dsl/operation/gql/GqlOperationDriver.js +1 -4
  211. package/script/dsl/webhook/WebhookDriver.js +1 -4
  212. package/script/enrichments/parseEnrichmentUmbrella.d.ts +5 -6
  213. package/script/enrichments/parseEnrichmentUmbrella.js +23 -41
  214. package/script/enrichments/parseEnrichmentValue.d.ts +17 -0
  215. package/script/enrichments/parseEnrichmentValue.js +69 -0
  216. package/script/enrichments/readEnrichments.d.ts +5 -5
  217. package/script/enrichments/readEnrichments.js +17 -40
  218. package/script/helpers/collateExamples.js +15 -5
  219. package/script/helpers/refFns.d.ts +6 -2
  220. package/script/helpers/refFns.js +24 -7
  221. package/script/mod.d.ts +2 -0
  222. package/script/mod.js +2 -0
  223. package/script/oas/array/Array.d.ts +19 -0
  224. package/script/oas/array/Array.js +47 -0
  225. package/script/oas/boolean/Boolean.d.ts +19 -0
  226. package/script/oas/boolean/Boolean.js +51 -8
  227. package/script/oas/example/Example.d.ts +4 -0
  228. package/script/oas/example/Example.js +8 -0
  229. package/script/oas/header/Header.d.ts +4 -0
  230. package/script/oas/header/Header.js +8 -0
  231. package/script/oas/integer/Integer.d.ts +19 -0
  232. package/script/oas/integer/Integer.js +49 -0
  233. package/script/oas/link/Link.d.ts +4 -0
  234. package/script/oas/link/Link.js +8 -0
  235. package/script/oas/number/Number.d.ts +19 -0
  236. package/script/oas/number/Number.js +49 -0
  237. package/script/oas/object/Object.d.ts +19 -0
  238. package/script/oas/object/Object.js +68 -18
  239. package/script/oas/operation/Operation.d.ts +8 -1
  240. package/script/oas/operation/Operation.js +18 -5
  241. package/script/oas/operation/toEffectiveParameters.d.ts +24 -0
  242. package/script/oas/operation/toEffectiveParameters.js +47 -0
  243. package/script/oas/parameter/Parameter.d.ts +4 -0
  244. package/script/oas/parameter/Parameter.js +8 -0
  245. package/script/oas/ref/DanglingRefError.d.ts +22 -0
  246. package/script/oas/ref/DanglingRefError.js +37 -0
  247. package/script/oas/ref/Ref.d.ts +152 -25
  248. package/script/oas/ref/Ref.js +414 -26
  249. package/script/oas/requestBody/RequestBody.d.ts +4 -0
  250. package/script/oas/requestBody/RequestBody.js +8 -0
  251. package/script/oas/response/Response.d.ts +4 -0
  252. package/script/oas/response/Response.js +8 -0
  253. package/script/oas/schema/siblings.d.ts +127 -0
  254. package/script/oas/schema/siblings.js +305 -0
  255. package/script/oas/securitySchemes/SecurityScheme.d.ts +16 -0
  256. package/script/oas/securitySchemes/SecurityScheme.js +32 -0
  257. package/script/oas/string/String.d.ts +19 -0
  258. package/script/oas/string/String.js +47 -0
  259. package/script/oas/union/Union.d.ts +32 -0
  260. package/script/oas/union/Union.js +111 -0
  261. package/script/oas/unknown/Unknown.d.ts +18 -0
  262. package/script/oas/unknown/Unknown.js +38 -0
  263. package/script/oas/void/Void.d.ts +4 -0
  264. package/script/oas/void/Void.js +8 -0
  265. package/script/oas/webhook/Webhook.d.ts +2 -2
  266. package/script/oas/webhook/Webhook.js +4 -5
  267. package/script/parse/allOfSystem.d.ts +32 -0
  268. package/script/parse/allOfSystem.js +35 -0
  269. package/script/parse/anyOfSystem.d.ts +68 -0
  270. package/script/parse/anyOfSystem.js +116 -0
  271. package/script/parse/securityRequirements.d.ts +6 -0
  272. package/script/parse/securityRequirements.js +8 -0
  273. package/script/parse/toSiblingKeywords.d.ts +28 -0
  274. package/script/parse/toSiblingKeywords.js +146 -0
  275. package/script/parse/v3-0/_merge-all-of/decompose-union.d.ts +8 -0
  276. package/script/parse/v3-0/_merge-all-of/decompose-union.js +11 -2
  277. package/script/parse/v3-0/_merge-all-of/generic-merge.d.ts +2 -3
  278. package/script/parse/v3-0/_merge-all-of/generic-merge.js +2 -2
  279. package/script/parse/v3-0/_merge-all-of/merge-array-constraints.d.ts +2 -2
  280. package/script/parse/v3-0/_merge-all-of/merge-array-constraints.js +5 -5
  281. package/script/parse/v3-0/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  282. package/script/parse/v3-0/_merge-all-of/merge-boolean-constraints.js +2 -2
  283. package/script/parse/v3-0/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  284. package/script/parse/v3-0/_merge-all-of/merge-integer-constraints.js +2 -2
  285. package/script/parse/v3-0/_merge-all-of/merge-intersection.d.ts +3 -2
  286. package/script/parse/v3-0/_merge-all-of/merge-intersection.js +2 -2
  287. package/script/parse/v3-0/_merge-all-of/merge-number-constraints.d.ts +2 -2
  288. package/script/parse/v3-0/_merge-all-of/merge-number-constraints.js +2 -2
  289. package/script/parse/v3-0/_merge-all-of/merge-object-constraints.d.ts +2 -2
  290. package/script/parse/v3-0/_merge-all-of/merge-object-constraints.js +3 -3
  291. package/script/parse/v3-0/_merge-all-of/merge-properties.d.ts +2 -2
  292. package/script/parse/v3-0/_merge-all-of/merge-properties.js +2 -2
  293. package/script/parse/v3-0/_merge-all-of/merge-string-constraints.d.ts +2 -2
  294. package/script/parse/v3-0/_merge-all-of/merge-string-constraints.js +3 -3
  295. package/script/parse/v3-0/_merge-all-of/merge-union.d.ts +10 -3
  296. package/script/parse/v3-0/_merge-all-of/merge-union.js +52 -13
  297. package/script/parse/v3-0/_merge-all-of/merge.d.ts +2 -2
  298. package/script/parse/v3-0/_merge-all-of/merge.js +77 -26
  299. package/script/parse/v3-0/_merge-all-of/nullable-merge.d.ts +4 -0
  300. package/script/parse/v3-0/_merge-all-of/nullable-merge.js +9 -7
  301. package/script/parse/v3-0/_merge-all-of/types.d.ts +33 -0
  302. package/script/parse/v3-0/mediaType/toMediaTypeItemV3.js +4 -3
  303. package/script/parse/v3-0/parameter/toParameterV3.js +4 -3
  304. package/script/parse/v3-0/ref/toRefV31.d.ts +7 -1
  305. package/script/parse/v3-0/ref/toRefV31.js +6 -3
  306. package/script/parse/v3-0/schema/toSchemasV3.js +107 -15
  307. package/script/parse/v3-1/_merge-all-of/decompose-union.d.ts +7 -1
  308. package/script/parse/v3-1/_merge-all-of/decompose-union.js +8 -2
  309. package/script/parse/v3-1/_merge-all-of/generic-merge.d.ts +2 -3
  310. package/script/parse/v3-1/_merge-all-of/generic-merge.js +2 -2
  311. package/script/parse/v3-1/_merge-all-of/merge-array-constraints.d.ts +3 -2
  312. package/script/parse/v3-1/_merge-all-of/merge-array-constraints.js +5 -5
  313. package/script/parse/v3-1/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  314. package/script/parse/v3-1/_merge-all-of/merge-boolean-constraints.js +2 -2
  315. package/script/parse/v3-1/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  316. package/script/parse/v3-1/_merge-all-of/merge-integer-constraints.js +2 -2
  317. package/script/parse/v3-1/_merge-all-of/merge-intersection.d.ts +3 -2
  318. package/script/parse/v3-1/_merge-all-of/merge-intersection.js +2 -2
  319. package/script/parse/v3-1/_merge-all-of/merge-number-constraints.d.ts +2 -2
  320. package/script/parse/v3-1/_merge-all-of/merge-number-constraints.js +2 -2
  321. package/script/parse/v3-1/_merge-all-of/merge-object-constraints.d.ts +2 -2
  322. package/script/parse/v3-1/_merge-all-of/merge-object-constraints.js +3 -3
  323. package/script/parse/v3-1/_merge-all-of/merge-properties.d.ts +2 -2
  324. package/script/parse/v3-1/_merge-all-of/merge-properties.js +2 -2
  325. package/script/parse/v3-1/_merge-all-of/merge-string-constraints.d.ts +2 -2
  326. package/script/parse/v3-1/_merge-all-of/merge-string-constraints.js +3 -3
  327. package/script/parse/v3-1/_merge-all-of/merge-union.d.ts +10 -3
  328. package/script/parse/v3-1/_merge-all-of/merge-union.js +56 -16
  329. package/script/parse/v3-1/_merge-all-of/merge.d.ts +3 -2
  330. package/script/parse/v3-1/_merge-all-of/merge.js +87 -28
  331. package/script/parse/v3-1/_merge-all-of/nullable-merge.d.ts +4 -0
  332. package/script/parse/v3-1/_merge-all-of/nullable-merge.js +9 -7
  333. package/script/parse/v3-1/_merge-all-of/types.d.ts +37 -0
  334. package/script/parse/v3-1/mediaType/toMediaTypeItemV3.js +4 -3
  335. package/script/parse/v3-1/parameter/toParameterV3.js +4 -3
  336. package/script/parse/v3-1/ref/toRefV31.d.ts +7 -1
  337. package/script/parse/v3-1/ref/toRefV31.js +6 -3
  338. package/script/parse/v3-1/schema/toSchemasV3.js +111 -16
  339. package/script/parse/v3-2/_merge-all-of/decompose-union.d.ts +7 -1
  340. package/script/parse/v3-2/_merge-all-of/decompose-union.js +8 -2
  341. package/script/parse/v3-2/_merge-all-of/generic-merge.d.ts +2 -3
  342. package/script/parse/v3-2/_merge-all-of/generic-merge.js +2 -2
  343. package/script/parse/v3-2/_merge-all-of/merge-array-constraints.d.ts +3 -2
  344. package/script/parse/v3-2/_merge-all-of/merge-array-constraints.js +5 -5
  345. package/script/parse/v3-2/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  346. package/script/parse/v3-2/_merge-all-of/merge-boolean-constraints.js +2 -2
  347. package/script/parse/v3-2/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  348. package/script/parse/v3-2/_merge-all-of/merge-integer-constraints.js +2 -2
  349. package/script/parse/v3-2/_merge-all-of/merge-intersection.d.ts +3 -2
  350. package/script/parse/v3-2/_merge-all-of/merge-intersection.js +2 -2
  351. package/script/parse/v3-2/_merge-all-of/merge-number-constraints.d.ts +2 -2
  352. package/script/parse/v3-2/_merge-all-of/merge-number-constraints.js +2 -2
  353. package/script/parse/v3-2/_merge-all-of/merge-object-constraints.d.ts +2 -2
  354. package/script/parse/v3-2/_merge-all-of/merge-object-constraints.js +3 -3
  355. package/script/parse/v3-2/_merge-all-of/merge-properties.d.ts +2 -2
  356. package/script/parse/v3-2/_merge-all-of/merge-properties.js +2 -2
  357. package/script/parse/v3-2/_merge-all-of/merge-string-constraints.d.ts +2 -2
  358. package/script/parse/v3-2/_merge-all-of/merge-string-constraints.js +3 -3
  359. package/script/parse/v3-2/_merge-all-of/merge-union.d.ts +10 -3
  360. package/script/parse/v3-2/_merge-all-of/merge-union.js +56 -16
  361. package/script/parse/v3-2/_merge-all-of/merge.d.ts +3 -2
  362. package/script/parse/v3-2/_merge-all-of/merge.js +87 -28
  363. package/script/parse/v3-2/_merge-all-of/nullable-merge.d.ts +4 -0
  364. package/script/parse/v3-2/_merge-all-of/nullable-merge.js +9 -7
  365. package/script/parse/v3-2/_merge-all-of/types.d.ts +37 -0
  366. package/script/parse/v3-2/mediaType/toMediaTypeItemV3.js +4 -3
  367. package/script/parse/v3-2/parameter/toParameterV3.js +4 -3
  368. package/script/parse/v3-2/ref/toRefV31.d.ts +7 -1
  369. package/script/parse/v3-2/ref/toRefV31.js +6 -3
  370. package/script/parse/v3-2/schema/toSchemasV3.js +111 -16
  371. package/script/types/OasBase.d.ts +1 -1
  372. package/script/types/Settings.d.ts +44 -0
  373. package/script/types/Settings.js +10 -1
@@ -13,11 +13,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
13
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
- 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;
16
+ 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;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.toModelSource = exports.toGqlOperationSource = exports.toWebhookSource = exports.toOasOperationSource = exports.GenerateContext = void 0;
19
19
  const normalizeWorkspacePath_js_1 = require("../helpers/normalizeWorkspacePath.js");
20
20
  const applyGeneratedSuffix_js_1 = require("../helpers/applyGeneratedSuffix.js");
21
+ const DanglingRefError_js_1 = require("../oas/ref/DanglingRefError.js");
22
+ const Method_js_1 = require("../types/Method.js");
21
23
  const OasOperationDriver_js_1 = require("../dsl/operation/oas/OasOperationDriver.js");
22
24
  const WebhookDriver_js_1 = require("../dsl/webhook/WebhookDriver.js");
23
25
  const GqlOperationDriver_js_1 = require("../dsl/operation/gql/GqlOperationDriver.js");
@@ -36,6 +38,7 @@ const MarkdownFile_js_1 = require("../dsl/MarkdownFile.js");
36
38
  const tiny_invariant_1 = __importDefault(require("tiny-invariant"));
37
39
  const EnrichmentAudit_js_1 = require("../enrichments/EnrichmentAudit.js");
38
40
  const SerializedError_js_1 = require("../types/SerializedError.js");
41
+ const toGenerationFailure_js_1 = require("./toGenerationFailure.js");
39
42
  const EnrichmentWarning_js_1 = require("../enrichments/EnrichmentWarning.js");
40
43
  /**
41
44
  * The generation context for the second phase of the SKMTC transformation pipeline.
@@ -89,6 +92,12 @@ class GenerateContext {
89
92
  constructor({ document, settings, logger, captureCurrentResult, toGeneratorConfigMap, captureChannel }) {
90
93
  _GenerateContext_instances.add(this);
91
94
  _GenerateContext_files.set(this, void 0);
95
+ /** Each subject whose generation threw: its trail and the error message. */
96
+ _GenerateContext_failedItems.set(this, []
97
+ /** Each file's path folded (case, Unicode form) → the path: a file system that ignores case sees one file. */
98
+ );
99
+ /** Each file's path folded (case, Unicode form) → the path: a file system that ignores case sees one file. */
100
+ _GenerateContext_foldedPaths.set(this, new Map());
92
101
  _GenerateContext_previews.set(this, void 0);
93
102
  /**
94
103
  * Parsed source document, wrapped in the {@link SkmtcParsedDocument}
@@ -129,12 +138,12 @@ class GenerateContext {
129
138
  writable: true,
130
139
  value: void 0
131
140
  });
132
- /** Tracking model nesting depth to prevent infinite recursion */
133
- Object.defineProperty(this, "modelDepth", {
141
+ /** The pending models, outermost first: the last is the model whose projection constructor is running. */
142
+ Object.defineProperty(this, "pendingStack", {
134
143
  enumerable: true,
135
144
  configurable: true,
136
145
  writable: true,
137
- value: void 0
146
+ value: []
138
147
  });
139
148
  /**
140
149
  * Creates a new GenerateContext instance for the generation phase.
@@ -158,7 +167,6 @@ class GenerateContext {
158
167
  this.settings = settings;
159
168
  this.captureCurrentResult = captureCurrentResult;
160
169
  this.toGeneratorConfigMap = toGeneratorConfigMap;
161
- this.modelDepth = {};
162
170
  __classPrivateFieldSet(this, _GenerateContext_captureChannel, captureChannel, "f");
163
171
  __classPrivateFieldSet(this, _GenerateContext_enrichmentAudit, new EnrichmentAudit_js_1.EnrichmentAudit(), "f");
164
172
  }
@@ -234,18 +242,15 @@ class GenerateContext {
234
242
  // extracted below is applied per-operation in the run* arms.
235
243
  // (Whole-generator opt-out is `skip`. A bare-string `include`
236
244
  // entry carries no per-operation filter and is a no-op.)
237
- const skip = this.settings?.skip?.find((skip) => {
238
- return typeof skip === 'object' && Boolean(skip[generatorConfig.id]);
239
- });
245
+ // skmtc#330: every object entry for this generator, merged, not only the first one.
246
+ const skip = toGeneratorFilter(this.settings?.skip, generatorConfig.id);
240
247
  // Extract the per-generator include slice (if any). Same
241
248
  // dispatch shape as skip: object entries get matched by key,
242
249
  // string entries don't produce a per-op filter (they mean
243
250
  // "everything from this generator is included", which is
244
251
  // semantically equivalent to "no per-op filter" once the
245
252
  // whole-generator gate above has admitted us).
246
- const include = this.settings?.include?.find((entry) => {
247
- return typeof entry === 'object' && Boolean(entry[generatorConfig.id]);
248
- });
253
+ const include = toGeneratorFilter(this.settings?.include, generatorConfig.id);
249
254
  switch (generatorConfig.type) {
250
255
  case 'oasOperation':
251
256
  if (this.document.type !== 'oas') {
@@ -295,6 +300,13 @@ class GenerateContext {
295
300
  generators: generators.map(({ id, type }) => ({ id, type })),
296
301
  skippedGeneratorIds: (this.settings?.skip ?? []).filter((entry) => typeof entry === 'string')
297
302
  });
303
+ // Generation runs our code over a document parsing has already made
304
+ // safe, so an error here is a bug to fix, not data to tolerate: the run
305
+ // fails, and writes nothing. Every subject that failed is in the log
306
+ // and in the results.
307
+ if (__classPrivateFieldGet(this, _GenerateContext_failedItems, "f").length > 0) {
308
+ throw new toGenerationFailure_js_1.GenerationFailure(__classPrivateFieldGet(this, _GenerateContext_failedItems, "f"), enrichmentWarnings);
309
+ }
298
310
  return {
299
311
  files: __classPrivateFieldGet(this, _GenerateContext_files, "f"),
300
312
  previews: __classPrivateFieldGet(this, _GenerateContext_previews, "f"),
@@ -502,7 +514,16 @@ class GenerateContext {
502
514
  if (__classPrivateFieldGet(this, _GenerateContext_files, "f").has(normalizedPath)) {
503
515
  throw new Error(`File already exists: ${normalizedPath}`);
504
516
  }
517
+ // Two paths that differ only in case are one file on a file system that
518
+ // ignores case, as macOS's and Windows' do by default: writing the
519
+ // second would replace the first without a word.
520
+ const foldedPath = normalizedPath.normalize('NFD').toLowerCase();
521
+ const existingPath = __classPrivateFieldGet(this, _GenerateContext_foldedPaths, "f").get(foldedPath);
522
+ if (existingPath !== undefined) {
523
+ 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.`);
524
+ }
505
525
  __classPrivateFieldGet(this, _GenerateContext_files, "f").set(normalizedPath, file);
526
+ __classPrivateFieldGet(this, _GenerateContext_foldedPaths, "f").set(foldedPath, normalizedPath);
506
527
  return file;
507
528
  }
508
529
  /**
@@ -640,10 +661,7 @@ class GenerateContext {
640
661
  // @TODO Using mapped types would help avoid generics casting
641
662
  return definition;
642
663
  }
643
- const cachedDefinition = this.findDefinition({
644
- name: fallbackName,
645
- exportPath: destinationPath
646
- });
664
+ const cachedDefinition = this.findDefinition({ name: fallbackName, exportPath: destinationPath });
647
665
  // @TODO add check to make sure retrieved definition
648
666
  // used same generator and same schema #SKM-47
649
667
  if (cachedDefinition) {
@@ -819,22 +837,36 @@ class GenerateContext {
819
837
  * Perform one lookup of schema by `refName`.
820
838
  * @param refName
821
839
  * @returns Matching schema or ref
822
- * @throws if schema is not found
840
+ * @throws {DanglingRefError} when no schema has that name
823
841
  */
824
- resolveSchemaRefOnce(refName, generatorId) {
825
- this.modelDepth[`${generatorId}:${refName}`]++;
826
- const schema = this.document.type === 'oas'
827
- ? this.document.value.components?.schemas?.[refName]?.resolveOnce()
828
- : this.document.value.registry.schemas[refName];
829
- if (!schema) {
830
- throw new Error(`Schema not found: ${refName}`);
831
- }
832
- // GqlRegistry stores raw OasSchema | OasRef entries that we need to
833
- // resolve once for parity with the OAS code path.
834
- if (this.document.type === 'gql' && 'resolveOnce' in schema) {
835
- return schema.resolveOnce();
842
+ resolveSchemaRefOnce(refName) {
843
+ switch (this.document.type) {
844
+ case 'oas': {
845
+ const component = this.document.value.components?.schemas?.[refName];
846
+ if (!component) {
847
+ throw new DanglingRefError_js_1.DanglingRefError(refName);
848
+ }
849
+ const target = component.resolveOnce();
850
+ // One step, with what the component adds next to its reference
851
+ // (`{ allOf: [{ $ref: Name }], maxLength: 10, nullable: true }`)
852
+ // applied to a copy: the model is the target at this site. When the
853
+ // step is itself a reference, the copy is a reference, and the
854
+ // model's router decides whether it renders inline or by name.
855
+ return component.isRef() && component.hasSiblings() ? target.clone(component) : target;
856
+ }
857
+ case 'gql': {
858
+ const schema = this.document.value.registry.schemas[refName];
859
+ if (!schema) {
860
+ throw new DanglingRefError_js_1.DanglingRefError(refName);
861
+ }
862
+ // GqlRegistry stores OasSchema | OasRef entries: one step, as for OAS.
863
+ return schema.resolveOnce();
864
+ }
865
+ default: {
866
+ const _exhaustive = this.document;
867
+ throw new Error(`Unhandled document type: ${JSON.stringify(_exhaustive)}`);
868
+ }
836
869
  }
837
- return schema;
838
870
  }
839
871
  /**
840
872
  * Check if definition name `name` in file with path `exportPath`
@@ -860,7 +892,7 @@ class GenerateContext {
860
892
  }
861
893
  }
862
894
  exports.GenerateContext = GenerateContext;
863
- _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) {
895
+ _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) {
864
896
  if (!(0, EnrichmentAudit_js_1.hasVariantEnrichment)(block, variant))
865
897
  return;
866
898
  __classPrivateFieldGet(this, _GenerateContext_enrichmentAudit, "f").report({
@@ -872,6 +904,10 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_previews = new WeakMap(
872
904
  });
873
905
  }, _GenerateContext_logError = function _GenerateContext_logError(error) {
874
906
  this.logger.error((0, SerializedError_js_1.toSerializedError)(error).message, error);
907
+ }, _GenerateContext_failItem = function _GenerateContext_failItem(error, stackTrail) {
908
+ __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_logError).call(this, error);
909
+ this.captureCurrentResult('error', stackTrail);
910
+ __classPrivateFieldGet(this, _GenerateContext_failedItems, "f").push({ trail: `${stackTrail}`, message: (0, SerializedError_js_1.toSerializedError)(error).message });
875
911
  }, _GenerateContext_schemaRefNames = function _GenerateContext_schemaRefNames() {
876
912
  switch (this.document.type) {
877
913
  case 'oas':
@@ -978,8 +1014,7 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_previews = new WeakMap(
978
1014
  this.captureCurrentResult('success', st);
979
1015
  }
980
1016
  catch (error) {
981
- __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_logError).call(this, error);
982
- this.captureCurrentResult('error', st);
1017
+ __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_failItem).call(this, error, st);
983
1018
  }
984
1019
  }));
985
1020
  });
@@ -1059,8 +1094,7 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_previews = new WeakMap(
1059
1094
  this.captureCurrentResult('success', st);
1060
1095
  }
1061
1096
  catch (error) {
1062
- __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_logError).call(this, error);
1063
- this.captureCurrentResult('error', st);
1097
+ __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_failItem).call(this, error, st);
1064
1098
  }
1065
1099
  }));
1066
1100
  });
@@ -1103,8 +1137,7 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_previews = new WeakMap(
1103
1137
  this.captureCurrentResult('success', st);
1104
1138
  }
1105
1139
  catch (error) {
1106
- __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_logError).call(this, error);
1107
- this.captureCurrentResult('error', st);
1140
+ __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_failItem).call(this, error, st);
1108
1141
  }
1109
1142
  }));
1110
1143
  });
@@ -1178,8 +1211,7 @@ _GenerateContext_files = new WeakMap(), _GenerateContext_previews = new WeakMap(
1178
1211
  this.captureCurrentResult('success', st);
1179
1212
  }
1180
1213
  catch (error) {
1181
- __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_logError).call(this, error);
1182
- this.captureCurrentResult('error', st);
1214
+ __classPrivateFieldGet(this, _GenerateContext_instances, "m", _GenerateContext_failItem).call(this, error, st);
1183
1215
  }
1184
1216
  }));
1185
1217
  });
@@ -1341,6 +1373,48 @@ const toModelSource = ({ refName, generatorId, variant }) => ({
1341
1373
  variant
1342
1374
  });
1343
1375
  exports.toModelSource = toModelSource;
1376
+ /** Variants of one subject. `[]` is every variant, so it wins a merge. */
1377
+ const mergeVariants = (a, b) => a.length === 0 || b.length === 0 ? [] : [...new Set([...a, ...b])];
1378
+ /** Whether a filter is operation-shaped: its values are records of methods, not lists of variants. */
1379
+ const isPathsFilter = (filter) => Object.values(filter).every(value => !Array.isArray(value));
1380
+ const mergePathsFilters = (a, b) => Object.entries(b).reduce((merged, [path, methods]) => {
1381
+ const existing = merged[path] ?? {};
1382
+ const combined = Object.entries(methods).reduce((acc, [method, variants]) => {
1383
+ if (!(0, Method_js_1.isMethod)(method) || variants === undefined) {
1384
+ return acc;
1385
+ }
1386
+ const current = acc[method];
1387
+ return { ...acc, [method]: current === undefined ? variants : mergeVariants(current, variants) };
1388
+ }, { ...existing });
1389
+ return { ...merged, [path]: combined };
1390
+ }, { ...a });
1391
+ const mergeModelsFilters = (a, b) => Object.entries(b).reduce((merged, [refName, variants]) => {
1392
+ const current = merged[refName];
1393
+ return { ...merged, [refName]: current === undefined ? variants : mergeVariants(current, variants) };
1394
+ }, { ...a });
1395
+ /** Two filters of one generator, merged. Filters of two shapes cannot merge: the first stays. */
1396
+ const mergeFilters = (a, b) => {
1397
+ if (isPathsFilter(a) && isPathsFilter(b)) {
1398
+ return mergePathsFilters(a, b);
1399
+ }
1400
+ if (!isPathsFilter(a) && !isPathsFilter(b)) {
1401
+ return mergeModelsFilters(a, b);
1402
+ }
1403
+ return a;
1404
+ };
1405
+ /**
1406
+ * The `skip` or `include` filter of one generator: every object entry that
1407
+ * names it, merged (skmtc#330). Before, only the first entry applied, and a
1408
+ * later one was ignored with no warning. `undefined` when no entry names it.
1409
+ */
1410
+ const toGeneratorFilter = (entries, generatorId) => {
1411
+ const filters = (entries ?? []).flatMap(entry => {
1412
+ const filter = typeof entry === 'object' ? entry[generatorId] : undefined;
1413
+ return filter === undefined ? [] : [filter];
1414
+ });
1415
+ const [first, ...rest] = filters;
1416
+ return first === undefined ? undefined : { [generatorId]: rest.reduce(mergeFilters, first) };
1417
+ };
1344
1418
  const toSkipPaths = (skip, generatorId) => {
1345
1419
  const generatorSkip = skip?.[generatorId];
1346
1420
  // 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';
@@ -27,6 +28,8 @@ import { StackTrail } from './StackTrail.js';
27
28
  import type { SkmtcDocumentInput, SkmtcParsedDocument } from '../types/SkmtcDocument.js';
28
29
  import type { GqlParseOptions, LogAtArgs, LogIssueArgs, LogIssueAtArgs, LogIssueNoKeyArgs, LogSkippedValuesArgs } from './parseTypes.js';
29
30
  import type { ParseIssue } from './ParseIssue.js';
31
+ import type { OasRef } from '../oas/ref/Ref.js';
32
+ import type { OasRefData } from '../oas/ref/ref-types.js';
30
33
  export type { ParseIssue, GqlIssueType } from './ParseIssue.js';
31
34
  export type { GqlParseOptions, LogAtArgs, LogIssueArgs, LogIssueAtArgs, LogIssueNoKeyArgs, LogSkippedValuesArgs, ParseContextType, ParseErrorInput, ParseIssueInput, ParseWarningInput } from './parseTypes.js';
32
35
  type OasProtocolState = {
@@ -61,6 +64,8 @@ type ConstructorArgs = {
61
64
  options?: {
62
65
  gql?: GqlParseOptions;
63
66
  };
67
+ /** `client.json#settings.system`: how the OpenAPI parsers treat what they cannot read faithfully. */
68
+ system?: SystemSettings;
64
69
  };
65
70
  export declare class ParseContext {
66
71
  #private;
@@ -75,7 +80,12 @@ export declare class ParseContext {
75
80
  * `undefined` outside an active `withStackTrail` scope.
76
81
  */
77
82
  currentStackTrail: StackTrail | undefined;
78
- constructor({ input, logger, silent, options }: ConstructorArgs);
83
+ /**
84
+ * How the OpenAPI parsers treat what they cannot read faithfully
85
+ * (`client.json#settings.system`). Each setting left out is `strict`.
86
+ */
87
+ system: SystemSettings;
88
+ constructor({ input, logger, silent, options, system }: ConstructorArgs);
79
89
  /**
80
90
  * OAS-only accessor. Throws when called on a GQL-protocol context —
81
91
  * deliberate, because OAS parser code uses this and a misroute is a
@@ -149,6 +159,13 @@ export declare class ParseContext {
149
159
  * would use type names or qualified field paths.
150
160
  */
151
161
  registerRef(consumer: StackTrail, refKey: string): void;
162
+ /**
163
+ * Register an OAS `$ref` at its consumer site, as {@link registerRef}
164
+ * does, under the key {@link toRefKey} gives its `$ref`, and keep the ref
165
+ * with that site, so that once the document is parsed `#checkRefs` can
166
+ * resolve it there.
167
+ */
168
+ registerOasRef<T extends OasRefData['refType']>(consumer: StackTrail, ref: OasRef<T>): void;
152
169
  /**
153
170
  * Register an error against a ref key — typically called when the
154
171
  * target of a `$ref` (or type reference) fails to parse. `undefined`
@@ -10,7 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  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");
11
11
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
12
  };
13
- var _ParseContext_instances, _ParseContext_refConsumers, _ParseContext_refErrors, _ParseContext_rootFrames, _ParseContext_removeComponent, _ParseContext_removeConsumer, _ParseContext_removePathParameterConsumer, _ParseContext_toRawComponentParameter, _ParseContext_logDependencyIssue, _ParseContext_toDocumentTrail;
13
+ var _ParseContext_instances, _ParseContext_refConsumers, _ParseContext_refErrors, _ParseContext_oasRefs, _ParseContext_rootFrames, _ParseContext_removeComponent, _ParseContext_removeConsumer, _ParseContext_removePathParameterConsumer, _ParseContext_toRawComponentParameter, _ParseContext_logDependencyIssue, _ParseContext_toDocumentTrail, _ParseContext_checkRefs, _ParseContext_logDanglingRef;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.ParseContext = void 0;
16
16
  /**
@@ -44,6 +44,20 @@ const StackTrail_js_1 = require("./StackTrail.js");
44
44
  const isPlainObject_js_1 = require("../parse/isPlainObject.js");
45
45
  const pathParameters_js_1 = require("../parse/pathParameters.js");
46
46
  const SerializedError_js_1 = require("../types/SerializedError.js");
47
+ const DanglingRefError_js_1 = require("../oas/ref/DanglingRefError.js");
48
+ const refFns_js_1 = require("../helpers/refFns.js");
49
+ /**
50
+ * The key a `$ref`'s consumers and errors are kept under. A
51
+ * `#/components/<bucket>/…` ref is keyed by the name it resolves (`toRefName`
52
+ * unescapes it), which is the key `StackTrail.toStackRef()` gives that
53
+ * component's own errors: `#/components/schemas/Foo%20Bar` is kept under
54
+ * `#/components/schemas/Foo Bar`. Any other `$ref` is its own key.
55
+ */
56
+ const toRefKey = ($ref) => {
57
+ // The last segment is not empty, so `toRefName` does not throw.
58
+ const bucket = /^#\/components\/([^/]+)\/.*[^/]$/.exec($ref)?.[1];
59
+ return bucket === undefined ? $ref : `#/components/${bucket}/${(0, refFns_js_1.toRefName)($ref)}`;
60
+ };
47
61
  /** The stored form of an issue: an error's `cause` as a `SerializedError`. */
48
62
  const toParseIssue = (issue) => {
49
63
  if (issue.level !== 'error') {
@@ -63,7 +77,7 @@ const toParseIssue = (issue) => {
63
77
  }
64
78
  };
65
79
  class ParseContext {
66
- constructor({ input, logger, silent = true, options }) {
80
+ constructor({ input, logger, silent = true, options, system }) {
67
81
  _ParseContext_instances.add(this);
68
82
  Object.defineProperty(this, "issues", {
69
83
  enumerable: true,
@@ -101,11 +115,25 @@ class ParseContext {
101
115
  writable: true,
102
116
  value: void 0
103
117
  });
118
+ /**
119
+ * How the OpenAPI parsers treat what they cannot read faithfully
120
+ * (`client.json#settings.system`). Each setting left out is `strict`.
121
+ */
122
+ Object.defineProperty(this, "system", {
123
+ enumerable: true,
124
+ configurable: true,
125
+ writable: true,
126
+ value: void 0
127
+ });
104
128
  // Universal dependency-ref tracking. Populated by parsers as they
105
129
  // encounter references. OAS uses `$ref` strings as keys; GQL would
106
130
  // use type names. The maps don't care about the encoding.
107
131
  _ParseContext_refConsumers.set(this, new Map());
108
132
  _ParseContext_refErrors.set(this, new Map()
133
+ /** Each OAS ref and the place it is written, which `#checkRefs` resolves once the document is parsed. */
134
+ );
135
+ /** Each OAS ref and the place it is written, which `#checkRefs` resolves once the document is parsed. */
136
+ _ParseContext_oasRefs.set(this, []
109
137
  /**
110
138
  * Frames of the trail `parse()` was called with (`[traceId, spanId,
111
139
  * 'parse']` through `toArtifacts`). Every trail built during the walk
@@ -120,6 +148,7 @@ class ParseContext {
120
148
  _ParseContext_rootFrames.set(this, []);
121
149
  this.logger = logger;
122
150
  this.silent = silent;
151
+ this.system = system ?? {};
123
152
  switch (input.type) {
124
153
  case 'oas': {
125
154
  this.protocol = {
@@ -254,6 +283,7 @@ class ParseContext {
254
283
  throw new Error(`Unhandled OAS dialect: ${JSON.stringify(_exhaustive)}`);
255
284
  }
256
285
  }
286
+ __classPrivateFieldGet(this, _ParseContext_instances, "m", _ParseContext_checkRefs).call(this);
257
287
  this.removeErroredItems();
258
288
  return { type: 'oas', value: oasState.oasDocument };
259
289
  }
@@ -353,6 +383,16 @@ class ParseContext {
353
383
  __classPrivateFieldGet(this, _ParseContext_refConsumers, "f").set(refKey, [consumer]);
354
384
  }
355
385
  }
386
+ /**
387
+ * Register an OAS `$ref` at its consumer site, as {@link registerRef}
388
+ * does, under the key {@link toRefKey} gives its `$ref`, and keep the ref
389
+ * with that site, so that once the document is parsed `#checkRefs` can
390
+ * resolve it there.
391
+ */
392
+ registerOasRef(consumer, ref) {
393
+ this.registerRef(consumer, toRefKey(ref.$ref));
394
+ __classPrivateFieldGet(this, _ParseContext_oasRefs, "f").push({ consumer, ref });
395
+ }
356
396
  /**
357
397
  * Register an error against a ref key — typically called when the
358
398
  * target of a `$ref` (or type reference) fails to parse. `undefined`
@@ -505,7 +545,7 @@ class ParseContext {
505
545
  }
506
546
  }
507
547
  exports.ParseContext = ParseContext;
508
- _ParseContext_refConsumers = new WeakMap(), _ParseContext_refErrors = new WeakMap(), _ParseContext_rootFrames = new WeakMap(), _ParseContext_instances = new WeakSet(), _ParseContext_removeComponent = function _ParseContext_removeComponent(refKey) {
548
+ _ParseContext_refConsumers = new WeakMap(), _ParseContext_refErrors = new WeakMap(), _ParseContext_oasRefs = new WeakMap(), _ParseContext_rootFrames = new WeakMap(), _ParseContext_instances = new WeakSet(), _ParseContext_removeComponent = function _ParseContext_removeComponent(refKey) {
509
549
  if (this.protocol.type !== 'oas') {
510
550
  return;
511
551
  }
@@ -618,4 +658,63 @@ _ParseContext_refConsumers = new WeakMap(), _ParseContext_refErrors = new WeakMa
618
658
  frames.length >= rootFrames.length &&
619
659
  rootFrames.every((frame, index) => frames[index] === frame);
620
660
  return startsWithRoot ? new StackTrail_js_1.StackTrail(frames.slice(rootFrames.length)) : stackTrail;
661
+ }, _ParseContext_checkRefs = function _ParseContext_checkRefs() {
662
+ __classPrivateFieldGet(this, _ParseContext_oasRefs, "f").forEach(({ consumer, ref }) => {
663
+ if (__classPrivateFieldGet(this, _ParseContext_refErrors, "f").has(toRefKey(ref.$ref))) {
664
+ return;
665
+ }
666
+ try {
667
+ ref.resolveOnce();
668
+ }
669
+ catch (error) {
670
+ if (DanglingRefError_js_1.DanglingRefError.is(error)) {
671
+ __classPrivateFieldGet(this, _ParseContext_instances, "m", _ParseContext_logDanglingRef).call(this, { consumer, ref, error });
672
+ }
673
+ else {
674
+ this.logIssueNoKey({
675
+ level: 'warning',
676
+ message: `${error instanceof Error ? error.message : String(error)}. It is kept, and resolving it throws.`,
677
+ parent: { $ref: ref.$ref },
678
+ stackTrail: consumer,
679
+ type: 'REF_TYPE_MISMATCH'
680
+ });
681
+ }
682
+ }
683
+ });
684
+ }, _ParseContext_logDanglingRef = function _ParseContext_logDanglingRef({ consumer, ref, error }) {
685
+ const exampleOrLink = ref.refType === 'example' || ref.refType === 'link';
686
+ if (exampleOrLink || this.system.danglingRefs === 'keep') {
687
+ this.logIssueNoKey({
688
+ level: 'warning',
689
+ message: exampleOrLink
690
+ ? `${error.message}. It is kept, as a ref to an example or a link is in both system.danglingRefs modes, and resolving it throws DanglingRefError.`
691
+ : `${error.message}. It is kept (system.danglingRefs is keep), and resolving it throws DanglingRefError.`,
692
+ parent: { $ref: ref.$ref },
693
+ stackTrail: consumer,
694
+ type: 'DANGLING_REF'
695
+ });
696
+ return;
697
+ }
698
+ // An error inside a component removes that component, and what uses it
699
+ // (`removeErroredItems`).
700
+ this.logIssueNoKey({
701
+ level: 'error',
702
+ message: `${error.message}, so what holds it is removed (system.danglingRefs is strict).`,
703
+ cause: error,
704
+ parent: { $ref: ref.$ref },
705
+ stackTrail: consumer,
706
+ type: 'DANGLING_REF'
707
+ });
708
+ // What holds the ref outside the components (an operation, a webhook, a
709
+ // path-level parameter) is removed here. Its own location has the
710
+ // DANGLING_REF already; an operation that a path-level parameter applies
711
+ // to gets an INVALID_DEPENDENCY_REF.
712
+ const documentTrail = __classPrivateFieldGet(this, _ParseContext_instances, "m", _ParseContext_toDocumentTrail).call(this, consumer);
713
+ if (documentTrail.toStackRef() !== undefined) {
714
+ return;
715
+ }
716
+ const location = consumer.toString();
717
+ __classPrivateFieldGet(this, _ParseContext_instances, "m", _ParseContext_removeConsumer).call(this, consumer, documentTrail)
718
+ .filter(removed => removed !== location)
719
+ .forEach(removed => __classPrivateFieldGet(this, _ParseContext_instances, "m", _ParseContext_logDependencyIssue).call(this, { location: removed, refKey: ref.$ref, rootCause: { error, location } }));
621
720
  };
@@ -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,33 @@ 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
+ *
188
+ * `DANGLING_REF` — a `$ref` names nothing in the document. One for each
189
+ * place the `$ref` is written. An `error` under `system.danglingRefs:
190
+ * strict` (the default): what holds the ref is removed, and each item that
191
+ * uses it gets an `INVALID_DEPENDENCY_REF`. A `warning` under `keep`: the
192
+ * ref stays, and resolving it throws `DanglingRefError`. A ref to an example
193
+ * or a link is a `warning` in both modes. A ref that core resolves while it
194
+ * parses (an `allOf` member that it merges) is an `error` in both modes, at
195
+ * the item that holds it.
196
+ *
197
+ * `REF_TYPE_MISMATCH` (`warning`) — a `$ref` names a component of the wrong
198
+ * kind, such as a request body that is a `$ref` to
199
+ * `#/components/schemas/Pet`. One for each place the `$ref` is written. The
200
+ * ref stays, and resolving it throws.
201
+ *
179
202
  * `RUN_FAILED` (`error`) — the run itself failed outside the per-item
180
203
  * catches. Its `location` names the entry and phase, for example
181
204
  * `toArtifacts:render`.
182
205
  */
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';
206
+ 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' | 'DANGLING_REF' | 'REF_TYPE_MISMATCH' | 'RUN_FAILED';
184
207
  /**
185
208
  * Valibot schema for {@link OasIssueType}. Annotation deliberately omitted
186
209
  * so the precise literal-union output type flows through to consumers
@@ -188,7 +211,7 @@ export type OasIssueType = 'UNEXPECTED_PROPERTY' | 'MISSING_OBJECT_TYPE' | 'MISS
188
211
  * this list and {@link OasIssueType} is caught by `assertSchemaMatchesType`
189
212
  * below.
190
213
  */
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>;
214
+ 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<"DANGLING_REF", undefined>, v.LiteralSchema<"REF_TYPE_MISMATCH", undefined>, v.LiteralSchema<"RUN_FAILED", undefined>], undefined>;
192
215
  export type GenerateResult = {
193
216
  files: Map<string, FileBase>;
194
217
  previews: Record<string, Preview>;
@@ -415,7 +438,12 @@ export type GenerateContextType = {
415
438
  * subject's result to `'warning'` or `'error'`.
416
439
  */
417
440
  logger: Logger;
418
- modelDepth: Record<string, number>;
441
+ /**
442
+ * The pending models, outermost first: the last is the model whose
443
+ * projection constructor is running, the source of any reference made now.
444
+ * Kept by the `ModelDriver`.
445
+ */
446
+ pendingStack: PendingDefinition[];
419
447
  document: SkmtcParsedDocument;
420
448
  /**
421
449
  * Attribution (gen-maps) state. When set, every `SnippetBase`
@@ -451,7 +479,8 @@ export type GenerateContextType = {
451
479
  insertWebhook: <V extends GeneratedValue, EnrichmentType = undefined, ProjectionOptions = undefined>(args: InsertWebhookArgs<V, EnrichmentType, ProjectionOptions>) => Inserted<V, EnrichmentType>;
452
480
  toWebhookContentSettings: <V extends GeneratedValue, EnrichmentType, ProjectionOptions>(args: ToWebhookSettingsArgs<V, EnrichmentType, ProjectionOptions>) => ContentSettings<EnrichmentType>;
453
481
  toModelContentSettings: <V extends GeneratedValue, EnrichmentType, ProjectionOptions>(args: BuildModelSettingsArgs<V, EnrichmentType, ProjectionOptions>) => ContentSettings<EnrichmentType>;
454
- resolveSchemaRefOnce: (refName: RefName, generatorId: string) => OasSchema | OasRef<'schema'>;
482
+ resolveSchemaRefOnce: (refName: RefName) => OasSchema | OasRef<'schema'>;
483
+ /** The Definition named `name` in `exportPath` (or inside the declaration `into`), or `undefined`. */
455
484
  findDefinition: ({ name, exportPath, into }: FindDefinitionArgs) => DefinitionBase | undefined;
456
485
  /**
457
486
  * The recording enrichment accessor — the single choke point every
@@ -72,6 +72,10 @@ exports.oasIssueType = v.union([
72
72
  v.literal('UNSUPPORTED_OPERATION_METHOD'),
73
73
  v.literal('WILDCARD_MEDIA_TYPE'),
74
74
  v.literal('NO_JSON_MEDIA_TYPE'),
75
+ v.literal('ALLOF_CONTRADICTION'),
76
+ v.literal('ANYOF_AS_UNKNOWN'),
77
+ v.literal('DANGLING_REF'),
78
+ v.literal('REF_TYPE_MISMATCH'),
75
79
  v.literal('RUN_FAILED')
76
80
  ]);
77
81
  // 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
+ }