@skmtc/core 0.38.0 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (343) hide show
  1. package/esm/context/CoreContext.js +22 -8
  2. package/esm/context/GenerateContext.d.ts +5 -4
  3. package/esm/context/GenerateContext.js +110 -37
  4. package/esm/context/ParseContext.d.ts +9 -1
  5. package/esm/context/ParseContext.js +12 -1
  6. package/esm/context/generateTypes.d.ts +19 -4
  7. package/esm/context/generateTypes.js +2 -0
  8. package/esm/context/toGenerationFailure.d.ts +21 -0
  9. package/esm/context/toGenerationFailure.js +38 -0
  10. package/esm/dsl/CustomValue.d.ts +4 -0
  11. package/esm/dsl/CustomValue.js +8 -0
  12. package/esm/dsl/Definition.d.ts +10 -0
  13. package/esm/dsl/Definition.js +14 -0
  14. package/esm/dsl/PendingDefinition.d.ts +47 -0
  15. package/esm/dsl/PendingDefinition.js +83 -0
  16. package/esm/dsl/model/ModelDriver.d.ts +55 -1
  17. package/esm/dsl/model/ModelDriver.js +228 -51
  18. package/esm/dsl/model/toModelEntry.d.ts +1 -1
  19. package/esm/dsl/model/toModelEntry.js +1 -1
  20. package/esm/dsl/model/types.d.ts +1 -1
  21. package/esm/dsl/operation/gql/GqlOperationDriver.js +1 -4
  22. package/esm/dsl/webhook/WebhookDriver.js +1 -4
  23. package/esm/enrichments/parseEnrichmentUmbrella.d.ts +5 -6
  24. package/esm/enrichments/parseEnrichmentUmbrella.js +23 -8
  25. package/esm/enrichments/parseEnrichmentValue.d.ts +17 -0
  26. package/esm/enrichments/parseEnrichmentValue.js +32 -0
  27. package/esm/enrichments/readEnrichments.d.ts +5 -5
  28. package/esm/enrichments/readEnrichments.js +17 -7
  29. package/esm/mod.d.ts +1 -0
  30. package/esm/mod.js +1 -0
  31. package/esm/oas/array/Array.d.ts +19 -0
  32. package/esm/oas/array/Array.js +47 -0
  33. package/esm/oas/boolean/Boolean.d.ts +19 -0
  34. package/esm/oas/boolean/Boolean.js +51 -8
  35. package/esm/oas/example/Example.d.ts +4 -0
  36. package/esm/oas/example/Example.js +8 -0
  37. package/esm/oas/header/Header.d.ts +4 -0
  38. package/esm/oas/header/Header.js +8 -0
  39. package/esm/oas/integer/Integer.d.ts +19 -0
  40. package/esm/oas/integer/Integer.js +49 -0
  41. package/esm/oas/link/Link.d.ts +4 -0
  42. package/esm/oas/link/Link.js +8 -0
  43. package/esm/oas/number/Number.d.ts +19 -0
  44. package/esm/oas/number/Number.js +49 -0
  45. package/esm/oas/object/Object.d.ts +19 -0
  46. package/esm/oas/object/Object.js +68 -18
  47. package/esm/oas/operation/Operation.d.ts +5 -1
  48. package/esm/oas/operation/Operation.js +17 -5
  49. package/esm/oas/operation/toEffectiveParameters.d.ts +16 -0
  50. package/esm/oas/operation/toEffectiveParameters.js +13 -0
  51. package/esm/oas/parameter/Parameter.d.ts +4 -0
  52. package/esm/oas/parameter/Parameter.js +8 -0
  53. package/esm/oas/ref/Ref.d.ts +147 -25
  54. package/esm/oas/ref/Ref.js +387 -25
  55. package/esm/oas/requestBody/RequestBody.d.ts +4 -0
  56. package/esm/oas/requestBody/RequestBody.js +8 -0
  57. package/esm/oas/response/Response.d.ts +4 -0
  58. package/esm/oas/response/Response.js +8 -0
  59. package/esm/oas/schema/siblings.d.ts +127 -0
  60. package/esm/oas/schema/siblings.js +240 -0
  61. package/esm/oas/securitySchemes/SecurityScheme.d.ts +16 -0
  62. package/esm/oas/securitySchemes/SecurityScheme.js +32 -0
  63. package/esm/oas/string/String.d.ts +19 -0
  64. package/esm/oas/string/String.js +47 -0
  65. package/esm/oas/union/Union.d.ts +31 -0
  66. package/esm/oas/union/Union.js +100 -0
  67. package/esm/oas/unknown/Unknown.d.ts +18 -0
  68. package/esm/oas/unknown/Unknown.js +38 -0
  69. package/esm/oas/void/Void.d.ts +4 -0
  70. package/esm/oas/void/Void.js +8 -0
  71. package/esm/oas/webhook/Webhook.d.ts +2 -2
  72. package/esm/oas/webhook/Webhook.js +6 -5
  73. package/esm/parse/allOfSystem.d.ts +32 -0
  74. package/esm/parse/allOfSystem.js +30 -0
  75. package/esm/parse/anyOfSystem.d.ts +68 -0
  76. package/esm/parse/anyOfSystem.js +107 -0
  77. package/esm/parse/toSiblingKeywords.d.ts +28 -0
  78. package/esm/parse/toSiblingKeywords.js +109 -0
  79. package/esm/parse/v3-0/_merge-all-of/decompose-union.d.ts +8 -0
  80. package/esm/parse/v3-0/_merge-all-of/decompose-union.js +9 -1
  81. package/esm/parse/v3-0/_merge-all-of/generic-merge.d.ts +2 -3
  82. package/esm/parse/v3-0/_merge-all-of/generic-merge.js +2 -2
  83. package/esm/parse/v3-0/_merge-all-of/merge-array-constraints.d.ts +2 -2
  84. package/esm/parse/v3-0/_merge-all-of/merge-array-constraints.js +5 -5
  85. package/esm/parse/v3-0/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  86. package/esm/parse/v3-0/_merge-all-of/merge-boolean-constraints.js +2 -2
  87. package/esm/parse/v3-0/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  88. package/esm/parse/v3-0/_merge-all-of/merge-integer-constraints.js +2 -2
  89. package/esm/parse/v3-0/_merge-all-of/merge-intersection.d.ts +3 -2
  90. package/esm/parse/v3-0/_merge-all-of/merge-intersection.js +2 -2
  91. package/esm/parse/v3-0/_merge-all-of/merge-number-constraints.d.ts +2 -2
  92. package/esm/parse/v3-0/_merge-all-of/merge-number-constraints.js +2 -2
  93. package/esm/parse/v3-0/_merge-all-of/merge-object-constraints.d.ts +2 -2
  94. package/esm/parse/v3-0/_merge-all-of/merge-object-constraints.js +3 -3
  95. package/esm/parse/v3-0/_merge-all-of/merge-properties.d.ts +2 -2
  96. package/esm/parse/v3-0/_merge-all-of/merge-properties.js +2 -2
  97. package/esm/parse/v3-0/_merge-all-of/merge-string-constraints.d.ts +2 -2
  98. package/esm/parse/v3-0/_merge-all-of/merge-string-constraints.js +3 -3
  99. package/esm/parse/v3-0/_merge-all-of/merge-union.d.ts +10 -3
  100. package/esm/parse/v3-0/_merge-all-of/merge-union.js +50 -12
  101. package/esm/parse/v3-0/_merge-all-of/merge.d.ts +2 -2
  102. package/esm/parse/v3-0/_merge-all-of/merge.js +78 -27
  103. package/esm/parse/v3-0/_merge-all-of/nullable-merge.d.ts +4 -0
  104. package/esm/parse/v3-0/_merge-all-of/nullable-merge.js +9 -7
  105. package/esm/parse/v3-0/_merge-all-of/types.d.ts +33 -0
  106. package/esm/parse/v3-0/ref/toRefV31.d.ts +7 -1
  107. package/esm/parse/v3-0/ref/toRefV31.js +2 -2
  108. package/esm/parse/v3-0/schema/toSchemasV3.js +107 -15
  109. package/esm/parse/v3-1/_merge-all-of/decompose-union.d.ts +7 -1
  110. package/esm/parse/v3-1/_merge-all-of/decompose-union.js +8 -2
  111. package/esm/parse/v3-1/_merge-all-of/generic-merge.d.ts +2 -3
  112. package/esm/parse/v3-1/_merge-all-of/generic-merge.js +2 -2
  113. package/esm/parse/v3-1/_merge-all-of/merge-array-constraints.d.ts +3 -2
  114. package/esm/parse/v3-1/_merge-all-of/merge-array-constraints.js +5 -5
  115. package/esm/parse/v3-1/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  116. package/esm/parse/v3-1/_merge-all-of/merge-boolean-constraints.js +2 -2
  117. package/esm/parse/v3-1/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  118. package/esm/parse/v3-1/_merge-all-of/merge-integer-constraints.js +2 -2
  119. package/esm/parse/v3-1/_merge-all-of/merge-intersection.d.ts +3 -2
  120. package/esm/parse/v3-1/_merge-all-of/merge-intersection.js +2 -2
  121. package/esm/parse/v3-1/_merge-all-of/merge-number-constraints.d.ts +2 -2
  122. package/esm/parse/v3-1/_merge-all-of/merge-number-constraints.js +2 -2
  123. package/esm/parse/v3-1/_merge-all-of/merge-object-constraints.d.ts +2 -2
  124. package/esm/parse/v3-1/_merge-all-of/merge-object-constraints.js +3 -3
  125. package/esm/parse/v3-1/_merge-all-of/merge-properties.d.ts +2 -2
  126. package/esm/parse/v3-1/_merge-all-of/merge-properties.js +2 -2
  127. package/esm/parse/v3-1/_merge-all-of/merge-string-constraints.d.ts +2 -2
  128. package/esm/parse/v3-1/_merge-all-of/merge-string-constraints.js +3 -3
  129. package/esm/parse/v3-1/_merge-all-of/merge-union.d.ts +10 -3
  130. package/esm/parse/v3-1/_merge-all-of/merge-union.js +54 -15
  131. package/esm/parse/v3-1/_merge-all-of/merge.d.ts +3 -2
  132. package/esm/parse/v3-1/_merge-all-of/merge.js +88 -29
  133. package/esm/parse/v3-1/_merge-all-of/nullable-merge.d.ts +4 -0
  134. package/esm/parse/v3-1/_merge-all-of/nullable-merge.js +9 -7
  135. package/esm/parse/v3-1/_merge-all-of/types.d.ts +37 -0
  136. package/esm/parse/v3-1/ref/toRefV31.d.ts +7 -1
  137. package/esm/parse/v3-1/ref/toRefV31.js +2 -2
  138. package/esm/parse/v3-1/schema/toSchemasV3.js +111 -16
  139. package/esm/parse/v3-2/_merge-all-of/decompose-union.d.ts +7 -1
  140. package/esm/parse/v3-2/_merge-all-of/decompose-union.js +8 -2
  141. package/esm/parse/v3-2/_merge-all-of/generic-merge.d.ts +2 -3
  142. package/esm/parse/v3-2/_merge-all-of/generic-merge.js +2 -2
  143. package/esm/parse/v3-2/_merge-all-of/merge-array-constraints.d.ts +3 -2
  144. package/esm/parse/v3-2/_merge-all-of/merge-array-constraints.js +5 -5
  145. package/esm/parse/v3-2/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  146. package/esm/parse/v3-2/_merge-all-of/merge-boolean-constraints.js +2 -2
  147. package/esm/parse/v3-2/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  148. package/esm/parse/v3-2/_merge-all-of/merge-integer-constraints.js +2 -2
  149. package/esm/parse/v3-2/_merge-all-of/merge-intersection.d.ts +3 -2
  150. package/esm/parse/v3-2/_merge-all-of/merge-intersection.js +2 -2
  151. package/esm/parse/v3-2/_merge-all-of/merge-number-constraints.d.ts +2 -2
  152. package/esm/parse/v3-2/_merge-all-of/merge-number-constraints.js +2 -2
  153. package/esm/parse/v3-2/_merge-all-of/merge-object-constraints.d.ts +2 -2
  154. package/esm/parse/v3-2/_merge-all-of/merge-object-constraints.js +3 -3
  155. package/esm/parse/v3-2/_merge-all-of/merge-properties.d.ts +2 -2
  156. package/esm/parse/v3-2/_merge-all-of/merge-properties.js +2 -2
  157. package/esm/parse/v3-2/_merge-all-of/merge-string-constraints.d.ts +2 -2
  158. package/esm/parse/v3-2/_merge-all-of/merge-string-constraints.js +3 -3
  159. package/esm/parse/v3-2/_merge-all-of/merge-union.d.ts +10 -3
  160. package/esm/parse/v3-2/_merge-all-of/merge-union.js +54 -15
  161. package/esm/parse/v3-2/_merge-all-of/merge.d.ts +3 -2
  162. package/esm/parse/v3-2/_merge-all-of/merge.js +88 -29
  163. package/esm/parse/v3-2/_merge-all-of/nullable-merge.d.ts +4 -0
  164. package/esm/parse/v3-2/_merge-all-of/nullable-merge.js +9 -7
  165. package/esm/parse/v3-2/_merge-all-of/types.d.ts +37 -0
  166. package/esm/parse/v3-2/ref/toRefV31.d.ts +7 -1
  167. package/esm/parse/v3-2/ref/toRefV31.js +2 -2
  168. package/esm/parse/v3-2/schema/toSchemasV3.js +111 -16
  169. package/esm/types/OasBase.d.ts +1 -1
  170. package/esm/types/Settings.d.ts +34 -0
  171. package/esm/types/Settings.js +8 -0
  172. package/package.json +1 -1
  173. package/script/context/CoreContext.js +22 -8
  174. package/script/context/GenerateContext.d.ts +5 -4
  175. package/script/context/GenerateContext.js +110 -37
  176. package/script/context/ParseContext.d.ts +9 -1
  177. package/script/context/ParseContext.js +12 -1
  178. package/script/context/generateTypes.d.ts +19 -4
  179. package/script/context/generateTypes.js +2 -0
  180. package/script/context/toGenerationFailure.d.ts +21 -0
  181. package/script/context/toGenerationFailure.js +43 -0
  182. package/script/dsl/CustomValue.d.ts +4 -0
  183. package/script/dsl/CustomValue.js +8 -0
  184. package/script/dsl/Definition.d.ts +10 -0
  185. package/script/dsl/Definition.js +14 -0
  186. package/script/dsl/PendingDefinition.d.ts +47 -0
  187. package/script/dsl/PendingDefinition.js +87 -0
  188. package/script/dsl/model/ModelDriver.d.ts +55 -1
  189. package/script/dsl/model/ModelDriver.js +231 -52
  190. package/script/dsl/model/toModelEntry.d.ts +1 -1
  191. package/script/dsl/model/toModelEntry.js +1 -1
  192. package/script/dsl/model/types.d.ts +1 -1
  193. package/script/dsl/operation/gql/GqlOperationDriver.js +1 -4
  194. package/script/dsl/webhook/WebhookDriver.js +1 -4
  195. package/script/enrichments/parseEnrichmentUmbrella.d.ts +5 -6
  196. package/script/enrichments/parseEnrichmentUmbrella.js +23 -41
  197. package/script/enrichments/parseEnrichmentValue.d.ts +17 -0
  198. package/script/enrichments/parseEnrichmentValue.js +69 -0
  199. package/script/enrichments/readEnrichments.d.ts +5 -5
  200. package/script/enrichments/readEnrichments.js +17 -40
  201. package/script/mod.d.ts +1 -0
  202. package/script/mod.js +1 -0
  203. package/script/oas/array/Array.d.ts +19 -0
  204. package/script/oas/array/Array.js +47 -0
  205. package/script/oas/boolean/Boolean.d.ts +19 -0
  206. package/script/oas/boolean/Boolean.js +51 -8
  207. package/script/oas/example/Example.d.ts +4 -0
  208. package/script/oas/example/Example.js +8 -0
  209. package/script/oas/header/Header.d.ts +4 -0
  210. package/script/oas/header/Header.js +8 -0
  211. package/script/oas/integer/Integer.d.ts +19 -0
  212. package/script/oas/integer/Integer.js +49 -0
  213. package/script/oas/link/Link.d.ts +4 -0
  214. package/script/oas/link/Link.js +8 -0
  215. package/script/oas/number/Number.d.ts +19 -0
  216. package/script/oas/number/Number.js +49 -0
  217. package/script/oas/object/Object.d.ts +19 -0
  218. package/script/oas/object/Object.js +68 -18
  219. package/script/oas/operation/Operation.d.ts +5 -1
  220. package/script/oas/operation/Operation.js +17 -5
  221. package/script/oas/operation/toEffectiveParameters.d.ts +16 -0
  222. package/script/oas/operation/toEffectiveParameters.js +17 -0
  223. package/script/oas/parameter/Parameter.d.ts +4 -0
  224. package/script/oas/parameter/Parameter.js +8 -0
  225. package/script/oas/ref/Ref.d.ts +147 -25
  226. package/script/oas/ref/Ref.js +387 -25
  227. package/script/oas/requestBody/RequestBody.d.ts +4 -0
  228. package/script/oas/requestBody/RequestBody.js +8 -0
  229. package/script/oas/response/Response.d.ts +4 -0
  230. package/script/oas/response/Response.js +8 -0
  231. package/script/oas/schema/siblings.d.ts +127 -0
  232. package/script/oas/schema/siblings.js +295 -0
  233. package/script/oas/securitySchemes/SecurityScheme.d.ts +16 -0
  234. package/script/oas/securitySchemes/SecurityScheme.js +32 -0
  235. package/script/oas/string/String.d.ts +19 -0
  236. package/script/oas/string/String.js +47 -0
  237. package/script/oas/union/Union.d.ts +31 -0
  238. package/script/oas/union/Union.js +100 -0
  239. package/script/oas/unknown/Unknown.d.ts +18 -0
  240. package/script/oas/unknown/Unknown.js +38 -0
  241. package/script/oas/void/Void.d.ts +4 -0
  242. package/script/oas/void/Void.js +8 -0
  243. package/script/oas/webhook/Webhook.d.ts +2 -2
  244. package/script/oas/webhook/Webhook.js +6 -5
  245. package/script/parse/allOfSystem.d.ts +32 -0
  246. package/script/parse/allOfSystem.js +35 -0
  247. package/script/parse/anyOfSystem.d.ts +68 -0
  248. package/script/parse/anyOfSystem.js +116 -0
  249. package/script/parse/toSiblingKeywords.d.ts +28 -0
  250. package/script/parse/toSiblingKeywords.js +146 -0
  251. package/script/parse/v3-0/_merge-all-of/decompose-union.d.ts +8 -0
  252. package/script/parse/v3-0/_merge-all-of/decompose-union.js +11 -2
  253. package/script/parse/v3-0/_merge-all-of/generic-merge.d.ts +2 -3
  254. package/script/parse/v3-0/_merge-all-of/generic-merge.js +2 -2
  255. package/script/parse/v3-0/_merge-all-of/merge-array-constraints.d.ts +2 -2
  256. package/script/parse/v3-0/_merge-all-of/merge-array-constraints.js +5 -5
  257. package/script/parse/v3-0/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  258. package/script/parse/v3-0/_merge-all-of/merge-boolean-constraints.js +2 -2
  259. package/script/parse/v3-0/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  260. package/script/parse/v3-0/_merge-all-of/merge-integer-constraints.js +2 -2
  261. package/script/parse/v3-0/_merge-all-of/merge-intersection.d.ts +3 -2
  262. package/script/parse/v3-0/_merge-all-of/merge-intersection.js +2 -2
  263. package/script/parse/v3-0/_merge-all-of/merge-number-constraints.d.ts +2 -2
  264. package/script/parse/v3-0/_merge-all-of/merge-number-constraints.js +2 -2
  265. package/script/parse/v3-0/_merge-all-of/merge-object-constraints.d.ts +2 -2
  266. package/script/parse/v3-0/_merge-all-of/merge-object-constraints.js +3 -3
  267. package/script/parse/v3-0/_merge-all-of/merge-properties.d.ts +2 -2
  268. package/script/parse/v3-0/_merge-all-of/merge-properties.js +2 -2
  269. package/script/parse/v3-0/_merge-all-of/merge-string-constraints.d.ts +2 -2
  270. package/script/parse/v3-0/_merge-all-of/merge-string-constraints.js +3 -3
  271. package/script/parse/v3-0/_merge-all-of/merge-union.d.ts +10 -3
  272. package/script/parse/v3-0/_merge-all-of/merge-union.js +52 -13
  273. package/script/parse/v3-0/_merge-all-of/merge.d.ts +2 -2
  274. package/script/parse/v3-0/_merge-all-of/merge.js +77 -26
  275. package/script/parse/v3-0/_merge-all-of/nullable-merge.d.ts +4 -0
  276. package/script/parse/v3-0/_merge-all-of/nullable-merge.js +9 -7
  277. package/script/parse/v3-0/_merge-all-of/types.d.ts +33 -0
  278. package/script/parse/v3-0/ref/toRefV31.d.ts +7 -1
  279. package/script/parse/v3-0/ref/toRefV31.js +2 -2
  280. package/script/parse/v3-0/schema/toSchemasV3.js +107 -15
  281. package/script/parse/v3-1/_merge-all-of/decompose-union.d.ts +7 -1
  282. package/script/parse/v3-1/_merge-all-of/decompose-union.js +8 -2
  283. package/script/parse/v3-1/_merge-all-of/generic-merge.d.ts +2 -3
  284. package/script/parse/v3-1/_merge-all-of/generic-merge.js +2 -2
  285. package/script/parse/v3-1/_merge-all-of/merge-array-constraints.d.ts +3 -2
  286. package/script/parse/v3-1/_merge-all-of/merge-array-constraints.js +5 -5
  287. package/script/parse/v3-1/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  288. package/script/parse/v3-1/_merge-all-of/merge-boolean-constraints.js +2 -2
  289. package/script/parse/v3-1/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  290. package/script/parse/v3-1/_merge-all-of/merge-integer-constraints.js +2 -2
  291. package/script/parse/v3-1/_merge-all-of/merge-intersection.d.ts +3 -2
  292. package/script/parse/v3-1/_merge-all-of/merge-intersection.js +2 -2
  293. package/script/parse/v3-1/_merge-all-of/merge-number-constraints.d.ts +2 -2
  294. package/script/parse/v3-1/_merge-all-of/merge-number-constraints.js +2 -2
  295. package/script/parse/v3-1/_merge-all-of/merge-object-constraints.d.ts +2 -2
  296. package/script/parse/v3-1/_merge-all-of/merge-object-constraints.js +3 -3
  297. package/script/parse/v3-1/_merge-all-of/merge-properties.d.ts +2 -2
  298. package/script/parse/v3-1/_merge-all-of/merge-properties.js +2 -2
  299. package/script/parse/v3-1/_merge-all-of/merge-string-constraints.d.ts +2 -2
  300. package/script/parse/v3-1/_merge-all-of/merge-string-constraints.js +3 -3
  301. package/script/parse/v3-1/_merge-all-of/merge-union.d.ts +10 -3
  302. package/script/parse/v3-1/_merge-all-of/merge-union.js +56 -16
  303. package/script/parse/v3-1/_merge-all-of/merge.d.ts +3 -2
  304. package/script/parse/v3-1/_merge-all-of/merge.js +87 -28
  305. package/script/parse/v3-1/_merge-all-of/nullable-merge.d.ts +4 -0
  306. package/script/parse/v3-1/_merge-all-of/nullable-merge.js +9 -7
  307. package/script/parse/v3-1/_merge-all-of/types.d.ts +37 -0
  308. package/script/parse/v3-1/ref/toRefV31.d.ts +7 -1
  309. package/script/parse/v3-1/ref/toRefV31.js +2 -2
  310. package/script/parse/v3-1/schema/toSchemasV3.js +111 -16
  311. package/script/parse/v3-2/_merge-all-of/decompose-union.d.ts +7 -1
  312. package/script/parse/v3-2/_merge-all-of/decompose-union.js +8 -2
  313. package/script/parse/v3-2/_merge-all-of/generic-merge.d.ts +2 -3
  314. package/script/parse/v3-2/_merge-all-of/generic-merge.js +2 -2
  315. package/script/parse/v3-2/_merge-all-of/merge-array-constraints.d.ts +3 -2
  316. package/script/parse/v3-2/_merge-all-of/merge-array-constraints.js +5 -5
  317. package/script/parse/v3-2/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  318. package/script/parse/v3-2/_merge-all-of/merge-boolean-constraints.js +2 -2
  319. package/script/parse/v3-2/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  320. package/script/parse/v3-2/_merge-all-of/merge-integer-constraints.js +2 -2
  321. package/script/parse/v3-2/_merge-all-of/merge-intersection.d.ts +3 -2
  322. package/script/parse/v3-2/_merge-all-of/merge-intersection.js +2 -2
  323. package/script/parse/v3-2/_merge-all-of/merge-number-constraints.d.ts +2 -2
  324. package/script/parse/v3-2/_merge-all-of/merge-number-constraints.js +2 -2
  325. package/script/parse/v3-2/_merge-all-of/merge-object-constraints.d.ts +2 -2
  326. package/script/parse/v3-2/_merge-all-of/merge-object-constraints.js +3 -3
  327. package/script/parse/v3-2/_merge-all-of/merge-properties.d.ts +2 -2
  328. package/script/parse/v3-2/_merge-all-of/merge-properties.js +2 -2
  329. package/script/parse/v3-2/_merge-all-of/merge-string-constraints.d.ts +2 -2
  330. package/script/parse/v3-2/_merge-all-of/merge-string-constraints.js +3 -3
  331. package/script/parse/v3-2/_merge-all-of/merge-union.d.ts +10 -3
  332. package/script/parse/v3-2/_merge-all-of/merge-union.js +56 -16
  333. package/script/parse/v3-2/_merge-all-of/merge.d.ts +3 -2
  334. package/script/parse/v3-2/_merge-all-of/merge.js +87 -28
  335. package/script/parse/v3-2/_merge-all-of/nullable-merge.d.ts +4 -0
  336. package/script/parse/v3-2/_merge-all-of/nullable-merge.js +9 -7
  337. package/script/parse/v3-2/_merge-all-of/types.d.ts +37 -0
  338. package/script/parse/v3-2/ref/toRefV31.d.ts +7 -1
  339. package/script/parse/v3-2/ref/toRefV31.js +2 -2
  340. package/script/parse/v3-2/schema/toSchemasV3.js +111 -16
  341. package/script/types/OasBase.d.ts +1 -1
  342. package/script/types/Settings.d.ts +34 -0
  343. package/script/types/Settings.js +9 -1
