@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
@@ -1,5 +1,7 @@
1
1
  import { toRefV31 } from '../ref/toRefV31.js';
2
2
  import { isRef } from '../../../helpers/refFns.js';
3
+ import { isEmpty } from '../../../helpers/isEmpty.js';
4
+ import { OasUnknown } from '../../../oas/unknown/Unknown.js';
3
5
  import { toArray } from '../array/toArray.js';
4
6
  import { toObject } from '../object/toObject.js';
5
7
  import { toInteger } from '../integer/toInteger.js';
@@ -9,8 +11,13 @@ import { toString } from '../string/toString.js';
9
11
  import { toUnknown } from '../unknown/toUnknown.js';
10
12
  import { toUnion } from '../union/toUnion.js';
11
13
  import { toGetRef } from '../../../helpers/refFns.js';
14
+ import { toSiblingKeywords } from '../../toSiblingKeywords.js';
15
+ import { logAllOfContradictions, toAllOfSystem } from '../../allOfSystem.js';
16
+ import { hasShapeKeyword, isUnknownAnyOf, logMergedUnknownAnyOf, logUnknownAnyOf, withoutUnknownAnyOf } from '../../anyOfSystem.js';
17
+ import { toAdditionalPropertiesV3 } from '../object/toAdditionalPropertiesV3.js';
12
18
  import { mergeIntersection } from '../_merge-all-of/merge-intersection.js';
13
19
  import { collapseNullOnlyUnion, mergeUnion } from '../_merge-all-of/merge-union.js';
20
+ import { isNullOnly } from '../_merge-all-of/nullable-merge.js';
14
21
  import { tryParseAt } from '../../../context/tryParseAt.js';
15
22
  import { isNullOnlyType, normalizeMergeMember, normalizeSchemaShape } from './normalize-schema-shape.js';
