@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
@@ -9,11 +9,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
9
9
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
- var _OasRef_instances, _OasRef_fields, _OasRef_document, _OasRef_resolveOasOnce, _OasRef_resolveGqlOnce;
12
+ var _OasRef_instances, _OasRef_document, _OasRef_resolution, _OasRef_toResolution, _OasRef_toSiteSchema, _OasRef_resolveOasOnce, _OasRef_resolveGqlOnce;
13
13
  import "../../_dnt.polyfills.js";
14
14
  import { traverseSchema } from '../schemaPath/traverseSchema.js';
15
15
  import { toRefName } from '../../helpers/refFns.js';
16
16
  import { OasBase } from '../../types/OasBase.js';
17
+ import { changesTarget, changesValues, hasSiblingKeywords, mergeSiblingKeywords, toSkippedSiblings } from '../schema/siblings.js';
17
18
  const MAX_LOOKUPS = 10;
18
19
  /**
19
20
  * Converts a ref type to its plural components path.
@@ -133,10 +134,11 @@ export class OasRef extends OasBase {
133
134
  * Creates a new OAS reference instance.
134
135
  *
135
136
  * @param fields - Reference field data including refType and $ref
136
- * @param document - Discriminated document containing the referenced
137
- * component. For OAS, refs resolve through the document's components;
138
- * for GQL, through the document's registry (GQL only ever creates
139
- * schema refs).
137
+ * @param context - The parse context, or what `clone` passes in its place:
138
+ * the discriminated document containing the referenced component (for
139
+ * OAS, refs resolve through the document's components; for GQL, through
140
+ * the document's registry, as GQL only ever creates schema refs) and the
141
+ * current trail.
140
142
  */
141
143
  constructor(fields, context) {
142
144
  super(context);
@@ -155,9 +157,257 @@ export class OasRef extends OasBase {
155
157
  writable: true,
156
158
  value: 'ref'
157
159
  });