@@ -10,13 +10,14 @@ 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 _OasRef_instances, _OasRef_fields, _OasRef_document, _OasRef_resolveOasOnce, _OasRef_resolveGqlOnce;
13
+ var _OasRef_instances, _OasRef_document, _OasRef_resolution, _OasRef_toResolution, _OasRef_toSiteSchema, _OasRef_resolveOasOnce, _OasRef_resolveGqlOnce;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.OasRef = void 0;
16
16
  require("../../_dnt.polyfills.js");
17
17
  const traverseSchema_js_1 = require("../schemaPath/traverseSchema.js");
18
18
  const refFns_js_1 = require("../../helpers/refFns.js");
19
19
  const OasBase_js_1 = require("../../types/OasBase.js");
20
+ const siblings_js_1 = require("../schema/siblings.js");
20
21
  const MAX_LOOKUPS = 10;
21
22
  /**
22
23
  * Converts a ref type to its plural components path.
@@ -136,10 +137,11 @@ class OasRef extends OasBase_js_1.OasBase {
136
137
  * Creates a new OAS reference instance.
137
138
  *
138
139
  * @param fields - Reference field data including refType and $ref
139
- * @param document - Discriminated document containing the referenced
140
- * component. For OAS, refs resolve through the document's components;
141
- * for GQL, through the document's registry (GQL only ever creates
142
- * schema refs).
140
+ * @param context - The parse context, or what `clone` passes in its place:
141
+ * the discriminated document containing the referenced component (for
142
+ * OAS, refs resolve through the document's components; for GQL, through
143
+ * the document's registry, as GQL only ever creates schema refs) and the
144
+ * current trail.
143
145
  */