16
23
  export const toSchemasV3 = ({ schemas, stackTrail, context }) => {
@@ -57,13 +64,15 @@ const withoutWrapperUnevaluatedProperties = ({ schema, parentType, stackTrail, c
57
64
  return rest;
58
65
  };
59
66
  /**
60
- * Is this a 3.1 null-only schema member (`type: 'null'` or `['null']`)?
67
+ * Is this a null-only schema member: 3.1's `type: 'null'` or `['null']`, or
68
+ * 3.0's `{ nullable: true, enum: [null] }`?
61
69
  */
62
70
  const isNullTypeSchema = (member) => {
63
71
  if (isRef(member)) {
64
72
  return false;
65
73
  }
66
- return isNullOnlyType(member.type);
74
+ // 3.0's way to write null too: `{ nullable: true, enum: [null] }`, as the 3.0 parser reads it.
75
+ return isNullOnlyType(member.type) || isNullOnly(member);
67
76
  };
68
77
  /**
69
78
  * Split `oneOf`/`anyOf` members into the non-null members plus whether a
@@ -109,15 +118,48 @@ const collapseSingleMember = (value, member) => {
109
118
  };
110
119
  export const toSchemaV3 = ({ schema, stackTrail, context }) => {
111
120
  if (isRef(schema)) {
112
- return toRefV31({ ref: schema, refType: 'schema', stackTrail, context });
121
+ // In 3.2, as in JSON Schema 2020-12, keywords beside `$ref` apply with
122
+ // the target: the same as an `allOf` that starts with the reference.
123
+ const { $ref, ...keywords } = schema;
124
+ const allOf = 'allOf' in keywords ? keywords.allOf : undefined;
125
+ // An `allOf` that is not an array holds no members: reported, and the reference kept.
126
+ if (allOf !== undefined && !Array.isArray(allOf)) {
127
+ context.logSkippedFields({
128
+ skipped: { allOf },
129
+ parent: schema,
130
+ parentType: 'ref',
131
+ stackTrail
132
+ });
133
+ }
134
+ const members = Array.isArray(allOf) ? allOf : [];
135
+ return Object.keys(keywords).length > 0
136
+ ? toSchemaV3({ schema: { ...keywords, allOf: [{ $ref }, ...members] }, stackTrail, context })
137
+ : toRefV31({ ref: schema, refType: 'schema', stackTrail, context });
113
138
  }
114
139
  // OpenAPI `not` has no faithful TypeScript representation: a generated type
115
140
  // that ignored it would *widen* the contract (accepting shapes the schema
116
- // forbids). Refuse the schema rather than emit a type that lies. The throw
117
- // is isolated by `tryParseAt` into an `INVALID_SCHEMA` issue, and consumers
118
- // of this schema are pruned via `removeErroredItems` (INVALID_DEPENDENCY_REF).
141
+ // forbids). Under `client.json` `system.not: strict` (the default) the schema
142
+ // is refused rather than emit a type that lies. The throw is isolated by
143
+ // `tryParseAt` into an `INVALID_SCHEMA` issue, and consumers of this schema
144
+ // are pruned via `removeErroredItems` (INVALID_DEPENDENCY_REF).
145
+ //
146
+ // Under `system.not: unknown` the schema parses with its other keywords, and
147
+ // its `not` is kept as an `OasUnknown` that core does not read: a generator
148
+ // can see that the document says "not something".
119
149
  if ('not' in schema) {
120
- throw new Error('Schema uses unsupported "not" keyword');
150
+ // A test's mock context may have no `system`.
151
+ if (context.system?.not !== 'unknown') {
152
+ throw new Error('Schema uses unsupported "not" keyword');
153
+ }
154
+ const { not: _not, ...keywords } = schema;
155
+ const parsed = toSchemaV3({ schema: keywords, stackTrail, context });
156
+ // Only a one-member `allOf` of a `$ref` parses to a reference, and a
157
+ // reference has no field for a `not`. Fail rather than lose it.
158
+ if (parsed.isRef()) {
159
+ throw new Error('Schema uses "not" next to a one-member allOf reference, which cannot keep it');
160
+ }
161
+ parsed.not = stackTrail.trace('not', notTrail => context.withStackTrail(notTrail, () => new OasUnknown({}, context)));
162
+ return parsed;
121
163
  }
122
164
  const normalized = normalizeSchemaShape(schema);
123
165
  if (normalized !== schema) {
@@ -143,14 +185,40 @@ export const toSchemaV3 = ({ schema, stackTrail, context }) => {
143
185
  const members = allOf ?? [];
144
186
  if (members.length === 1) {
145
187
  const [member] = members;
146
- if (isRef(member) && value.nullable) {
147
- return toRefV31({
148
- ref: member,
149
- refType: 'schema',
150
- nullable: true,
151
- stackTrail: st,
152
- context
153
- });
188
+ // Keywords next to the one member say how this site uses the
189
+ // reference, which stays lazy, so a self-reference still ends:
190
+ // `nullable`, `readOnly` and `writeOnly` ride it as use-site flags,
191
+ // and the others are read without the target's type (`siblings`).
192
+ // `resolve()` applies them to a copy of the target at generate time;
193
+ // the ones its type cannot take are left out there. The shared model
194
+ // never changes.
195
+ if (isRef(member)) {
196
+ const { nullable, readOnly, writeOnly, ...keywords } = value;
197
+ const siblings = isEmpty(keywords)
198
+ ? undefined
199
+ : toSiblingKeywords({
200
+ keywords,
201
+ properties: stackTrail.trace('properties', propertiesTrail => toOptionalSchemasV3({ schemas: keywords.properties, stackTrail: propertiesTrail, context })),
202
+ additionalProperties: stackTrail.trace('additionalProperties', additionalTrail => toAdditionalPropertiesV3({
203
+ additionalProperties: keywords.additionalProperties,
204
+ stackTrail: additionalTrail,
205
+ context
206
+ })),
207
+ stackTrail,
208
+ context
209
+ });
210
+ if (nullable || readOnly || writeOnly || siblings) {
211
+ return toRefV31({
212
+ ref: member,
213
+ refType: 'schema',
214
+ nullable: nullable || undefined,
215
+ readOnly: readOnly || undefined,
216
+ writeOnly: writeOnly || undefined,
217
+ siblings,
218
+ stackTrail: st,
219
+ context
220
+ });
221
+ }
154
222
  }
155
223
  return toSchemaV3({
156
224
  schema: collapseSingleMember(value, member),
@@ -158,11 +226,15 @@ export const toSchemaV3 = ({ schema, stackTrail, context }) => {
158
226
  context
159
227
  });
160
228
  }
229
+ const system = toAllOfSystem(context);
161
230
  const merged = mergeIntersection({
162
231
  schema: wrapper,
163
232
  getRef: toGetRef(context.documentObject),
164
- normalize: normalizeMergeMember
233
+ normalize: normalizeMergeMember,
234
+ system
165
235
  });
236
+ logAllOfContradictions({ system, stackTrail, parent: schema, context });
237
+ logMergedUnknownAnyOf({ system, stackTrail, parent: schema, context });
166
238
  return toSchemaV3({ schema: merged, stackTrail: st, context });
167
239
  });
168
240
  }
@@ -186,12 +258,16 @@ export const toSchemaV3 = ({ schema, stackTrail, context }) => {
186
258
  const withoutNull = hasNullMember
187
259
  ? { ...wrapper, oneOf: oneOfWithoutNull, nullable: true }
188
260
  : wrapper;
261
+ const system = toAllOfSystem(context);
189
262
  const merged = mergeUnion({
190
263
  schema: withoutNull,
191
264
  getRef: toGetRef(context.documentObject),
192
265
  normalize: normalizeMergeMember,
266
+ system,
193
267
  groupType: 'oneOf'
194
268
  });
269
+ logAllOfContradictions({ system, stackTrail, parent: schema, context });
270
+ logMergedUnknownAnyOf({ system, stackTrail, parent: schema, context });
195
271
  if (!('oneOf' in merged) || !Array.isArray(merged.oneOf)) {
196
272
  throw new Error('Missing "oneOf" array');
197
273
  }
@@ -235,6 +311,21 @@ export const toSchemaV3 = ({ schema, stackTrail, context }) => {
235
311
  stackTrail,
236
312
  context
237
313
  });
314
+ // Under `system.anyOf: unknown`, as Cloudflare's `cf` reads it, an `anyOf`
315
+ // of two or more members is any value: the schema parses with its other
316
+ // keywords, so the properties next to it stay, without the members.
317
+ if (isUnknownAnyOf({ members: wrapper.anyOf ?? [], setting: context.system?.anyOf, getRef: toGetRef(context.documentObject) })) {
318
+ logUnknownAnyOf({ stackTrail, parent: schema, context });
319
+ const keywords = withoutUnknownAnyOf({
320
+ schema: wrapper,
321
+ setting: context.system?.anyOf,
322
+ getRef: toGetRef(context.documentObject)
323
+ });
324
+ // A `default` alone is no type: the parser would guess one from it.
325
+ return hasShapeKeyword(keywords)
326
+ ? toSchemaV3({ schema: keywords, stackTrail, context })
327
+ : toUnknown({ value: keywords, stackTrail, context });
328
+ }
238
329
  return stackTrail.trace('anyOf', st => {
239
330
  // deno-lint-ignore ban-ts-comment
240
331
  // @ts-expect-error
@@ -248,12 +339,16 @@ export const toSchemaV3 = ({ schema, stackTrail, context }) => {
248
339
  const withoutNull = hasNullMember
249
340
  ? { ...wrapper, anyOf: anyOfWithoutNull, nullable: true }
250
341
  : wrapper;
342
+ const system = toAllOfSystem(context);
251
343
  const merged = mergeUnion({
252
344
  schema: withoutNull,
253
345
  getRef: toGetRef(context.documentObject),
254
346
  normalize: normalizeMergeMember,
347
+ system,
255
348
  groupType: 'anyOf'
256
349
  });
350
+ logAllOfContradictions({ system, stackTrail, parent: schema, context });
351
+ logMergedUnknownAnyOf({ system, stackTrail, parent: schema, context });
257
352
  if (!('anyOf' in merged) || !Array.isArray(merged.anyOf)) {
258
353
  throw new Error('Missing "anyOf" array');
259
354
  }
@@ -35,5 +35,5 @@ export declare class OasBase {
35
35
  * at the empty trail, so `isEmpty()` cleanly means "synthetic".
36
36
  */
37
37
  stackTrail: StackTrail;
38
- constructor(context?: ParseContextType);
38
+ constructor(context?: Pick<ParseContextType, 'currentStackTrail'>);
39
39
  }
@@ -162,6 +162,8 @@ export declare const includeModels: v.GenericSchema<IncludeModels>;
162
162
  * {@link AnchorsSettings} for the consumer-facing fields.
163
163
  */
164
164
  export declare const anchorsSettings: v.GenericSchema<AnchorsSettings>;
165
+ /** Valibot schema for {@link SystemSettings}: `client.json#settings.system`. */
166
+ export declare const systemSettings: v.GenericSchema<SystemSettings>;
165
167
  export declare const clientSettings: v.GenericSchema<ClientSettings>;
166
168
  /**
167
169
  * Configuration for skipping specific HTTP methods + variants on API paths.
@@ -418,6 +420,46 @@ export type AnchorsSettings = {
418
420
  */
419
421
  out?: string;
420
422
  };