158
- _OasRef_fields.set(this, void 0);
160
+ /** The kind of component the reference points to. */
161
+ Object.defineProperty(this, "refType", {
162
+ enumerable: true,
163
+ configurable: true,
164
+ writable: true,
165
+ value: void 0
166
+ });
167
+ /** The JSON Reference: `#/components/<bucket>/<name>`. */
168
+ Object.defineProperty(this, "$ref", {
169
+ enumerable: true,
170
+ configurable: true,
171
+ writable: true,
172
+ value: void 0
173
+ });
174
+ /**
175
+ * Use-site nullability (see {@link SiblingKeywords.nullable}). Assigned
176
+ * even when `undefined`, so `'nullable' in ref` is always true and the
177
+ * value-function nullable read picks it up uniformly.
178
+ */
179
+ Object.defineProperty(this, "nullable", {
180
+ enumerable: true,
181
+ configurable: true,
182
+ writable: true,
183
+ value: void 0
184
+ });
185
+ /** Use-site `readOnly` (see {@link SiblingKeywords.readOnly}). */
186
+ Object.defineProperty(this, "readOnly", {
187
+ enumerable: true,
188
+ configurable: true,
189
+ writable: true,
190
+ value: void 0
191
+ });
192
+ /** Use-site `writeOnly` (see {@link SiblingKeywords.writeOnly}). */
193
+ Object.defineProperty(this, "writeOnly", {
194
+ enumerable: true,
195
+ configurable: true,
196
+ writable: true,
197
+ value: void 0
198
+ });
199
+ /** The `type` written next to this reference (see {@link SiblingKeywords._type}). */
200
+ Object.defineProperty(this, "_type", {
201
+ enumerable: true,
202
+ configurable: true,
203
+ writable: true,
204
+ value: void 0
205
+ });
206
+ /** The `title` next to this reference (see {@link SiblingKeywords}). */
207
+ Object.defineProperty(this, "title", {
208
+ enumerable: true,
209
+ configurable: true,
210
+ writable: true,
211
+ value: void 0
212
+ });
213
+ /** The `description` next to this reference (see {@link SiblingKeywords}). */
214
+ Object.defineProperty(this, "description", {
215
+ enumerable: true,
216
+ configurable: true,
217
+ writable: true,
218
+ value: void 0
219
+ });
220
+ /** The `deprecated` next to this reference (see {@link SiblingKeywords}). */
221
+ Object.defineProperty(this, "deprecated", {
222
+ enumerable: true,
223
+ configurable: true,
224
+ writable: true,
225
+ value: void 0
226
+ });
227
+ /** The `example` next to this reference (see {@link SiblingKeywords}). */
228
+ Object.defineProperty(this, "example", {
229
+ enumerable: true,
230
+ configurable: true,
231
+ writable: true,
232
+ value: void 0
233
+ });
234
+ /** The `default` next to this reference (see {@link SiblingKeywords}). */
235
+ Object.defineProperty(this, "default", {
236
+ enumerable: true,
237
+ configurable: true,
238
+ writable: true,
239
+ value: void 0
240
+ });
241
+ /** The `enum` next to this reference (see {@link SiblingKeywords}). */
242
+ Object.defineProperty(this, "enums", {
243
+ enumerable: true,
244
+ configurable: true,
245
+ writable: true,
246
+ value: void 0
247
+ });
248
+ /** The extensions (`x-*`) next to this reference (see {@link SiblingKeywords}). */
249
+ Object.defineProperty(this, "extensionFields", {
250
+ enumerable: true,
251
+ configurable: true,
252
+ writable: true,
253
+ value: void 0
254
+ });
255
+ /** The `format` next to this reference (see {@link SiblingKeywords}). */
256
+ Object.defineProperty(this, "format", {
257
+ enumerable: true,
258
+ configurable: true,
259
+ writable: true,
260
+ value: void 0
261
+ });
262
+ /** The `minLength` next to this reference (see {@link SiblingKeywords}). */
263
+ Object.defineProperty(this, "minLength", {
264
+ enumerable: true,
265
+ configurable: true,
266
+ writable: true,
267
+ value: void 0
268
+ });
269
+ /** The `maxLength` next to this reference (see {@link SiblingKeywords}). */
270
+ Object.defineProperty(this, "maxLength", {
271
+ enumerable: true,
272
+ configurable: true,
273
+ writable: true,
274
+ value: void 0
275
+ });
276
+ /** The `pattern` next to this reference (see {@link SiblingKeywords}). */
277
+ Object.defineProperty(this, "pattern", {
278
+ enumerable: true,
279
+ configurable: true,
280
+ writable: true,
281
+ value: void 0
282
+ });
283
+ /** The `multipleOf` next to this reference (see {@link SiblingKeywords}). */
284
+ Object.defineProperty(this, "multipleOf", {
285
+ enumerable: true,
286
+ configurable: true,
287
+ writable: true,
288
+ value: void 0
289
+ });
290
+ /** The `minimum` next to this reference (see {@link SiblingKeywords}). */
291
+ Object.defineProperty(this, "minimum", {
292
+ enumerable: true,
293
+ configurable: true,
294
+ writable: true,
295
+ value: void 0
296
+ });
297
+ /** The `maximum` next to this reference (see {@link SiblingKeywords}). */
298
+ Object.defineProperty(this, "maximum", {
299
+ enumerable: true,
300
+ configurable: true,
301
+ writable: true,
302
+ value: void 0
303
+ });
304
+ /** The `exclusiveMinimum` next to this reference (see {@link SiblingKeywords}). */
305
+ Object.defineProperty(this, "exclusiveMinimum", {
306
+ enumerable: true,
307
+ configurable: true,
308
+ writable: true,
309
+ value: void 0
310
+ });
311
+ /** The `exclusiveMaximum` next to this reference (see {@link SiblingKeywords}). */
312
+ Object.defineProperty(this, "exclusiveMaximum", {
313
+ enumerable: true,
314
+ configurable: true,
315
+ writable: true,
316
+ value: void 0
317
+ });
318
+ /** The `minItems` next to this reference (see {@link SiblingKeywords}). */
319
+ Object.defineProperty(this, "minItems", {
320
+ enumerable: true,
321
+ configurable: true,
322
+ writable: true,
323
+ value: void 0
324
+ });
325
+ /** The `maxItems` next to this reference (see {@link SiblingKeywords}). */
326
+ Object.defineProperty(this, "maxItems", {
327
+ enumerable: true,
328
+ configurable: true,
329
+ writable: true,
330
+ value: void 0
331
+ });
332
+ /** The `uniqueItems` next to this reference (see {@link SiblingKeywords}). */
333
+ Object.defineProperty(this, "uniqueItems", {
334
+ enumerable: true,
335
+ configurable: true,
336
+ writable: true,
337
+ value: void 0
338
+ });
339
+ /** The `properties` next to this reference (see {@link SiblingKeywords}). */
340
+ Object.defineProperty(this, "properties", {
341
+ enumerable: true,
342
+ configurable: true,
343
+ writable: true,
344
+ value: void 0
345
+ });
346
+ /** The `required` next to this reference (see {@link SiblingKeywords}). */
347
+ Object.defineProperty(this, "required", {
348
+ enumerable: true,
349
+ configurable: true,
350
+ writable: true,
351
+ value: void 0
352
+ });
353
+ /** The `additionalProperties` next to this reference (see {@link SiblingKeywords}). */
354
+ Object.defineProperty(this, "additionalProperties", {
355
+ enumerable: true,
356
+ configurable: true,
357
+ writable: true,
358
+ value: void 0
359
+ });
360
+ /** The `minProperties` next to this reference (see {@link SiblingKeywords}). */
361
+ Object.defineProperty(this, "minProperties", {
362
+ enumerable: true,
363
+ configurable: true,
364
+ writable: true,
365
+ value: void 0
366
+ });
367
+ /** The `maxProperties` next to this reference (see {@link SiblingKeywords}). */
368
+ Object.defineProperty(this, "maxProperties", {
369
+ enumerable: true,
370
+ configurable: true,
371
+ writable: true,
372
+ value: void 0
373
+ });
159
374
  _OasRef_document.set(this, void 0);