144
146
  constructor(fields, context) {
145
147
  super(context);
@@ -158,9 +160,257 @@ class OasRef extends OasBase_js_1.OasBase {
158
160
  writable: true,
159
161
  value: 'ref'
160
162
  });
161
- _OasRef_fields.set(this, void 0);
163
+ /** The kind of component the reference points to. */
164
+ Object.defineProperty(this, "refType", {
165
+ enumerable: true,
166
+ configurable: true,
167
+ writable: true,
168
+ value: void 0
169
+ });
170
+ /** The JSON Reference: `#/components/<bucket>/<name>`. */
171
+ Object.defineProperty(this, "$ref", {
172
+ enumerable: true,
173
+ configurable: true,
174
+ writable: true,
175
+ value: void 0
176
+ });
177
+ /**
178
+ * Use-site nullability (see {@link SiblingKeywords.nullable}). Assigned
179
+ * even when `undefined`, so `'nullable' in ref` is always true and the
180
+ * value-function nullable read picks it up uniformly.
181
+ */
182
+ Object.defineProperty(this, "nullable", {
183
+ enumerable: true,
184
+ configurable: true,
185
+ writable: true,
186
+ value: void 0
187
+ });
188
+ /** Use-site `readOnly` (see {@link SiblingKeywords.readOnly}). */
189
+ Object.defineProperty(this, "readOnly", {
190
+ enumerable: true,
191
+ configurable: true,
192
+ writable: true,
193
+ value: void 0
194
+ });
195
+ /** Use-site `writeOnly` (see {@link SiblingKeywords.writeOnly}). */
196
+ Object.defineProperty(this, "writeOnly", {
197
+ enumerable: true,
198
+ configurable: true,
199
+ writable: true,
200
+ value: void 0
201
+ });
202
+ /** The `type` written next to this reference (see {@link SiblingKeywords._type}). */
203
+ Object.defineProperty(this, "_type", {
204
+ enumerable: true,
205
+ configurable: true,
206
+ writable: true,
207
+ value: void 0
208
+ });
209
+ /** The `title` next to this reference (see {@link SiblingKeywords}). */
210
+ Object.defineProperty(this, "title", {
211
+ enumerable: true,
212
+ configurable: true,
213
+ writable: true,
214
+ value: void 0
215
+ });
216
+ /** The `description` next to this reference (see {@link SiblingKeywords}). */
217
+ Object.defineProperty(this, "description", {
218
+ enumerable: true,
219
+ configurable: true,
220
+ writable: true,
221
+ value: void 0
222
+ });
223
+ /** The `deprecated` next to this reference (see {@link SiblingKeywords}). */
224
+ Object.defineProperty(this, "deprecated", {
225
+ enumerable: true,
226
+ configurable: true,
227
+ writable: true,
228
+ value: void 0
229
+ });
230
+ /** The `example` next to this reference (see {@link SiblingKeywords}). */
231
+ Object.defineProperty(this, "example", {
232
+ enumerable: true,
233
+ configurable: true,
234
+ writable: true,
235
+ value: void 0
236
+ });
237
+ /** The `default` next to this reference (see {@link SiblingKeywords}). */
238
+ Object.defineProperty(this, "default", {
239
+ enumerable: true,
240
+ configurable: true,
241
+ writable: true,
242
+ value: void 0
243
+ });
244
+ /** The `enum` next to this reference (see {@link SiblingKeywords}). */
245
+ Object.defineProperty(this, "enums", {
246
+ enumerable: true,
247
+ configurable: true,
248
+ writable: true,
249
+ value: void 0
250
+ });
251
+ /** The extensions (`x-*`) next to this reference (see {@link SiblingKeywords}). */
252
+ Object.defineProperty(this, "extensionFields", {
253
+ enumerable: true,
254
+ configurable: true,
255
+ writable: true,
256
+ value: void 0
257
+ });
258
+ /** The `format` next to this reference (see {@link SiblingKeywords}). */
259
+ Object.defineProperty(this, "format", {
260
+ enumerable: true,
261
+ configurable: true,
262
+ writable: true,
263
+ value: void 0
264
+ });
265
+ /** The `minLength` next to this reference (see {@link SiblingKeywords}). */
266
+ Object.defineProperty(this, "minLength", {
267
+ enumerable: true,
268
+ configurable: true,
269
+ writable: true,
270
+ value: void 0
271
+ });
272
+ /** The `maxLength` next to this reference (see {@link SiblingKeywords}). */
273
+ Object.defineProperty(this, "maxLength", {
274
+ enumerable: true,
275
+ configurable: true,
276
+ writable: true,
277
+ value: void 0
278
+ });
279
+ /** The `pattern` next to this reference (see {@link SiblingKeywords}). */
280
+ Object.defineProperty(this, "pattern", {
281
+ enumerable: true,
282
+ configurable: true,
283
+ writable: true,
284
+ value: void 0
285
+ });
286
+ /** The `multipleOf` next to this reference (see {@link SiblingKeywords}). */
287
+ Object.defineProperty(this, "multipleOf", {
288
+ enumerable: true,
289
+ configurable: true,
290
+ writable: true,
291
+ value: void 0
292
+ });
293
+ /** The `minimum` next to this reference (see {@link SiblingKeywords}). */
294
+ Object.defineProperty(this, "minimum", {
295
+ enumerable: true,
296
+ configurable: true,
297
+ writable: true,
298
+ value: void 0
299
+ });
300
+ /** The `maximum` next to this reference (see {@link SiblingKeywords}). */
301
+ Object.defineProperty(this, "maximum", {
302
+ enumerable: true,
303
+ configurable: true,
304
+ writable: true,
305
+ value: void 0
306
+ });
307
+ /** The `exclusiveMinimum` next to this reference (see {@link SiblingKeywords}). */
308
+ Object.defineProperty(this, "exclusiveMinimum", {
309
+ enumerable: true,
310
+ configurable: true,
311
+ writable: true,
312
+ value: void 0
313
+ });
314
+ /** The `exclusiveMaximum` next to this reference (see {@link SiblingKeywords}). */
315
+ Object.defineProperty(this, "exclusiveMaximum", {
316
+ enumerable: true,
317
+ configurable: true,
318
+ writable: true,
319
+ value: void 0
320
+ });
321
+ /** The `minItems` next to this reference (see {@link SiblingKeywords}). */
322
+ Object.defineProperty(this, "minItems", {
323
+ enumerable: true,
324
+ configurable: true,
325
+ writable: true,
326
+ value: void 0
327
+ });
328
+ /** The `maxItems` next to this reference (see {@link SiblingKeywords}). */
329
+ Object.defineProperty(this, "maxItems", {
330
+ enumerable: true,
331
+ configurable: true,
332
+ writable: true,
333
+ value: void 0
334
+ });
335
+ /** The `uniqueItems` next to this reference (see {@link SiblingKeywords}). */
336
+ Object.defineProperty(this, "uniqueItems", {
337
+ enumerable: true,
338
+ configurable: true,
339
+ writable: true,
340
+ value: void 0
341
+ });
342
+ /** The `properties` next to this reference (see {@link SiblingKeywords}). */
343
+ Object.defineProperty(this, "properties", {
344
+ enumerable: true,
345
+ configurable: true,
346
+ writable: true,
347
+ value: void 0
348
+ });
349
+ /** The `required` next to this reference (see {@link SiblingKeywords}). */
350
+ Object.defineProperty(this, "required", {
351
+ enumerable: true,
352
+ configurable: true,
353
+ writable: true,
354
+ value: void 0
355
+ });
356
+ /** The `additionalProperties` next to this reference (see {@link SiblingKeywords}). */
357
+ Object.defineProperty(this, "additionalProperties", {
358
+ enumerable: true,
359
+ configurable: true,
360
+ writable: true,
361
+ value: void 0
362
+ });
363
+ /** The `minProperties` next to this reference (see {@link SiblingKeywords}). */
364
+ Object.defineProperty(this, "minProperties", {
365
+ enumerable: true,
366
+ configurable: true,
367
+ writable: true,
368
+ value: void 0
369
+ });
370
+ /** The `maxProperties` next to this reference (see {@link SiblingKeywords}). */
371
+ Object.defineProperty(this, "maxProperties", {
372
+ enumerable: true,
373
+ configurable: true,
374
+ writable: true,
375
+ value: void 0
376
+ });
162
377
  _OasRef_document.set(this, void 0);