423
+ /**
424
+ * How the OpenAPI parser treats what it cannot read faithfully, or reads
425
+ * another way (`client.json#settings.system`). Each setting's default parses
426
+ * as core always did: `strict` fails the schema, and `removeErroredItems`
427
+ * removes each item that uses it.
428
+ */
429
+ export type SystemSettings = {
430
+ /**
431
+ * `latestWins`: where `allOf` members contradict, the later member's
432
+ * keyword wins, with one warning for each schema where it happens.
433
+ */
434
+ allOf?: 'strict' | 'latestWins';
435
+ /**
436
+ * `unknown`: a response whose schema fails gets an `unknown` schema (any
437
+ * body), with an error at the response, and the operation stays.
438
+ */
439
+ responseContradictions?: 'strict' | 'unknown';
440
+ /**
441
+ * `unknown`: a schema with `not` parses with its other keywords, and keeps
442
+ * its `not` as an `OasUnknown`.
443
+ */
444
+ not?: 'strict' | 'unknown';
445
+ /**
446
+ * `union` (the default): an `anyOf` is a union, as a `oneOf` is, and the
447
+ * keywords next to it merge into each member. `unknown`: as Cloudflare's
448
+ * `cf` reads it, an `anyOf` is any value. The schema parses with its other
449
+ * keywords and without the `anyOf`, with one warning for each schema.
450
+ */
451
+ anyOf?: 'union' | 'unknown';
452
+ /**
453
+ * `strict` (the default): a `$ref` that names nothing in the document is a
454
+ * parse error, and what holds it is removed, with what uses that. `keep`:
455
+ * the `$ref` stays, with a warning, and resolving it throws
456
+ * `DanglingRefError`, which a generator can catch to render something
457
+ * else. With either, a `$ref` to an example or a link is a warning and
458
+ * stays, and a `$ref` that core resolves while it parses (an `allOf`
459
+ * member that it merges) is an error, and what holds it is removed.
460
+ */
461
+ danglingRefs?: 'strict' | 'keep';
462
+ };
421
463
  export type ClientSettings = {
422
464
  /** Base output path for generated files */
423
465
  basePath?: string;
@@ -441,6 +483,8 @@ export type ClientSettings = {
441
483
  * in v1. See {@link AnchorsSettings}.
442
484
  */
443
485
  anchors?: AnchorsSettings;
486
+ /** How the OpenAPI parser treats what it cannot read faithfully. See {@link SystemSettings}. */
487
+ system?: SystemSettings;
444
488
  /**
445
489
  * Preview input-matcher discovery directories (project-root relative, e.g.
446
490
  * `src/fields`, `src/inputs`). A preview/hub concern: the generation engine
@@ -169,6 +169,14 @@ export const anchorsSettings = v.object({
169
169
  enabled: v.boolean(),
170
170
  out: v.optional(v.string())
171
171
  });
172
+ /** Valibot schema for {@link SystemSettings}: `client.json#settings.system`. */
173
+ export const systemSettings = v.object({
174
+ allOf: v.optional(v.picklist(['strict', 'latestWins'])),
175
+ responseContradictions: v.optional(v.picklist(['strict', 'unknown'])),
176
+ not: v.optional(v.picklist(['strict', 'unknown'])),
177
+ anyOf: v.optional(v.picklist(['union', 'unknown'])),
178
+ danglingRefs: v.optional(v.picklist(['strict', 'keep']))
179
+ });
172
180
  export const clientSettings = v.object({
173
181
  basePath: v.optional(v.pipe(v.string(), v.check(basePath => !isAbsolutePath(basePath), 'basePath must be relative to the SKMTC root (the directory containing .skmtc/); ' +
174
182
  'absolute paths are not supported because generated output is always written under it'), v.check(basePath => !hasParentSegment(basePath), 'basePath must be a forward path with no ".." segments — it is the on-disk anchor ' +
@@ -179,6 +187,7 @@ export const clientSettings = v.object({
179
187
  include: v.optional(v.array(include)),
180
188
  skip: v.optional(v.array(skip)),
181
189
  anchors: v.optional(anchorsSettings),
190
+ system: v.optional(systemSettings),
182
191
  inputDirs: v.optional(v.array(v.string())),
183
192
  formatter: v.optional(v.string()),
184
193
  generatedSuffix: v.optional(v.string()),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skmtc/core",
3
- "version": "0.39.0",
3
+ "version": "0.41.0",
4
4
  "description": "Skmtc is a declarative code generation framework",
5
5
  "keywords": [
6
6
  "openapi",
@@ -35,6 +35,10 @@
35
35
  "import": "./esm/dsl/CustomValue.js",
36
36
  "require": "./script/dsl/CustomValue.js"
37
37
  },
38
+ "./DanglingRefError": {
39
+ "import": "./esm/oas/ref/DanglingRefError.js",
40
+ "require": "./script/oas/ref/DanglingRefError.js"
41
+ },
38
42
  "./DenoJson": {
39
43
  "import": "./esm/types/DenoJson.js",
40
44
  "require": "./script/types/DenoJson.js"
@@ -43,7 +43,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
43
43
  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");
44
44
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
45
45
  };
46
- 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;
46
+ 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;
47
47
  Object.defineProperty(exports, "__esModule", { value: true });
48
48
  exports.CoreContext = void 0;
49
49
  exports.skmtcFormatter = skmtcFormatter;
@@ -60,6 +60,7 @@ const ResultsLog_js_1 = require("../helpers/ResultsLog.js");
60
60
  const join_js_1 = require("../deps/jsr.io/@std/path/1.1.6/join.js");
61
61
  const colors_js_1 = require("../deps/jsr.io/@std/fmt/1.0.10/colors.js");
62
62
  const SerializedError_js_1 = require("../types/SerializedError.js");
63
+ const toGenerationFailure_js_1 = require("./toGenerationFailure.js");
63
64
  /**
64
65
  * The main orchestration class for the SKMTC transformation pipeline.
65
66
  *
@@ -168,6 +169,16 @@ class CoreContext {
168
169
  * render phases replace `#phase`, so a later failure still returns them.
169
170
  */
170
171
  _CoreContext_parseIssues.set(this, []
172
+ /**
173
+ * The enrichment warnings of this run, kept so a failure in generate or
174
+ * render still returns them: a misaddressed enrichment is often the cause.
175
+ */
176
+ );
177
+ /**
178
+ * The enrichment warnings of this run, kept so a failure in generate or
179
+ * render still returns them: a misaddressed enrichment is often the cause.
180
+ */
181
+ _CoreContext_enrichmentWarnings.set(this, []
171
182
  /**
172
183
  * Creates a new CoreContext instance.
173
184
  *
@@ -322,7 +333,8 @@ class CoreContext {
322
333
  // A throw while the parse context is set up counts as parse.
323
334
  __classPrivateFieldSet(this, _CoreContext_phaseName, 'parse', "f");
324
335
  __classPrivateFieldSet(this, _CoreContext_parseIssues, [], "f");
325
- const phase = __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupParsePhase).call(this, document);
336
+ __classPrivateFieldSet(this, _CoreContext_enrichmentWarnings, [], "f");
337
+ const phase = __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupParsePhase).call(this, document, settings);
326
338
  __classPrivateFieldSet(this, _CoreContext_phase, phase, "f");
327
339
  __classPrivateFieldSet(this, _CoreContext_parseIssues, phase.context.issues, "f");
328
340
  const parsedDocument = stackTrail.trace('parse', st => phase.context.parse(st));
@@ -341,6 +353,7 @@ class CoreContext {
341
353
  });
342
354
  __classPrivateFieldSet(this, _CoreContext_phase, generatePhase, "f");
343
355
  const generated = generatePhase.context.toArtifacts(st);
356
+ __classPrivateFieldSet(this, _CoreContext_enrichmentWarnings, generated.enrichmentWarnings, "f");
344
357
  // Opt-in snapshot of the live files graph, taken after generate populates
345
358
  // it and before render replaces the phase. Off unless `inspect` is set.
346
359
  return {
@@ -396,7 +409,7 @@ class CoreContext {
396
409
  previews: {},
397
410
  results: __classPrivateFieldGet(this, _CoreContext_results, "f").toTree(),
398
411
  parseIssues: [...priorIssues, fatalIssue],
399
- enrichmentWarnings: [],
412
+ enrichmentWarnings: error instanceof toGenerationFailure_js_1.GenerationFailure ? error.enrichmentWarnings : __classPrivateFieldGet(this, _CoreContext_enrichmentWarnings, "f"),
400
413
  logs: [...__classPrivateFieldGet(this, _CoreContext_logLines, "f").lines]
401
414
  };
402
415
  }
@@ -413,7 +426,7 @@ class CoreContext {
413
426
  try {
414
427
  __classPrivateFieldSet(this, _CoreContext_phaseName, 'parse', "f");
415
428
  __classPrivateFieldSet(this, _CoreContext_parseIssues, [], "f");
416
- const phase = __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupParsePhase).call(this, document);
429
+ const phase = __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupParsePhase).call(this, document, settings);
417
430
  __classPrivateFieldSet(this, _CoreContext_phase, phase, "f");
418
431
  __classPrivateFieldSet(this, _CoreContext_parseIssues, phase.context.issues, "f");
419
432
  const parsedDocument = stackTrail.trace('parse', st => phase.context.parse(st));
@@ -459,7 +472,7 @@ class CoreContext {
459
472
  try {
460
473
  __classPrivateFieldSet(this, _CoreContext_phaseName, 'parse', "f");
461
474
  __classPrivateFieldSet(this, _CoreContext_parseIssues, [], "f");
462
- const phase = __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupParsePhase).call(this, document);
475
+ const phase = __classPrivateFieldGet(this, _CoreContext_instances, "m", _CoreContext_setupParsePhase).call(this, document, settings);
463
476
  __classPrivateFieldSet(this, _CoreContext_phase, phase, "f");
464
477
  __classPrivateFieldSet(this, _CoreContext_parseIssues, phase.context.issues, "f");
465
478
  const parsedDocument = stackTrail.trace('parse', st => phase.context.parse(st));
@@ -513,7 +526,7 @@ class CoreContext {
513
526
  }
514
527
  }
515
528
  exports.CoreContext = CoreContext;
516
- _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 }) {
529
+ _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 }) {
517
530
  const fileHandlers = logsPath
518
531
  ? [
519
532
  new log.FileHandler('DEBUG', {
@@ -561,11 +574,12 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
561
574
  throw new Error(`Unhandled protocol type: ${JSON.stringify(_exhaustive)}`);
562
575
  }
563
576
  }
564
- }, _CoreContext_setupParsePhase = function _CoreContext_setupParsePhase(input) {
577
+ }, _CoreContext_setupParsePhase = function _CoreContext_setupParsePhase(input, settings) {
565
578
  const parseContext = new ParseContext_js_1.ParseContext({
566
579
  input,
567
580
  logger: this.logger,
568
- silent: this.silent
581
+ silent: this.silent,
582
+ system: settings?.system
569
583
  });
570
584
  return { type: 'parse', context: parseContext };
571
585
  }, _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
@@ -327,9 +328,9 @@ export declare class GenerateContext implements GenerateContextType {
327
328
  * Perform one lookup of schema by `refName`.
328
329
  * @param refName
329
330
  * @returns Matching schema or ref
330
- * @throws if schema is not found
331
+ * @throws {DanglingRefError} when no schema has that name
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.