160
- __classPrivateFieldSet(this, _OasRef_fields, fields, "f");
375
+ /**
376
+ * What {@link resolve} found, kept for every later call: the target, and
377
+ * the result (the target, or the copy with this reference's keywords). The
378
+ * document does not change after parse, so neither does the answer.
379
+ */
380
+ _OasRef_resolution.set(this, void 0);
381
+ this.refType = fields.refType;
382
+ this.$ref = fields.$ref;
383
+ this.nullable = fields.nullable;
384
+ this.readOnly = fields.readOnly;
385
+ this.writeOnly = fields.writeOnly;
386
+ this._type = fields._type;
387
+ this.title = fields.title;
388
+ this.description = fields.description;
389
+ this.deprecated = fields.deprecated;
390
+ this.example = fields.example;
391
+ this.default = fields.default;
392
+ this.enums = fields.enums;
393
+ this.extensionFields = fields.extensionFields;
394
+ this.format = fields.format;
395
+ this.minLength = fields.minLength;
396
+ this.maxLength = fields.maxLength;
397
+ this.pattern = fields.pattern;
398
+ this.multipleOf = fields.multipleOf;
399
+ this.minimum = fields.minimum;
400
+ this.maximum = fields.maximum;
401
+ this.exclusiveMinimum = fields.exclusiveMinimum;
402
+ this.exclusiveMaximum = fields.exclusiveMaximum;
403
+ this.minItems = fields.minItems;
404
+ this.maxItems = fields.maxItems;
405
+ this.uniqueItems = fields.uniqueItems;
406
+ this.properties = fields.properties;
407
+ this.required = fields.required;
408
+ this.additionalProperties = fields.additionalProperties;
409
+ this.minProperties = fields.minProperties;
410
+ this.maxProperties = fields.maxProperties;
161
411
  __classPrivateFieldSet(this, _OasRef_document, context.parsedDocument, "f");
162
412
  }