163
- __classPrivateFieldSet(this, _OasRef_fields, fields, "f");
378
+ /**
379
+ * What {@link resolve} found, kept for every later call: the target, and
380
+ * the result (the target, or the copy with this reference's keywords). The
381
+ * document does not change after parse, so neither does the answer.
382
+ */
383
+ _OasRef_resolution.set(this, void 0);
384
+ this.refType = fields.refType;
385
+ this.$ref = fields.$ref;
386
+ this.nullable = fields.nullable;
387
+ this.readOnly = fields.readOnly;
388
+ this.writeOnly = fields.writeOnly;
389
+ this._type = fields._type;
390
+ this.title = fields.title;
391
+ this.description = fields.description;
392
+ this.deprecated = fields.deprecated;
393
+ this.example = fields.example;
394
+ this.default = fields.default;
395
+ this.enums = fields.enums;
396
+ this.extensionFields = fields.extensionFields;
397
+ this.format = fields.format;
398
+ this.minLength = fields.minLength;
399
+ this.maxLength = fields.maxLength;
400
+ this.pattern = fields.pattern;
401
+ this.multipleOf = fields.multipleOf;
402
+ this.minimum = fields.minimum;
403
+ this.maximum = fields.maximum;
404
+ this.exclusiveMinimum = fields.exclusiveMinimum;
405
+ this.exclusiveMaximum = fields.exclusiveMaximum;
406
+ this.minItems = fields.minItems;
407
+ this.maxItems = fields.maxItems;
408
+ this.uniqueItems = fields.uniqueItems;
409
+ this.properties = fields.properties;
410
+ this.required = fields.required;
411
+ this.additionalProperties = fields.additionalProperties;
412
+ this.minProperties = fields.minProperties;
413
+ this.maxProperties = fields.maxProperties;
164
414
  __classPrivateFieldSet(this, _OasRef_document, context.parsedDocument, "f");
165
415
  }
166
416
  /**
@@ -175,18 +425,22 @@ class OasRef extends OasBase_js_1.OasBase {
175
425
  * Recursively resolves this reference to its final target component.
176
426
  *
177
427
  * Follows reference chains until reaching a non-reference component,
178
- * with protection against infinite loops.
428
+ * with protection against infinite loops. A schema reference returns the
429
+ * schema at this site: when the keywords next to it, or next to a
430
+ * reference on the chain ({@link SiblingKeywords}), change the target, a
431
+ * copy of the target with them applied. When they change nothing, the
432
+ * shared target itself. `resolveOnce()` applies no siblings.
433
+ *
434
+ * The result is shared, so do not modify it: the shared target is the
435
+ * model every reference to it sees, and a copy is built once, kept on
436
+ * this reference, and returned on every call.
179
437
  *
180
438
  * @param lookupsPerformed - Internal counter to prevent infinite recursion
181
439
  * @returns The resolved component
182
440
  * @throws Error if maximum lookup depth is exceeded
183
441
  */
184
442
  resolve(lookupsPerformed = 0) {
185
- if (lookupsPerformed >= MAX_LOOKUPS) {
186
- throw new Error('Max lookups reached');
187
- }
188
- const resolved = this.resolveOnce();
189
- return resolved.isRef() ? resolved.resolve(lookupsPerformed + 1) : resolved;
443
+ return __classPrivateFieldGet(this, _OasRef_instances, "m", _OasRef_toResolution).call(this, lookupsPerformed).resolved;
190
444
  }