163
413
  /**
@@ -172,18 +422,22 @@ export class OasRef extends OasBase {
172
422
  * Recursively resolves this reference to its final target component.
173
423
  *
174
424
  * Follows reference chains until reaching a non-reference component,
175
- * with protection against infinite loops.
425
+ * with protection against infinite loops. A schema reference returns the
426
+ * schema at this site: when the keywords next to it, or next to a
427
+ * reference on the chain ({@link SiblingKeywords}), change the target, a
428
+ * copy of the target with them applied. When they change nothing, the
429
+ * shared target itself. `resolveOnce()` applies no siblings.
430
+ *
431
+ * The result is shared, so do not modify it: the shared target is the
432
+ * model every reference to it sees, and a copy is built once, kept on
433
+ * this reference, and returned on every call.
176
434
  *
177
435
  * @param lookupsPerformed - Internal counter to prevent infinite recursion
178
436
  * @returns The resolved component
179
437
  * @throws Error if maximum lookup depth is exceeded
180
438
  */
181
439
  resolve(lookupsPerformed = 0) {
182
- if (lookupsPerformed >= MAX_LOOKUPS) {
183
- throw new Error('Max lookups reached');
184
- }
185
- const resolved = this.resolveOnce();
186
- return resolved.isRef() ? resolved.resolve(lookupsPerformed + 1) : resolved;
440
+ return __classPrivateFieldGet(this, _OasRef_instances, "m", _OasRef_toResolution).call(this, lookupsPerformed).resolved;
187
441
  }
188
442
  /**
189
443
  * Resolves this reference one level. Dispatches on the document's
@@ -198,7 +452,7 @@ export class OasRef extends OasBase {
198
452
  ? __classPrivateFieldGet(this, _OasRef_instances, "m", _OasRef_resolveOasOnce).call(this, __classPrivateFieldGet(this, _OasRef_document, "f").value, refName)
199
453
  : __classPrivateFieldGet(this, _OasRef_instances, "m", _OasRef_resolveGqlOnce).call(this, __classPrivateFieldGet(this, _OasRef_document, "f").value, refName);
200
454
  if (!resolved) {
201
- throw new Error(`Ref "${__classPrivateFieldGet(this, _OasRef_fields, "f").$ref}" not found`);
455
+ throw new Error(`Ref "${this.$ref}" not found`);
202
456
  }
203
457
  if (resolved.isRef()) {
204
458
  if (resolved.refType !== this.refType) {
@@ -213,7 +467,7 @@ export class OasRef extends OasBase {
213
467
  return resolved;
214
468
  }
215
469
  toRefName() {
216
- return toRefName(__classPrivateFieldGet(this, _OasRef_fields, "f").$ref);
470
+ return toRefName(this.$ref);
217
471
  }
218
472
  /**
219
473
  * Narrows this reference to a schema reference.
@@ -242,19 +496,96 @@ export class OasRef extends OasBase {
242
496
  }
243
497
  return traverseSchema(this, path);
244
498
  }
245
- get $ref() {
246
- return __classPrivateFieldGet(this, _OasRef_fields, "f").$ref;
499
+ /**
500
+ * Whether this reference adds anything at its site: a use-site flag
501
+ * (`nullable`, `readOnly`, `writeOnly`) or another keyword next to it (see
502
+ * {@link RefFields}). {@link resolve} then returns a copy of the target with
503
+ * them applied, not the shared target.
504
+ */
505
+ hasSiblings() {
506
+ return hasSiblingKeywords(this);
507
+ }
508
+ /**
509
+ * A copy of this reference with what `ref` adds at its site merged in: its
510
+ * flags, and its keywords over this reference's own
511
+ * ({@link mergeSiblingKeywords}). It points at the same target. Each schema
512
+ * class's `clone` does the same for a schema, so one step along a chain of
513
+ * references can carry a site's keywords (`resolveSchemaRefOnce`). This
514
+ * reference does not change.
515
+ */
516
+ clone(ref) {
517
+ const copy = new OasRef({ refType: this.refType, $ref: this.$ref, ...mergeSiblingKeywords(this, ref) }, { parsedDocument: __classPrivateFieldGet(this, _OasRef_document, "f"), currentStackTrail: undefined });
518
+ copy.stackTrail = this.stackTrail;
519
+ return copy;
520
+ }
521
+ /**
522
+ * Whether the keywords next to this reference change which values it
523
+ * accepts (`minLength` next to a string, `properties` next to an object),
524
+ * not only how it is described (`description`, `deprecated`, `x-*`). No
525
+ * shared model accepts the same values as such a site, so a generator
526
+ * applies these keywords where it renders the reference by name. See
527
+ * {@link changesValues}.
528
+ */
529
+ hasValueSiblings() {
530
+ if (!this.hasSiblings()) {
531
+ return false;
532
+ }
533
+ const { target, resolved } = __classPrivateFieldGet(this, _OasRef_instances, "m", _OasRef_toResolution).call(this, 0);
534
+ // Widened from the generic ResolvedRef<T>, so `oasType` narrows them.
535
+ const original = target;
536
+ const applied = resolved;
537
+ return (applied !== original &&
538
+ applied.oasType === 'schema' &&
539
+ original.oasType === 'schema' &&
540
+ changesValues(applied, original, this));
541
+ }
542
+ /**
543
+ * The keywords next to this reference that {@link resolve} leaves out, by
544
+ * their names in the document: ones the target's type does not take
545
+ * (`minLength` next to an array), a `type` that disagrees, and values that
546
+ * do not fit. The parser cannot tell them while the reference is lazy, so a
547
+ * generator logs them when it renders the site. See {@link toSkippedSiblings}.
548
+ */
549
+ toSkippedSiblings() {
550
+ if (!this.hasSiblings()) {
551
+ return [];
552
+ }
553
+ const component = this.resolve();
554
+ return component.oasType === 'schema' ? toSkippedSiblings(component, this, component.nullable) : [];
247
555
  }