191
445
  /**
192
446
  * Resolves this reference one level. Dispatches on the document's
@@ -201,7 +455,7 @@ class OasRef extends OasBase_js_1.OasBase {
201
455
  ? __classPrivateFieldGet(this, _OasRef_instances, "m", _OasRef_resolveOasOnce).call(this, __classPrivateFieldGet(this, _OasRef_document, "f").value, refName)
202
456
  : __classPrivateFieldGet(this, _OasRef_instances, "m", _OasRef_resolveGqlOnce).call(this, __classPrivateFieldGet(this, _OasRef_document, "f").value, refName);
203
457
  if (!resolved) {
204
- throw new Error(`Ref "${__classPrivateFieldGet(this, _OasRef_fields, "f").$ref}" not found`);
458
+ throw new Error(`Ref "${this.$ref}" not found`);
205
459
  }
206
460
  if (resolved.isRef()) {
207
461
  if (resolved.refType !== this.refType) {
@@ -216,7 +470,7 @@ class OasRef extends OasBase_js_1.OasBase {
216
470
  return resolved;
217
471
  }
218
472
  toRefName() {
219
- return (0, refFns_js_1.toRefName)(__classPrivateFieldGet(this, _OasRef_fields, "f").$ref);
473
+ return (0, refFns_js_1.toRefName)(this.$ref);
220
474
  }
221
475
  /**
222
476
  * Narrows this reference to a schema reference.
@@ -245,19 +499,96 @@ class OasRef extends OasBase_js_1.OasBase {
245
499
  }
246
500
  return (0, traverseSchema_js_1.traverseSchema)(this, path);
247
501
  }
248
- get $ref() {
249
- return __classPrivateFieldGet(this, _OasRef_fields, "f").$ref;
502
+ /**
503
+ * Whether this reference adds anything at its site: a use-site flag
504
+ * (`nullable`, `readOnly`, `writeOnly`) or another keyword next to it (see
505
+ * {@link RefFields}). {@link resolve} then returns a copy of the target with
506
+ * them applied, not the shared target.
507
+ */
508
+ hasSiblings() {
509
+ return (0, siblings_js_1.hasSiblingKeywords)(this);
510
+ }
511
+ /**
512
+ * A copy of this reference with what `ref` adds at its site merged in: its
513
+ * flags, and its keywords over this reference's own
514
+ * ({@link mergeSiblingKeywords}). It points at the same target. Each schema
515
+ * class's `clone` does the same for a schema, so one step along a chain of
516
+ * references can carry a site's keywords (`resolveSchemaRefOnce`). This
517
+ * reference does not change.
518
+ */
519
+ clone(ref) {
520
+ const copy = new OasRef({ refType: this.refType, $ref: this.$ref, ...(0, siblings_js_1.mergeSiblingKeywords)(this, ref) }, { parsedDocument: __classPrivateFieldGet(this, _OasRef_document, "f"), currentStackTrail: undefined });
521
+ copy.stackTrail = this.stackTrail;
522
+ return copy;
523
+ }
524
+ /**
525
+ * Whether the keywords next to this reference change which values it
526
+ * accepts (`minLength` next to a string, `properties` next to an object),
527
+ * not only how it is described (`description`, `deprecated`, `x-*`). No
528
+ * shared model accepts the same values as such a site, so a generator
529
+ * applies these keywords where it renders the reference by name. See
530
+ * {@link changesValues}.
531
+ */
532
+ hasValueSiblings() {
533
+ if (!this.hasSiblings()) {
534
+ return false;
535
+ }
536
+ const { target, resolved } = __classPrivateFieldGet(this, _OasRef_instances, "m", _OasRef_toResolution).call(this, 0);
537
+ // Widened from the generic ResolvedRef<T>, so `oasType` narrows them.
538
+ const original = target;
539
+ const applied = resolved;
540
+ return (applied !== original &&
541
+ applied.oasType === 'schema' &&
542
+ original.oasType === 'schema' &&
543
+ (0, siblings_js_1.changesValues)(applied, original, this));
544
+ }
545
+ /**
546
+ * The keywords next to this reference that {@link resolve} leaves out, by
547
+ * their names in the document: ones the target's type does not take
548
+ * (`minLength` next to an array), a `type` that disagrees, and values that
549
+ * do not fit. The parser cannot tell them while the reference is lazy, so a
550
+ * generator logs them when it renders the site. See {@link toSkippedSiblings}.
551
+ */
552
+ toSkippedSiblings() {
553
+ if (!this.hasSiblings()) {
554
+ return [];
555
+ }
556
+ const component = this.resolve();
557
+ return component.oasType === 'schema' ? (0, siblings_js_1.toSkippedSiblings)(component, this, component.nullable) : [];
250
558
  }
251
- get refType() {
252
- return __classPrivateFieldGet(this, _OasRef_fields, "f").refType;
559
+ /**
560
+ * Whether the value is `readOnly` at this site, as Forge reads it: on this
561
+ * reference (`{ allOf: [{ $ref }], readOnly: true }`), or on what it points
562
+ * to, through any chain of references. A `readOnly: false` does not undo
563
+ * another's `true`. `false` for a reference to anything but a schema.
564
+ *
565
+ * @param lookupsPerformed - Internal counter that stops a chain of references with no schema
566
+ */
567
+ isReadOnly(lookupsPerformed = 0) {
568
+ if (this.readOnly === true) {
569
+ return true;
570
+ }
571
+ if (lookupsPerformed >= MAX_LOOKUPS) {
572
+ return false;
573
+ }
574
+ const resolved = this.resolveOnce();
575
+ return resolved.isRef() ? resolved.isReadOnly(lookupsPerformed + 1) : resolved.isReadOnly();
253
576
  }
254
577
  /**
255
- * Use-site nullability of this reference (see {@link RefFields.nullable}).
256
- * The getter exists on the prototype, so `'nullable' in ref` is always
257
- * true and the value-function nullable read picks it up uniformly.
578
+ * Whether the value is `writeOnly` at this site: on this reference, or on
579
+ * what it points to, as {@link isReadOnly} reads `readOnly`.
580
+ *
581
+ * @param lookupsPerformed - Internal counter that stops a chain of references with no schema
258
582
  */
259
- get nullable() {
260
- return __classPrivateFieldGet(this, _OasRef_fields, "f").nullable;
583
+ isWriteOnly(lookupsPerformed = 0) {
584
+ if (this.writeOnly === true) {
585
+ return true;
586
+ }
587
+ if (lookupsPerformed >= MAX_LOOKUPS) {
588
+ return false;
589
+ }
590
+ const resolved = this.resolveOnce();
591
+ return resolved.isRef() ? resolved.isWriteOnly(lookupsPerformed + 1) : resolved.isWriteOnly();
261
592
  }
262
593
  /**
263
594
  * Returns the discriminated parsed document this ref resolves
@@ -268,6 +599,12 @@ class OasRef extends OasBase_js_1.OasBase {
268
599
  get document() {
269
600
  return __classPrivateFieldGet(this, _OasRef_document, "f");
270
601
  }
602
+ /**
603
+ * The reference as JSON Schema. With `resolve`, the schema at this site,
604
+ * with the keywords next to the reference applied. Without it, only
605
+ * `{ $ref }`: the keywords next to the reference are not written yet
606
+ * (skmtc/skmtc#338).
607
+ */
271
608
  toJsonSchema({ resolve }) {
272
609
  if (resolve) {
273
610
  const resolved = this.resolve().toJsonSchema({ resolve });
@@ -278,6 +615,7 @@ class OasRef extends OasBase_js_1.OasBase {
278
615
  };
279
616
  return ref;
280
617
  }
618
+ /** `{ $ref }` only, as {@link toJsonSchema} without `resolve` (skmtc/skmtc#338). */
281
619
  toJSON() {
282
620
  return {
283
621
  $ref: `#/components/${refTypeToPluralPath(this.refType)}/${this.toRefName()}`
@@ -285,7 +623,31 @@ class OasRef extends OasBase_js_1.OasBase {
285
623
  }
286
624
  }
287
625
  exports.OasRef = OasRef;
288
- _OasRef_fields = new WeakMap(), _OasRef_document = new WeakMap(), _OasRef_instances = new WeakSet(), _OasRef_resolveOasOnce = function _OasRef_resolveOasOnce(document, refName) {
626
+ _OasRef_document = new WeakMap(), _OasRef_resolution = new WeakMap(), _OasRef_instances = new WeakSet(), _OasRef_toResolution = function _OasRef_toResolution(lookupsPerformed) {
627
+ if (__classPrivateFieldGet(this, _OasRef_resolution, "f") !== undefined) {
628
+ return __classPrivateFieldGet(this, _OasRef_resolution, "f");
629
+ }
630
+ if (lookupsPerformed >= MAX_LOOKUPS) {
631
+ throw new Error('Max lookups reached');
632
+ }
633
+ const resolved = this.resolveOnce();
634
+ const target = resolved.isRef() ? resolved.resolve(lookupsPerformed + 1) : resolved;
635
+ const resolution = { target, resolved: __classPrivateFieldGet(this, _OasRef_instances, "m", _OasRef_toSiteSchema).call(this, target) };
636
+ __classPrivateFieldSet(this, _OasRef_resolution, resolution, "f");
637
+ return resolution;
638
+ }, _OasRef_toSiteSchema = function _OasRef_toSiteSchema(target) {
639
+ // Widened from the generic ResolvedRef<T>, so `oasType` narrows it.
640
+ const component = target;
641
+ // `oasType` narrows the target and `isSchemaRef()` this reference;
642
+ // resolveOnce() has checked that the two agree.
643
+ if (!this.hasSiblings() || component.oasType !== 'schema' || !this.isSchemaRef()) {
644
+ return target;
645
+ }
646
+ const copy = component.clone(this);
647
+ // A schema's copy is a schema of the same class. TypeScript cannot relate
648
+ // OasSchema to ResolvedRef<T> for a generic T, as in resolveOnce().
649
+ return (0, siblings_js_1.changesTarget)(copy, component, this) ? copy : target;
650
+ }, _OasRef_resolveOasOnce = function _OasRef_resolveOasOnce(document, refName) {
289
651
  const c = document.components;
290
652
  const refType = this.refType;
291
653
  switch (refType) {
@@ -285,6 +285,10 @@ export declare class OasRequestBody extends OasBase {
285
285
  extensionFields: Record<string, unknown> | undefined;
286
286
  constructor(fields: RequestBodyFields, context?: ParseContextType);
287
287
  isRef(): this is OasRef<'requestBody'>;
288
+ /** Always `false`: `readOnly` is a schema keyword. */
289
+ isReadOnly(): boolean;
290
+ /** Always `false`: `writeOnly` is a schema keyword. */
291
+ isWriteOnly(): boolean;
288
292
  resolve(): OasRequestBody;
289
293
  resolveOnce(): OasRequestBody;
290
294
  /**
@@ -303,6 +303,14 @@ class OasRequestBody extends OasBase_js_1.OasBase {
303
303
  isRef() {
304
304
  return false;
305
305
  }
306
+ /** Always `false`: `readOnly` is a schema keyword. */
307
+ isReadOnly() {
308
+ return false;
309
+ }
310
+ /** Always `false`: `writeOnly` is a schema keyword. */
311
+ isWriteOnly() {
312
+ return false;
313
+ }
306
314
  resolve() {
307
315
  return this;
308
316
  }
@@ -219,6 +219,10 @@ export declare class OasResponse extends OasBase {
219
219
  extensionFields: Record<string, unknown> | undefined;
220
220
  constructor(fields: ResponseFields, context?: ParseContextType);
221
221
  isRef(): this is OasRef<'response'>;
222
+ /** Always `false`: `readOnly` is a schema keyword. */
223
+ isReadOnly(): boolean;
224
+ /** Always `false`: `writeOnly` is a schema keyword. */
225
+ isWriteOnly(): boolean;
222
226
  resolve(): OasResponse;
223
227
  resolveOnce(): OasResponse;
224
228
  /**
@@ -243,6 +243,14 @@ class OasResponse extends OasBase_js_1.OasBase {
243
243
  isRef() {
244
244
  return false;
245
245
  }
246
+ /** Always `false`: `readOnly` is a schema keyword. */
247
+ isReadOnly() {
248
+ return false;
249
+ }
250
+ /** Always `false`: `writeOnly` is a schema keyword. */
251
+ isWriteOnly() {
252
+ return false;
253
+ }
246
254
  resolve() {
247
255
  return this;
248
256
  }
@@ -0,0 +1,127 @@
1
+ import type { OasSchema } from './Schema.js';
2
+ import type { OasRef } from '../ref/Ref.js';
3
+ /**
4
+ * The keywords next to a reference in a one-member `allOf`
5
+ * (`{ allOf: [{ $ref }], minLength: 3, description: '…' }`), the use-site
6
+ * flags `nullable`, `readOnly` and `writeOnly` among them: the fields a
7
+ * reference adds at its site (`RefFields`).
8
+ *
9
+ * The parser reads them without knowing the target's type: the reference
10
+ * stays lazy. Each schema class's `clone(ref)` takes the keywords its type
11
+ * has ({@link SIBLINGS_BY_TYPE}). A value whose type depends on the target
12
+ * (`example`, `default`, `enums`, `format`) is kept as written, and `clone`
13
+ * takes it only when it fits. {@link toSkippedSiblings} names the keywords
14
+ * `clone` leaves out, for a generator to log.
15
+ */
16
+ export type SiblingKeywords = {
17
+ /**
18
+ * Use-site nullability. A `$ref` is a per-reference node: the same
19
+ * refName may be referenced nullable at one site and non-nullable at
20
+ * another, so nullability rides the reference, not the shared referent.
21
+ * Set by the single-member `oneOf`/`anyOf` collapse for the 3.1
22
+ * `oneOf:[{$ref},{type:null}]` idiom, and next to a one-member `allOf`.
23
+ * Generators read it off the reference (`'nullable' in schema ?
24
+ * schema.nullable`) to render `Foo | null`, while `ModelDriver` builds the
25
+ * un-nullable shared model from the refName.
26
+ */
27
+ nullable?: boolean;
28
+ /**
29
+ * Use-site `readOnly`: set where a property marks a reference read-only,
30
+ * `{ allOf: [{ $ref }], readOnly: true }` (the 3.0 idiom, as keywords next
31
+ * to a bare `$ref` are ignored there). Like `nullable`, it rides the
32
+ * reference: the shared model is not read-only everywhere. Read it through
33
+ * `isReadOnly`, which also looks at what the reference points to.
34
+ */
35
+ readOnly?: boolean;
36
+ /** Use-site `writeOnly`, as {@link readOnly}. */
37
+ writeOnly?: boolean;
38
+ /**
39
+ * The `type` written next to the reference, merged in from the schema that
40
+ * holds the one-member `allOf`. It must agree with the target's; the copy
41
+ * always has the target's type. Not `type`, which on an `OasRef` is `'ref'`.
42
+ */
43
+ _type?: unknown;
44
+ title?: string;
45
+ description?: string;
46
+ deprecated?: boolean;
47
+ example?: unknown;
48
+ default?: unknown;
49
+ enums?: unknown[];
50
+ extensionFields?: Record<string, unknown>;
51
+ format?: string;
52
+ minLength?: number;
53
+ maxLength?: number;
54
+ pattern?: string;
55
+ multipleOf?: number;
56
+ minimum?: number;
57
+ maximum?: number;
58
+ exclusiveMinimum?: boolean;
59
+ exclusiveMaximum?: boolean;
60
+ minItems?: number;
61
+ maxItems?: number;
62
+ uniqueItems?: boolean;
63
+ properties?: Record<string, OasSchema | OasRef<'schema'>>;
64
+ required?: string[];
65
+ additionalProperties?: boolean | OasSchema | OasRef<'schema'>;
66
+ minProperties?: number;
67
+ maxProperties?: number;
68
+ };
69
+ /** A keyword `clone` can apply. `_type` only has to agree. */
70
+ export type SiblingKeyword = Exclude<keyof SiblingKeywords, '_type'>;
71
+ /** The keywords each schema class's `clone` takes: the fields its type has. */
72
+ export declare const SIBLINGS_BY_TYPE: Record<OasSchema['type'], SiblingKeyword[]>;
73
+ /**
74
+ * The keywords of `over` merged over those of `base`, for a reference copied
75
+ * with what another site adds (`OasRef.clone`): a flag set on either stays
76
+ * set, a keyword `over` sets wins, extension fields and `properties` merge,
77
+ * and `required` names add up, as each schema class's `clone` merges them
78
+ * into a schema.
79
+ */
80
+ export declare const mergeSiblingKeywords: (base: SiblingKeywords, over: SiblingKeywords | undefined) => SiblingKeywords;
81
+ /** Whether `siblings` holds any keyword. */
82
+ export declare const hasSiblingKeywords: (siblings: SiblingKeywords) => boolean;
83
+ /** Whether the keywords next to a reference change `target` at that site. The engine behind `OasRef.resolve`. */
84
+ export declare const changesTarget: (copy: OasSchema, target: OasSchema, siblings: SiblingKeywords) => boolean;
85
+ /**
86
+ * Whether the keywords next to a reference change which values `target`
87
+ * accepts at that site (`minLength` next to a string, `properties` next to an
88
+ * object), not only how it is described (`description`, `deprecated`,
89
+ * `default`, `x-*`). The engine behind `OasRef.hasValueSiblings`.
90
+ */
91
+ export declare const changesValues: (copy: OasSchema, target: OasSchema, siblings: SiblingKeywords) => boolean;
92
+ /**
93
+ * The keywords next to a reference that `clone` leaves out for `target`, by
94
+ * their names in the document: one its type does not have (`minLength` next
95
+ * to an array), a `type` that disagrees with the target's, and an `example`,
96
+ * `default`, `enum` or `format` whose value does not fit. `nullable` says
97
+ * whether the site takes `null` among the `enum` members. The engine behind
98
+ * `OasRef.toSkippedSiblings`.
99
+ */
100
+ export declare const toSkippedSiblings: (target: OasSchema, siblings: SiblingKeywords, nullable: boolean | undefined) => string[];
101
+ /** The annotations of `target` with those of `siblings` applied: a sibling's value wins, and extension fields merge. */
102
+ export declare const toSiblingAnnotations: (target: OasSchema, siblings: SiblingKeywords | undefined) => {
103
+ title: string | undefined;
104
+ description: string | undefined;
105
+ extensionFields: {
106
+ [x: string]: unknown;
107
+ } | undefined;
108
+ };
109
+ /** The value checks the parser makes for `example`, `default` and each `enum` member, by type. */
110
+ export declare const isStringValue: (value: unknown) => value is string;
111
+ export declare const isNumberValue: (value: unknown) => value is number;
112
+ export declare const isIntegerValue: (value: unknown) => value is number;
113
+ export declare const isBooleanValue: (value: unknown) => value is boolean;
114
+ export declare const isArrayValue: (value: unknown) => value is unknown[];
115
+ export declare const isObjectValue: (value: unknown) => value is Record<string, unknown>;
116
+ /** {@link isStringValue} and the others, keyed by the type they check for. A union or unknown takes any value. */
117
+ export declare const VALUE_CHECKS: Record<OasSchema['type'], (value: unknown) => boolean>;
118
+ /** The formats a number and an integer take. A string takes any format. */
119
+ export declare const isNumberFormat: (value: unknown) => value is "float" | "double";
120
+ export declare const isIntegerFormat: (value: unknown) => value is "int32" | "int64";
121
+ /** `value` when it passes `check`, else `undefined`: for `example`, `default` and `format`. */
122
+ export declare const toSiblingValue: <T>(value: unknown, check: (value: unknown) => value is T) => T | undefined;
123
+ /**
124
+ * `enums` when every member passes `check`, or is `null` at a nullable site,
125
+ * else `undefined`. The parser reports the members that do not.
126
+ */
127
+ export declare const toSiblingEnums: <T>(enums: unknown[] | undefined, check: (value: unknown) => value is T, nullable: boolean | undefined) => (T | null)[] | undefined;