248
- get refType() {
249
- return __classPrivateFieldGet(this, _OasRef_fields, "f").refType;
556
+ /**
557
+ * Whether the value is `readOnly` at this site, as Forge reads it: on this
558
+ * reference (`{ allOf: [{ $ref }], readOnly: true }`), or on what it points
559
+ * to, through any chain of references. A `readOnly: false` does not undo
560
+ * another's `true`. `false` for a reference to anything but a schema.
561
+ *
562
+ * @param lookupsPerformed - Internal counter that stops a chain of references with no schema
563
+ */
564
+ isReadOnly(lookupsPerformed = 0) {
565
+ if (this.readOnly === true) {
566
+ return true;
567
+ }
568
+ if (lookupsPerformed >= MAX_LOOKUPS) {
569
+ return false;
570
+ }
571
+ const resolved = this.resolveOnce();
572
+ return resolved.isRef() ? resolved.isReadOnly(lookupsPerformed + 1) : resolved.isReadOnly();
250
573
  }
251
574
  /**
252
- * Use-site nullability of this reference (see {@link RefFields.nullable}).
253
- * The getter exists on the prototype, so `'nullable' in ref` is always
254
- * true and the value-function nullable read picks it up uniformly.
575
+ * Whether the value is `writeOnly` at this site: on this reference, or on
576
+ * what it points to, as {@link isReadOnly} reads `readOnly`.
577
+ *
578
+ * @param lookupsPerformed - Internal counter that stops a chain of references with no schema
255
579
  */
256
- get nullable() {
257
- return __classPrivateFieldGet(this, _OasRef_fields, "f").nullable;
580
+ isWriteOnly(lookupsPerformed = 0) {
581
+ if (this.writeOnly === true) {
582
+ return true;
583
+ }
584
+ if (lookupsPerformed >= MAX_LOOKUPS) {
585
+ return false;
586
+ }
587
+ const resolved = this.resolveOnce();
588
+ return resolved.isRef() ? resolved.isWriteOnly(lookupsPerformed + 1) : resolved.isWriteOnly();
258
589
  }
259
590
  /**
260
591
  * Returns the discriminated parsed document this ref resolves
@@ -265,6 +596,12 @@ export class OasRef extends OasBase {
265
596
  get document() {
266
597
  return __classPrivateFieldGet(this, _OasRef_document, "f");
267
598
  }
599
+ /**
600
+ * The reference as JSON Schema. With `resolve`, the schema at this site,
601
+ * with the keywords next to the reference applied. Without it, only
602
+ * `{ $ref }`: the keywords next to the reference are not written yet
603
+ * (skmtc/skmtc#338).
604
+ */
268
605
  toJsonSchema({ resolve }) {
269
606
  if (resolve) {
270
607
  const resolved = this.resolve().toJsonSchema({ resolve });
@@ -275,13 +612,38 @@ export class OasRef extends OasBase {
275
612
  };
276
613
  return ref;
277
614
  }
615
+ /** `{ $ref }` only, as {@link toJsonSchema} without `resolve` (skmtc/skmtc#338). */
278
616
  toJSON() {
279
617
  return {
280
618
  $ref: `#/components/${refTypeToPluralPath(this.refType)}/${this.toRefName()}`
281
619
  };
282
620
  }
283
621
  }
284
- _OasRef_fields = new WeakMap(), _OasRef_document = new WeakMap(), _OasRef_instances = new WeakSet(), _OasRef_resolveOasOnce = function _OasRef_resolveOasOnce(document, refName) {
622
+ _OasRef_document = new WeakMap(), _OasRef_resolution = new WeakMap(), _OasRef_instances = new WeakSet(), _OasRef_toResolution = function _OasRef_toResolution(lookupsPerformed) {
623
+ if (__classPrivateFieldGet(this, _OasRef_resolution, "f") !== undefined) {
624
+ return __classPrivateFieldGet(this, _OasRef_resolution, "f");
625
+ }
626
+ if (lookupsPerformed >= MAX_LOOKUPS) {
627
+ throw new Error('Max lookups reached');
628
+ }
629
+ const resolved = this.resolveOnce();
630
+ const target = resolved.isRef() ? resolved.resolve(lookupsPerformed + 1) : resolved;
631
+ const resolution = { target, resolved: __classPrivateFieldGet(this, _OasRef_instances, "m", _OasRef_toSiteSchema).call(this, target) };
632
+ __classPrivateFieldSet(this, _OasRef_resolution, resolution, "f");
633
+ return resolution;
634
+ }, _OasRef_toSiteSchema = function _OasRef_toSiteSchema(target) {
635
+ // Widened from the generic ResolvedRef<T>, so `oasType` narrows it.
636
+ const component = target;
637
+ // `oasType` narrows the target and `isSchemaRef()` this reference;
638
+ // resolveOnce() has checked that the two agree.
639
+ if (!this.hasSiblings() || component.oasType !== 'schema' || !this.isSchemaRef()) {
640
+ return target;
641
+ }
642
+ const copy = component.clone(this);
643
+ // A schema's copy is a schema of the same class. TypeScript cannot relate
644
+ // OasSchema to ResolvedRef<T> for a generic T, as in resolveOnce().
645
+ return changesTarget(copy, component, this) ? copy : target;
646
+ }, _OasRef_resolveOasOnce = function _OasRef_resolveOasOnce(document, refName) {
285
647
  const c = document.components;
286
648
  const refType = this.refType;
287
649
  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
  /**
@@ -300,6 +300,14 @@ export class OasRequestBody extends OasBase {
300
300
  isRef() {
301
301
  return false;
302
302
  }
303
+ /** Always `false`: `readOnly` is a schema keyword. */
304
+ isReadOnly() {
305
+ return false;
306
+ }
307
+ /** Always `false`: `writeOnly` is a schema keyword. */
308
+ isWriteOnly() {
309
+ return false;
310
+ }
303
311
  resolve() {
304
312
  return this;
305
313
  }
@@ -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
  /**
@@ -240,6 +240,14 @@ export class OasResponse extends OasBase {
240
240
  isRef() {
241
241
  return false;
242
242
  }
243
+ /** Always `false`: `readOnly` is a schema keyword. */
244
+ isReadOnly() {
245
+ return false;
246
+ }
247
+ /** Always `false`: `writeOnly` is a schema keyword. */
248
+ isWriteOnly() {
249
+ return false;
250
+ }
243
251
  resolve() {
244
252
  return this;
245
253
  }
@@ -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;