@skmtc/core 0.39.0 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (373) hide show
  1. package/esm/context/CoreContext.js +22 -8
  2. package/esm/context/GenerateContext.d.ts +6 -5
  3. package/esm/context/GenerateContext.js +112 -38
  4. package/esm/context/ParseContext.d.ts +18 -1
  5. package/esm/context/ParseContext.js +102 -3
  6. package/esm/context/generateTypes.d.ts +33 -4
  7. package/esm/context/generateTypes.js +4 -0
  8. package/esm/context/toGenerationFailure.d.ts +21 -0
  9. package/esm/context/toGenerationFailure.js +38 -0
  10. package/esm/context/tryParseAt.d.ts +4 -1
  11. package/esm/context/tryParseAt.js +10 -3
  12. package/esm/dsl/CustomValue.d.ts +4 -0
  13. package/esm/dsl/CustomValue.js +8 -0
  14. package/esm/dsl/Definition.d.ts +10 -0
  15. package/esm/dsl/Definition.js +14 -0
  16. package/esm/dsl/PendingDefinition.d.ts +47 -0
  17. package/esm/dsl/PendingDefinition.js +83 -0
  18. package/esm/dsl/model/ModelDriver.d.ts +55 -1
  19. package/esm/dsl/model/ModelDriver.js +228 -51
  20. package/esm/dsl/model/toModelEntry.d.ts +1 -1
  21. package/esm/dsl/model/toModelEntry.js +1 -1
  22. package/esm/dsl/model/types.d.ts +1 -1
  23. package/esm/dsl/operation/gql/GqlOperationDriver.js +1 -4
  24. package/esm/dsl/webhook/WebhookDriver.js +1 -4
  25. package/esm/enrichments/parseEnrichmentUmbrella.d.ts +5 -6
  26. package/esm/enrichments/parseEnrichmentUmbrella.js +23 -8
  27. package/esm/enrichments/parseEnrichmentValue.d.ts +17 -0
  28. package/esm/enrichments/parseEnrichmentValue.js +32 -0
  29. package/esm/enrichments/readEnrichments.d.ts +5 -5
  30. package/esm/enrichments/readEnrichments.js +17 -7
  31. package/esm/helpers/collateExamples.js +15 -5
  32. package/esm/helpers/refFns.d.ts +6 -2
  33. package/esm/helpers/refFns.js +24 -7
  34. package/esm/mod.d.ts +2 -0
  35. package/esm/mod.js +2 -0
  36. package/esm/oas/array/Array.d.ts +19 -0
  37. package/esm/oas/array/Array.js +47 -0
  38. package/esm/oas/boolean/Boolean.d.ts +19 -0
  39. package/esm/oas/boolean/Boolean.js +51 -8
  40. package/esm/oas/example/Example.d.ts +4 -0
  41. package/esm/oas/example/Example.js +8 -0
  42. package/esm/oas/header/Header.d.ts +4 -0
  43. package/esm/oas/header/Header.js +8 -0
  44. package/esm/oas/integer/Integer.d.ts +19 -0
  45. package/esm/oas/integer/Integer.js +49 -0
  46. package/esm/oas/link/Link.d.ts +4 -0
  47. package/esm/oas/link/Link.js +8 -0
  48. package/esm/oas/number/Number.d.ts +19 -0
  49. package/esm/oas/number/Number.js +49 -0
  50. package/esm/oas/object/Object.d.ts +19 -0
  51. package/esm/oas/object/Object.js +68 -18
  52. package/esm/oas/operation/Operation.d.ts +8 -1
  53. package/esm/oas/operation/Operation.js +18 -5
  54. package/esm/oas/operation/toEffectiveParameters.d.ts +24 -0
  55. package/esm/oas/operation/toEffectiveParameters.js +42 -0
  56. package/esm/oas/parameter/Parameter.d.ts +4 -0
  57. package/esm/oas/parameter/Parameter.js +8 -0
  58. package/esm/oas/ref/DanglingRefError.d.ts +22 -0
  59. package/esm/oas/ref/DanglingRefError.js +33 -0
  60. package/esm/oas/ref/Ref.d.ts +152 -25
  61. package/esm/oas/ref/Ref.js +414 -26
  62. package/esm/oas/requestBody/RequestBody.d.ts +4 -0
  63. package/esm/oas/requestBody/RequestBody.js +8 -0
  64. package/esm/oas/response/Response.d.ts +4 -0
  65. package/esm/oas/response/Response.js +8 -0
  66. package/esm/oas/schema/siblings.d.ts +127 -0
  67. package/esm/oas/schema/siblings.js +250 -0
  68. package/esm/oas/securitySchemes/SecurityScheme.d.ts +16 -0
  69. package/esm/oas/securitySchemes/SecurityScheme.js +32 -0
  70. package/esm/oas/string/String.d.ts +19 -0
  71. package/esm/oas/string/String.js +47 -0
  72. package/esm/oas/union/Union.d.ts +32 -0
  73. package/esm/oas/union/Union.js +111 -0
  74. package/esm/oas/unknown/Unknown.d.ts +18 -0
  75. package/esm/oas/unknown/Unknown.js +38 -0
  76. package/esm/oas/void/Void.d.ts +4 -0
  77. package/esm/oas/void/Void.js +8 -0
  78. package/esm/oas/webhook/Webhook.d.ts +2 -2
  79. package/esm/oas/webhook/Webhook.js +4 -5
  80. package/esm/parse/allOfSystem.d.ts +32 -0
  81. package/esm/parse/allOfSystem.js +30 -0
  82. package/esm/parse/anyOfSystem.d.ts +68 -0
  83. package/esm/parse/anyOfSystem.js +107 -0
  84. package/esm/parse/securityRequirements.d.ts +6 -0
  85. package/esm/parse/securityRequirements.js +8 -0
  86. package/esm/parse/toSiblingKeywords.d.ts +28 -0
  87. package/esm/parse/toSiblingKeywords.js +109 -0
  88. package/esm/parse/v3-0/_merge-all-of/decompose-union.d.ts +8 -0
  89. package/esm/parse/v3-0/_merge-all-of/decompose-union.js +9 -1
  90. package/esm/parse/v3-0/_merge-all-of/generic-merge.d.ts +2 -3
  91. package/esm/parse/v3-0/_merge-all-of/generic-merge.js +2 -2
  92. package/esm/parse/v3-0/_merge-all-of/merge-array-constraints.d.ts +2 -2
  93. package/esm/parse/v3-0/_merge-all-of/merge-array-constraints.js +5 -5
  94. package/esm/parse/v3-0/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  95. package/esm/parse/v3-0/_merge-all-of/merge-boolean-constraints.js +2 -2
  96. package/esm/parse/v3-0/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  97. package/esm/parse/v3-0/_merge-all-of/merge-integer-constraints.js +2 -2
  98. package/esm/parse/v3-0/_merge-all-of/merge-intersection.d.ts +3 -2
  99. package/esm/parse/v3-0/_merge-all-of/merge-intersection.js +2 -2
  100. package/esm/parse/v3-0/_merge-all-of/merge-number-constraints.d.ts +2 -2
  101. package/esm/parse/v3-0/_merge-all-of/merge-number-constraints.js +2 -2
  102. package/esm/parse/v3-0/_merge-all-of/merge-object-constraints.d.ts +2 -2
  103. package/esm/parse/v3-0/_merge-all-of/merge-object-constraints.js +3 -3
  104. package/esm/parse/v3-0/_merge-all-of/merge-properties.d.ts +2 -2
  105. package/esm/parse/v3-0/_merge-all-of/merge-properties.js +2 -2
  106. package/esm/parse/v3-0/_merge-all-of/merge-string-constraints.d.ts +2 -2
  107. package/esm/parse/v3-0/_merge-all-of/merge-string-constraints.js +3 -3
  108. package/esm/parse/v3-0/_merge-all-of/merge-union.d.ts +10 -3
  109. package/esm/parse/v3-0/_merge-all-of/merge-union.js +50 -12
  110. package/esm/parse/v3-0/_merge-all-of/merge.d.ts +2 -2
  111. package/esm/parse/v3-0/_merge-all-of/merge.js +78 -27
  112. package/esm/parse/v3-0/_merge-all-of/nullable-merge.d.ts +4 -0
  113. package/esm/parse/v3-0/_merge-all-of/nullable-merge.js +9 -7
  114. package/esm/parse/v3-0/_merge-all-of/types.d.ts +33 -0
  115. package/esm/parse/v3-0/mediaType/toMediaTypeItemV3.js +4 -3
  116. package/esm/parse/v3-0/parameter/toParameterV3.js +4 -3
  117. package/esm/parse/v3-0/ref/toRefV31.d.ts +7 -1
  118. package/esm/parse/v3-0/ref/toRefV31.js +6 -3
  119. package/esm/parse/v3-0/schema/toSchemasV3.js +107 -15
  120. package/esm/parse/v3-1/_merge-all-of/decompose-union.d.ts +7 -1
  121. package/esm/parse/v3-1/_merge-all-of/decompose-union.js +8 -2
  122. package/esm/parse/v3-1/_merge-all-of/generic-merge.d.ts +2 -3
  123. package/esm/parse/v3-1/_merge-all-of/generic-merge.js +2 -2
  124. package/esm/parse/v3-1/_merge-all-of/merge-array-constraints.d.ts +3 -2
  125. package/esm/parse/v3-1/_merge-all-of/merge-array-constraints.js +5 -5
  126. package/esm/parse/v3-1/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  127. package/esm/parse/v3-1/_merge-all-of/merge-boolean-constraints.js +2 -2
  128. package/esm/parse/v3-1/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  129. package/esm/parse/v3-1/_merge-all-of/merge-integer-constraints.js +2 -2
  130. package/esm/parse/v3-1/_merge-all-of/merge-intersection.d.ts +3 -2
  131. package/esm/parse/v3-1/_merge-all-of/merge-intersection.js +2 -2
  132. package/esm/parse/v3-1/_merge-all-of/merge-number-constraints.d.ts +2 -2
  133. package/esm/parse/v3-1/_merge-all-of/merge-number-constraints.js +2 -2
  134. package/esm/parse/v3-1/_merge-all-of/merge-object-constraints.d.ts +2 -2
  135. package/esm/parse/v3-1/_merge-all-of/merge-object-constraints.js +3 -3
  136. package/esm/parse/v3-1/_merge-all-of/merge-properties.d.ts +2 -2
  137. package/esm/parse/v3-1/_merge-all-of/merge-properties.js +2 -2
  138. package/esm/parse/v3-1/_merge-all-of/merge-string-constraints.d.ts +2 -2
  139. package/esm/parse/v3-1/_merge-all-of/merge-string-constraints.js +3 -3
  140. package/esm/parse/v3-1/_merge-all-of/merge-union.d.ts +10 -3
  141. package/esm/parse/v3-1/_merge-all-of/merge-union.js +54 -15
  142. package/esm/parse/v3-1/_merge-all-of/merge.d.ts +3 -2
  143. package/esm/parse/v3-1/_merge-all-of/merge.js +88 -29
  144. package/esm/parse/v3-1/_merge-all-of/nullable-merge.d.ts +4 -0
  145. package/esm/parse/v3-1/_merge-all-of/nullable-merge.js +9 -7
  146. package/esm/parse/v3-1/_merge-all-of/types.d.ts +37 -0
  147. package/esm/parse/v3-1/mediaType/toMediaTypeItemV3.js +4 -3
  148. package/esm/parse/v3-1/parameter/toParameterV3.js +4 -3
  149. package/esm/parse/v3-1/ref/toRefV31.d.ts +7 -1
  150. package/esm/parse/v3-1/ref/toRefV31.js +6 -3
  151. package/esm/parse/v3-1/schema/toSchemasV3.js +111 -16
  152. package/esm/parse/v3-2/_merge-all-of/decompose-union.d.ts +7 -1
  153. package/esm/parse/v3-2/_merge-all-of/decompose-union.js +8 -2
  154. package/esm/parse/v3-2/_merge-all-of/generic-merge.d.ts +2 -3
  155. package/esm/parse/v3-2/_merge-all-of/generic-merge.js +2 -2
  156. package/esm/parse/v3-2/_merge-all-of/merge-array-constraints.d.ts +3 -2
  157. package/esm/parse/v3-2/_merge-all-of/merge-array-constraints.js +5 -5
  158. package/esm/parse/v3-2/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  159. package/esm/parse/v3-2/_merge-all-of/merge-boolean-constraints.js +2 -2
  160. package/esm/parse/v3-2/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  161. package/esm/parse/v3-2/_merge-all-of/merge-integer-constraints.js +2 -2
  162. package/esm/parse/v3-2/_merge-all-of/merge-intersection.d.ts +3 -2
  163. package/esm/parse/v3-2/_merge-all-of/merge-intersection.js +2 -2
  164. package/esm/parse/v3-2/_merge-all-of/merge-number-constraints.d.ts +2 -2
  165. package/esm/parse/v3-2/_merge-all-of/merge-number-constraints.js +2 -2
  166. package/esm/parse/v3-2/_merge-all-of/merge-object-constraints.d.ts +2 -2
  167. package/esm/parse/v3-2/_merge-all-of/merge-object-constraints.js +3 -3
  168. package/esm/parse/v3-2/_merge-all-of/merge-properties.d.ts +2 -2
  169. package/esm/parse/v3-2/_merge-all-of/merge-properties.js +2 -2
  170. package/esm/parse/v3-2/_merge-all-of/merge-string-constraints.d.ts +2 -2
  171. package/esm/parse/v3-2/_merge-all-of/merge-string-constraints.js +3 -3
  172. package/esm/parse/v3-2/_merge-all-of/merge-union.d.ts +10 -3
  173. package/esm/parse/v3-2/_merge-all-of/merge-union.js +54 -15
  174. package/esm/parse/v3-2/_merge-all-of/merge.d.ts +3 -2
  175. package/esm/parse/v3-2/_merge-all-of/merge.js +88 -29
  176. package/esm/parse/v3-2/_merge-all-of/nullable-merge.d.ts +4 -0
  177. package/esm/parse/v3-2/_merge-all-of/nullable-merge.js +9 -7
  178. package/esm/parse/v3-2/_merge-all-of/types.d.ts +37 -0
  179. package/esm/parse/v3-2/mediaType/toMediaTypeItemV3.js +4 -3
  180. package/esm/parse/v3-2/parameter/toParameterV3.js +4 -3
  181. package/esm/parse/v3-2/ref/toRefV31.d.ts +7 -1
  182. package/esm/parse/v3-2/ref/toRefV31.js +6 -3
  183. package/esm/parse/v3-2/schema/toSchemasV3.js +111 -16
  184. package/esm/types/OasBase.d.ts +1 -1
  185. package/esm/types/Settings.d.ts +44 -0
  186. package/esm/types/Settings.js +9 -0
  187. package/package.json +5 -1
  188. package/script/context/CoreContext.js +22 -8
  189. package/script/context/GenerateContext.d.ts +6 -5
  190. package/script/context/GenerateContext.js +112 -38
  191. package/script/context/ParseContext.d.ts +18 -1
  192. package/script/context/ParseContext.js +102 -3
  193. package/script/context/generateTypes.d.ts +33 -4
  194. package/script/context/generateTypes.js +4 -0
  195. package/script/context/toGenerationFailure.d.ts +21 -0
  196. package/script/context/toGenerationFailure.js +43 -0
  197. package/script/context/tryParseAt.d.ts +4 -1
  198. package/script/context/tryParseAt.js +10 -3
  199. package/script/dsl/CustomValue.d.ts +4 -0
  200. package/script/dsl/CustomValue.js +8 -0
  201. package/script/dsl/Definition.d.ts +10 -0
  202. package/script/dsl/Definition.js +14 -0
  203. package/script/dsl/PendingDefinition.d.ts +47 -0
  204. package/script/dsl/PendingDefinition.js +87 -0
  205. package/script/dsl/model/ModelDriver.d.ts +55 -1
  206. package/script/dsl/model/ModelDriver.js +231 -52
  207. package/script/dsl/model/toModelEntry.d.ts +1 -1
  208. package/script/dsl/model/toModelEntry.js +1 -1
  209. package/script/dsl/model/types.d.ts +1 -1
  210. package/script/dsl/operation/gql/GqlOperationDriver.js +1 -4
  211. package/script/dsl/webhook/WebhookDriver.js +1 -4
  212. package/script/enrichments/parseEnrichmentUmbrella.d.ts +5 -6
  213. package/script/enrichments/parseEnrichmentUmbrella.js +23 -41
  214. package/script/enrichments/parseEnrichmentValue.d.ts +17 -0
  215. package/script/enrichments/parseEnrichmentValue.js +69 -0
  216. package/script/enrichments/readEnrichments.d.ts +5 -5
  217. package/script/enrichments/readEnrichments.js +17 -40
  218. package/script/helpers/collateExamples.js +15 -5
  219. package/script/helpers/refFns.d.ts +6 -2
  220. package/script/helpers/refFns.js +24 -7
  221. package/script/mod.d.ts +2 -0
  222. package/script/mod.js +2 -0
  223. package/script/oas/array/Array.d.ts +19 -0
  224. package/script/oas/array/Array.js +47 -0
  225. package/script/oas/boolean/Boolean.d.ts +19 -0
  226. package/script/oas/boolean/Boolean.js +51 -8
  227. package/script/oas/example/Example.d.ts +4 -0
  228. package/script/oas/example/Example.js +8 -0
  229. package/script/oas/header/Header.d.ts +4 -0
  230. package/script/oas/header/Header.js +8 -0
  231. package/script/oas/integer/Integer.d.ts +19 -0
  232. package/script/oas/integer/Integer.js +49 -0
  233. package/script/oas/link/Link.d.ts +4 -0
  234. package/script/oas/link/Link.js +8 -0
  235. package/script/oas/number/Number.d.ts +19 -0
  236. package/script/oas/number/Number.js +49 -0
  237. package/script/oas/object/Object.d.ts +19 -0
  238. package/script/oas/object/Object.js +68 -18
  239. package/script/oas/operation/Operation.d.ts +8 -1
  240. package/script/oas/operation/Operation.js +18 -5
  241. package/script/oas/operation/toEffectiveParameters.d.ts +24 -0
  242. package/script/oas/operation/toEffectiveParameters.js +47 -0
  243. package/script/oas/parameter/Parameter.d.ts +4 -0
  244. package/script/oas/parameter/Parameter.js +8 -0
  245. package/script/oas/ref/DanglingRefError.d.ts +22 -0
  246. package/script/oas/ref/DanglingRefError.js +37 -0
  247. package/script/oas/ref/Ref.d.ts +152 -25
  248. package/script/oas/ref/Ref.js +414 -26
  249. package/script/oas/requestBody/RequestBody.d.ts +4 -0
  250. package/script/oas/requestBody/RequestBody.js +8 -0
  251. package/script/oas/response/Response.d.ts +4 -0
  252. package/script/oas/response/Response.js +8 -0
  253. package/script/oas/schema/siblings.d.ts +127 -0
  254. package/script/oas/schema/siblings.js +305 -0
  255. package/script/oas/securitySchemes/SecurityScheme.d.ts +16 -0
  256. package/script/oas/securitySchemes/SecurityScheme.js +32 -0
  257. package/script/oas/string/String.d.ts +19 -0
  258. package/script/oas/string/String.js +47 -0
  259. package/script/oas/union/Union.d.ts +32 -0
  260. package/script/oas/union/Union.js +111 -0
  261. package/script/oas/unknown/Unknown.d.ts +18 -0
  262. package/script/oas/unknown/Unknown.js +38 -0
  263. package/script/oas/void/Void.d.ts +4 -0
  264. package/script/oas/void/Void.js +8 -0
  265. package/script/oas/webhook/Webhook.d.ts +2 -2
  266. package/script/oas/webhook/Webhook.js +4 -5
  267. package/script/parse/allOfSystem.d.ts +32 -0
  268. package/script/parse/allOfSystem.js +35 -0
  269. package/script/parse/anyOfSystem.d.ts +68 -0
  270. package/script/parse/anyOfSystem.js +116 -0
  271. package/script/parse/securityRequirements.d.ts +6 -0
  272. package/script/parse/securityRequirements.js +8 -0
  273. package/script/parse/toSiblingKeywords.d.ts +28 -0
  274. package/script/parse/toSiblingKeywords.js +146 -0
  275. package/script/parse/v3-0/_merge-all-of/decompose-union.d.ts +8 -0
  276. package/script/parse/v3-0/_merge-all-of/decompose-union.js +11 -2
  277. package/script/parse/v3-0/_merge-all-of/generic-merge.d.ts +2 -3
  278. package/script/parse/v3-0/_merge-all-of/generic-merge.js +2 -2
  279. package/script/parse/v3-0/_merge-all-of/merge-array-constraints.d.ts +2 -2
  280. package/script/parse/v3-0/_merge-all-of/merge-array-constraints.js +5 -5
  281. package/script/parse/v3-0/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  282. package/script/parse/v3-0/_merge-all-of/merge-boolean-constraints.js +2 -2
  283. package/script/parse/v3-0/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  284. package/script/parse/v3-0/_merge-all-of/merge-integer-constraints.js +2 -2
  285. package/script/parse/v3-0/_merge-all-of/merge-intersection.d.ts +3 -2
  286. package/script/parse/v3-0/_merge-all-of/merge-intersection.js +2 -2
  287. package/script/parse/v3-0/_merge-all-of/merge-number-constraints.d.ts +2 -2
  288. package/script/parse/v3-0/_merge-all-of/merge-number-constraints.js +2 -2
  289. package/script/parse/v3-0/_merge-all-of/merge-object-constraints.d.ts +2 -2
  290. package/script/parse/v3-0/_merge-all-of/merge-object-constraints.js +3 -3
  291. package/script/parse/v3-0/_merge-all-of/merge-properties.d.ts +2 -2
  292. package/script/parse/v3-0/_merge-all-of/merge-properties.js +2 -2
  293. package/script/parse/v3-0/_merge-all-of/merge-string-constraints.d.ts +2 -2
  294. package/script/parse/v3-0/_merge-all-of/merge-string-constraints.js +3 -3
  295. package/script/parse/v3-0/_merge-all-of/merge-union.d.ts +10 -3
  296. package/script/parse/v3-0/_merge-all-of/merge-union.js +52 -13
  297. package/script/parse/v3-0/_merge-all-of/merge.d.ts +2 -2
  298. package/script/parse/v3-0/_merge-all-of/merge.js +77 -26
  299. package/script/parse/v3-0/_merge-all-of/nullable-merge.d.ts +4 -0
  300. package/script/parse/v3-0/_merge-all-of/nullable-merge.js +9 -7
  301. package/script/parse/v3-0/_merge-all-of/types.d.ts +33 -0
  302. package/script/parse/v3-0/mediaType/toMediaTypeItemV3.js +4 -3
  303. package/script/parse/v3-0/parameter/toParameterV3.js +4 -3
  304. package/script/parse/v3-0/ref/toRefV31.d.ts +7 -1
  305. package/script/parse/v3-0/ref/toRefV31.js +6 -3
  306. package/script/parse/v3-0/schema/toSchemasV3.js +107 -15
  307. package/script/parse/v3-1/_merge-all-of/decompose-union.d.ts +7 -1
  308. package/script/parse/v3-1/_merge-all-of/decompose-union.js +8 -2
  309. package/script/parse/v3-1/_merge-all-of/generic-merge.d.ts +2 -3
  310. package/script/parse/v3-1/_merge-all-of/generic-merge.js +2 -2
  311. package/script/parse/v3-1/_merge-all-of/merge-array-constraints.d.ts +3 -2
  312. package/script/parse/v3-1/_merge-all-of/merge-array-constraints.js +5 -5
  313. package/script/parse/v3-1/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  314. package/script/parse/v3-1/_merge-all-of/merge-boolean-constraints.js +2 -2
  315. package/script/parse/v3-1/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  316. package/script/parse/v3-1/_merge-all-of/merge-integer-constraints.js +2 -2
  317. package/script/parse/v3-1/_merge-all-of/merge-intersection.d.ts +3 -2
  318. package/script/parse/v3-1/_merge-all-of/merge-intersection.js +2 -2
  319. package/script/parse/v3-1/_merge-all-of/merge-number-constraints.d.ts +2 -2
  320. package/script/parse/v3-1/_merge-all-of/merge-number-constraints.js +2 -2
  321. package/script/parse/v3-1/_merge-all-of/merge-object-constraints.d.ts +2 -2
  322. package/script/parse/v3-1/_merge-all-of/merge-object-constraints.js +3 -3
  323. package/script/parse/v3-1/_merge-all-of/merge-properties.d.ts +2 -2
  324. package/script/parse/v3-1/_merge-all-of/merge-properties.js +2 -2
  325. package/script/parse/v3-1/_merge-all-of/merge-string-constraints.d.ts +2 -2
  326. package/script/parse/v3-1/_merge-all-of/merge-string-constraints.js +3 -3
  327. package/script/parse/v3-1/_merge-all-of/merge-union.d.ts +10 -3
  328. package/script/parse/v3-1/_merge-all-of/merge-union.js +56 -16
  329. package/script/parse/v3-1/_merge-all-of/merge.d.ts +3 -2
  330. package/script/parse/v3-1/_merge-all-of/merge.js +87 -28
  331. package/script/parse/v3-1/_merge-all-of/nullable-merge.d.ts +4 -0
  332. package/script/parse/v3-1/_merge-all-of/nullable-merge.js +9 -7
  333. package/script/parse/v3-1/_merge-all-of/types.d.ts +37 -0
  334. package/script/parse/v3-1/mediaType/toMediaTypeItemV3.js +4 -3
  335. package/script/parse/v3-1/parameter/toParameterV3.js +4 -3
  336. package/script/parse/v3-1/ref/toRefV31.d.ts +7 -1
  337. package/script/parse/v3-1/ref/toRefV31.js +6 -3
  338. package/script/parse/v3-1/schema/toSchemasV3.js +111 -16
  339. package/script/parse/v3-2/_merge-all-of/decompose-union.d.ts +7 -1
  340. package/script/parse/v3-2/_merge-all-of/decompose-union.js +8 -2
  341. package/script/parse/v3-2/_merge-all-of/generic-merge.d.ts +2 -3
  342. package/script/parse/v3-2/_merge-all-of/generic-merge.js +2 -2
  343. package/script/parse/v3-2/_merge-all-of/merge-array-constraints.d.ts +3 -2
  344. package/script/parse/v3-2/_merge-all-of/merge-array-constraints.js +5 -5
  345. package/script/parse/v3-2/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
  346. package/script/parse/v3-2/_merge-all-of/merge-boolean-constraints.js +2 -2
  347. package/script/parse/v3-2/_merge-all-of/merge-integer-constraints.d.ts +2 -2
  348. package/script/parse/v3-2/_merge-all-of/merge-integer-constraints.js +2 -2
  349. package/script/parse/v3-2/_merge-all-of/merge-intersection.d.ts +3 -2
  350. package/script/parse/v3-2/_merge-all-of/merge-intersection.js +2 -2
  351. package/script/parse/v3-2/_merge-all-of/merge-number-constraints.d.ts +2 -2
  352. package/script/parse/v3-2/_merge-all-of/merge-number-constraints.js +2 -2
  353. package/script/parse/v3-2/_merge-all-of/merge-object-constraints.d.ts +2 -2
  354. package/script/parse/v3-2/_merge-all-of/merge-object-constraints.js +3 -3
  355. package/script/parse/v3-2/_merge-all-of/merge-properties.d.ts +2 -2
  356. package/script/parse/v3-2/_merge-all-of/merge-properties.js +2 -2
  357. package/script/parse/v3-2/_merge-all-of/merge-string-constraints.d.ts +2 -2
  358. package/script/parse/v3-2/_merge-all-of/merge-string-constraints.js +3 -3
  359. package/script/parse/v3-2/_merge-all-of/merge-union.d.ts +10 -3
  360. package/script/parse/v3-2/_merge-all-of/merge-union.js +56 -16
  361. package/script/parse/v3-2/_merge-all-of/merge.d.ts +3 -2
  362. package/script/parse/v3-2/_merge-all-of/merge.js +87 -28
  363. package/script/parse/v3-2/_merge-all-of/nullable-merge.d.ts +4 -0
  364. package/script/parse/v3-2/_merge-all-of/nullable-merge.js +9 -7
  365. package/script/parse/v3-2/_merge-all-of/types.d.ts +37 -0
  366. package/script/parse/v3-2/mediaType/toMediaTypeItemV3.js +4 -3
  367. package/script/parse/v3-2/parameter/toParameterV3.js +4 -3
  368. package/script/parse/v3-2/ref/toRefV31.d.ts +7 -1
  369. package/script/parse/v3-2/ref/toRefV31.js +6 -3
  370. package/script/parse/v3-2/schema/toSchemasV3.js +111 -16
  371. package/script/types/OasBase.d.ts +1 -1
  372. package/script/types/Settings.d.ts +44 -0
  373. package/script/types/Settings.js +10 -1
@@ -1,4 +1,5 @@
1
1
  import "../../_dnt.polyfills.js";
2
+ import type { OasUnknown } from '../unknown/Unknown.js';
2
3
  import type { SchemaPath } from '../../types/SchemaPath.js';
3
4
  import type { OasRef } from '../ref/Ref.js';
4
5
  import type { OasExternalDocs } from '../externalDocs/ExternalDocs.js';
@@ -222,6 +223,12 @@ export declare class OasObject<Nullable extends boolean | undefined = boolean |
222
223
  * });
223
224
  * ```
224
225
  */
226
+ /**
227
+ * The schema's `not`, kept as an `OasUnknown` under `client.json`
228
+ * `system.not: unknown`: the document says "not something", and core does
229
+ * not read what. `undefined` otherwise.
230
+ */
231
+ not: OasUnknown | undefined;
225
232
  constructor(fields?: OasObjectFields<Nullable>, context?: ParseContextType);
226
233
  /**
227
234
  * Creates a new empty OasObject with no properties.
@@ -327,6 +334,18 @@ export declare class OasObject<Nullable extends boolean | undefined = boolean |
327
334
  */
328
335
  removeProperty(name: string): OasObject;
329
336
  isRef(): this is OasRef<'schema'>;
337
+ /** Whether the value is `readOnly`: sent by the API only, never in a request. */
338
+ isReadOnly(): boolean;
339
+ /** Whether the value is `writeOnly`: sent in a request only, never by the API. */
340
+ isWriteOnly(): boolean;
341
+ /**
342
+ * A copy of this schema with what `ref` adds at its site applied: its
343
+ * `nullable`, `readOnly`, `writeOnly` and the keywords next to it (`SiblingKeywords`) that
344
+ * this type takes, a sibling's value winning. A value that does not fit
345
+ * this type is left out (the parser reports it). For `OasRef.resolve()`.
346
+ * This schema does not change, and the copy shares its child schemas.
347
+ */
348
+ clone(ref?: OasRef<'schema'>): OasObject;
330
349
  traverse(path: SchemaPath): OasSchema | OasRef<'schema'>;
331
350
  resolve(): OasObject;
332
351
  resolveOnce(): OasObject;
@@ -1,5 +1,6 @@
1
1
  import "../../_dnt.polyfills.js";
2
2
  import { traverseSchema } from '../schemaPath/traverseSchema.js';
3
+ import { toSiblingAnnotations, toSiblingEnums, toSiblingValue, isObjectValue } from '../schema/siblings.js';
3
4
  import { OasBase } from '../../types/OasBase.js';
4
5
  /**
5
6
  * Represents an object schema in the OpenAPI Specification.
@@ -87,24 +88,6 @@ import { OasBase } from '../../types/OasBase.js';
87
88
  * ```
88
89
  */
89
90
  export class OasObject extends OasBase {
90
- /**
91
- * Creates a new OasObject instance.
92
- *
93
- * @param fields - Object configuration fields
94
- *
95
- * @example
96
- * ```typescript
97
- * const userSchema = new OasObject({
98
- * title: 'User',
99
- * properties: {
100
- * id: new OasString({ title: 'ID' }),
101
- * name: new OasString({ title: 'Name' })
102
- * },
103
- * required: ['id'],
104
- * additionalProperties: false
105
- * });
106
- * ```
107
- */
108
91
  constructor(fields = {}, context) {
109
92
  super(context);
110
93
  /**
@@ -258,6 +241,35 @@ export class OasObject extends OasBase {
258
241
  writable: true,
259
242
  value: void 0
260
243
  });
244
+ /**
245
+ * Creates a new OasObject instance.
246
+ *
247
+ * @param fields - Object configuration fields
248
+ *
249
+ * @example
250
+ * ```typescript
251
+ * const userSchema = new OasObject({
252
+ * title: 'User',
253
+ * properties: {
254
+ * id: new OasString({ title: 'ID' }),
255
+ * name: new OasString({ title: 'Name' })
256
+ * },
257
+ * required: ['id'],
258
+ * additionalProperties: false
259
+ * });
260
+ * ```
261
+ */
262
+ /**
263
+ * The schema's `not`, kept as an `OasUnknown` under `client.json`
264
+ * `system.not: unknown`: the document says "not something", and core does
265
+ * not read what. `undefined` otherwise.
266
+ */
267
+ Object.defineProperty(this, "not", {
268
+ enumerable: true,
269
+ configurable: true,
270
+ writable: true,
271
+ value: undefined
272
+ });
261
273
  this.title = fields.title;
262
274
  this.description = fields.description;
263
275
  this.externalDocs = fields.externalDocs;
@@ -271,6 +283,7 @@ export class OasObject extends OasBase {
271
283
  this.maxProperties = fields.maxProperties;
272
284
  this.minProperties = fields.minProperties;
273
285
  this.readOnly = fields.readOnly;
286
+ this.writeOnly = fields.writeOnly;
274
287
  this.deprecated = fields.deprecated;
275
288
  this.enums = fields.enums;
276
289
  }
@@ -416,6 +429,43 @@ export class OasObject extends OasBase {
416
429
  isRef() {
417
430
  return false;
418
431
  }
432
+ /** Whether the value is `readOnly`: sent by the API only, never in a request. */
433
+ isReadOnly() {
434
+ return this.readOnly === true;
435
+ }
436
+ /** Whether the value is `writeOnly`: sent in a request only, never by the API. */
437
+ isWriteOnly() {
438
+ return this.writeOnly === true;
439
+ }
440
+ /**
441
+ * A copy of this schema with what `ref` adds at its site applied: its
442
+ * `nullable`, `readOnly`, `writeOnly` and the keywords next to it (`SiblingKeywords`) that
443
+ * this type takes, a sibling's value winning. A value that does not fit
444
+ * this type is left out (the parser reports it). For `OasRef.resolve()`.
445
+ * This schema does not change, and the copy shares its child schemas.
446
+ */
447
+ clone(ref) {
448
+ const nullable = this.nullable || ref?.nullable || undefined;
449
+ const copy = new OasObject({
450
+ ...toSiblingAnnotations(this, ref),
451
+ example: toSiblingValue(ref?.example, isObjectValue) ?? this.example,
452
+ externalDocs: this.externalDocs,
453
+ properties: ref?.properties === undefined ? (this.properties ?? undefined) : { ...this.properties, ...ref.properties },
454
+ required: ref?.required === undefined ? this.required : [...new Set([...(this.required ?? []), ...ref.required])],
455
+ additionalProperties: ref?.additionalProperties ?? this.additionalProperties,
456
+ nullable,
457
+ default: toSiblingValue(ref?.default, isObjectValue) ?? this.default,
458
+ maxProperties: ref?.maxProperties ?? this.maxProperties,
459
+ minProperties: ref?.minProperties ?? this.minProperties,
460
+ readOnly: this.readOnly || ref?.readOnly || undefined,
461
+ writeOnly: this.writeOnly || ref?.writeOnly || undefined,
462
+ deprecated: ref?.deprecated ?? this.deprecated,
463
+ enums: toSiblingEnums(ref?.enums, isObjectValue, nullable) ?? this.enums,
464
+ });
465
+ copy.stackTrail = this.stackTrail;
466
+ copy.not = this.not;
467
+ return copy;
468
+ }
419
469
  traverse(path) {
420
470
  return traverseSchema(this, path);
421
471
  }
@@ -147,7 +147,14 @@ export declare class OasOperation extends OasBase {
147
147
  */
148
148
  traverse(path: SchemaPath, mediaType?: string): OasSchema | OasRef<'schema'>;
149
149
  /**
150
- * Resolve all parameters and optionally filter by location
150
+ * Resolve all parameters and optionally filter by location.
151
+ *
152
+ * As OpenAPI defines them: the path item's parameters apply to each of its
153
+ * operations, and an operation's own parameter with the same name and
154
+ * location replaces the path item's. The path item's come first. A
155
+ * reference that names nothing (kept under `system.danglingRefs: keep`) is
156
+ * left out: it has no name or location, and the parser logged a
157
+ * `DANGLING_REF` warning for it.
151
158
  *
152
159
  * @param filter - only include parameters from specified locations
153
160
  * @returns
@@ -3,6 +3,7 @@ import { traverseSchema } from '../schemaPath/traverseSchema.js';
3
3
  import { OasObject } from '../object/Object.js';
4
4
  import { toPrimaryResponseCode } from '../response/toPrimaryResponseCode.js';
5
5
  import { OasBase } from '../../types/OasBase.js';
6
+ import { toEffectiveParameters, toResolvedParameters } from './toEffectiveParameters.js';
6
7
  export class OasOperation extends OasBase {
7
8
  /**
8
9
  * Creates a new OasOperation instance from operation field data.
@@ -218,15 +219,20 @@ export class OasOperation extends OasBase {
218
219
  return traverseSchema(rootSchema, rest);
219
220
  }
220
221
  /**
221
- * Resolve all parameters and optionally filter by location
222
+ * Resolve all parameters and optionally filter by location.
223
+ *
224
+ * As OpenAPI defines them: the path item's parameters apply to each of its
225
+ * operations, and an operation's own parameter with the same name and
226
+ * location replaces the path item's. The path item's come first. A
227
+ * reference that names nothing (kept under `system.danglingRefs: keep`) is
228
+ * left out: it has no name or location, and the parser logged a
229
+ * `DANGLING_REF` warning for it.
222
230
  *
223
231
  * @param filter - only include parameters from specified locations
224
232
  * @returns
225
233
  */
226
234
  toParams(filter) {
227
- return (this.parameters
228
- ?.map(param => param.resolve())
229
- .filter(param => (filter?.length ? filter.includes(param.location) : true)) ?? []);
235
+ return toResolvedParameters(toEffectiveParameters({ own: this.parameters, shared: this.pathItem?.parameters })).filter(param => (filter?.length ? filter.includes(param.location) : true));
230
236
  }
231
237
  /**
232
238
  * Creates an OAS object representation of operation parameters.
@@ -251,12 +257,19 @@ export class OasOperation extends OasBase {
251
257
  * @returns OpenAPI v3 operation object
252
258
  */
253
259
  toJsonSchema(options) {
260
+ const parameters = toEffectiveParameters({
261
+ own: this.parameters,
262
+ shared: this.pathItem?.parameters
263
+ });
254
264
  return {
255
265
  tags: this.tags,
256
266
  summary: this.summary,
257
267
  description: this.description,
258
268
  operationId: this.operationId,
259
- parameters: this.parameters?.map(param => param.toJsonSchema(options)),
269
+ // The path item's parameters too: the operation is written on its own.
270
+ parameters: parameters.length > 0 || this.parameters !== undefined
271
+ ? parameters.map(param => param.toJsonSchema(options))
272
+ : undefined,
260
273
  requestBody: this.requestBody?.toJsonSchema(options),
261
274
  responses: Object.fromEntries(Object.entries(this.responses).map(([key, value]) => [key, value.toJsonSchema(options)])),
262
275
  security: this.security?.map(security => security.toJsonSchema()),
@@ -0,0 +1,24 @@
1
+ import type { OasParameter } from '../parameter/Parameter.js';
2
+ import type { OasRef } from '../ref/Ref.js';
3
+ type Parameter = OasParameter | OasRef<'parameter'>;
4
+ type ToEffectiveParametersArgs = {
5
+ /** The operation's own parameters. */
6
+ own: Parameter[] | undefined;
7
+ /** The parameters of the operation's path item. */
8
+ shared: Parameter[] | undefined;
9
+ };
10
+ /**
11
+ * The parameters that apply to an operation or webhook, as OpenAPI defines
12
+ * them: the path item's first, then its own. An own parameter with the same
13
+ * name and location replaces the path item's. References stay references.
14
+ * A reference that names nothing (kept under `system.danglingRefs: keep`)
15
+ * has no name or location, so it replaces nothing and nothing replaces it.
16
+ */
17
+ export declare const toEffectiveParameters: ({ own, shared }: ToEffectiveParametersArgs) => Parameter[];
18
+ /**
19
+ * Resolves each parameter. A reference that names nothing is left out: it
20
+ * has no name or location to render, and the parser logged a `DANGLING_REF`
21
+ * warning for it.
22
+ */
23
+ export declare const toResolvedParameters: (parameters: Parameter[]) => OasParameter[];
24
+ export {};
@@ -0,0 +1,42 @@
1
+ import { DanglingRefError } from '../ref/DanglingRefError.js';
2
+ /**
3
+ * The parameters that apply to an operation or webhook, as OpenAPI defines
4
+ * them: the path item's first, then its own. An own parameter with the same
5
+ * name and location replaces the path item's. References stay references.
6
+ * A reference that names nothing (kept under `system.danglingRefs: keep`)
7
+ * has no name or location, so it replaces nothing and nothing replaces it.
8
+ */
9
+ export const toEffectiveParameters = ({ own = [], shared = [] }) => {
10
+ const ownKeys = new Set(own.map(toParameterKey));
11
+ return [
12
+ ...shared.filter(parameter => {
13
+ const key = toParameterKey(parameter);
14
+ return key === undefined || !ownKeys.has(key);
15
+ }),
16
+ ...own
17
+ ];
18
+ };
19
+ /**
20
+ * Resolves each parameter. A reference that names nothing is left out: it
21
+ * has no name or location to render, and the parser logged a `DANGLING_REF`
22
+ * warning for it.
23
+ */
24
+ export const toResolvedParameters = (parameters) => parameters.flatMap(parameter => {
25
+ const resolved = toResolvedParameter(parameter);
26
+ return resolved === undefined ? [] : [resolved];
27
+ });
28
+ const toParameterKey = (parameter) => {
29
+ const resolved = toResolvedParameter(parameter);
30
+ return resolved === undefined ? undefined : `${resolved.location}:${resolved.name}`;
31
+ };
32
+ const toResolvedParameter = (parameter) => {
33
+ try {
34
+ return parameter.resolve();
35
+ }
36
+ catch (error) {
37
+ if (DanglingRefError.is(error)) {
38
+ return undefined;
39
+ }
40
+ throw error;
41
+ }
42
+ };
@@ -224,6 +224,10 @@ export declare class OasParameter extends OasBase {
224
224
  * @returns Always false since this is a concrete parameter instance, not a reference
225
225
  */
226
226
  isRef(): this is OasRef<'parameter'>;
227
+ /** Always `false`: `readOnly` is a schema keyword. */
228
+ isReadOnly(): boolean;
229
+ /** Always `false`: `writeOnly` is a schema keyword. */
230
+ isWriteOnly(): boolean;
227
231
  /**
228
232
  * Resolves this parameter object.
229
233
  *
@@ -273,6 +273,14 @@ export class OasParameter extends OasBase {
273
273
  isRef() {
274
274
  return false;
275
275
  }
276
+ /** Always `false`: `readOnly` is a schema keyword. */
277
+ isReadOnly() {
278
+ return false;
279
+ }
280
+ /** Always `false`: `writeOnly` is a schema keyword. */
281
+ isWriteOnly() {
282
+ return false;
283
+ }
276
284
  /**
277
285
  * Resolves this parameter object.
278
286
  *
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Thrown when a reference that names nothing in the document is resolved.
3
+ *
4
+ * Under `client.json` `system.danglingRefs: strict` (the default) the parser
5
+ * removes what holds such a reference, so a generator never meets one. Under
6
+ * `keep` the reference stays, and a generator that resolves it can catch
7
+ * this error and render something else in its place. Test for it with
8
+ * {@link DanglingRefError.is}, not `instanceof`.
9
+ */
10
+ import "../../_dnt.polyfills.js";
11
+ export declare class DanglingRefError extends Error {
12
+ /** The `$ref`, or the component name, that names nothing. */
13
+ ref: string;
14
+ constructor(ref: string);
15
+ /**
16
+ * True when `error` is a `DanglingRefError`. It reads the error's name,
17
+ * not its class, so it is also true for one thrown by another copy of
18
+ * `@skmtc/core`, such as the copy a generator bundle resolves, where
19
+ * `instanceof` is false.
20
+ */
21
+ static is(error: unknown): error is DanglingRefError;
22
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Thrown when a reference that names nothing in the document is resolved.
3
+ *
4
+ * Under `client.json` `system.danglingRefs: strict` (the default) the parser
5
+ * removes what holds such a reference, so a generator never meets one. Under
6
+ * `keep` the reference stays, and a generator that resolves it can catch
7
+ * this error and render something else in its place. Test for it with
8
+ * {@link DanglingRefError.is}, not `instanceof`.
9
+ */
10
+ import "../../_dnt.polyfills.js";
11
+ export class DanglingRefError extends Error {
12
+ constructor(ref) {
13
+ super(`Ref "${ref}" names nothing in the document`);
14
+ /** The `$ref`, or the component name, that names nothing. */
15
+ Object.defineProperty(this, "ref", {
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true,
19
+ value: void 0
20
+ });
21
+ this.name = 'DanglingRefError';
22
+ this.ref = ref;
23
+ }
24
+ /**
25
+ * True when `error` is a `DanglingRefError`. It reads the error's name,
26
+ * not its class, so it is also true for one thrown by another copy of
27
+ * `@skmtc/core`, such as the copy a generator bundle resolves, where
28
+ * `instanceof` is false.
29
+ */
30
+ static is(error) {
31
+ return error instanceof Error && error.name === 'DanglingRefError';
32
+ }
33
+ }
@@ -13,26 +13,26 @@ import type { RefName } from '../../types/RefName.js';
13
13
  import type { OpenAPIV3 } from 'openapi-types';
14
14
  import type { OasSecurityScheme } from '../securitySchemes/SecurityScheme.js';
15
15
  import { OasBase } from '../../types/OasBase.js';
16
+ import { type SiblingKeywords } from '../schema/siblings.js';
16
17
  import type { ParseContextType } from '../../context/parseTypes.js';
17
18
  /**
18
- * Field data for creating OAS reference objects.
19
+ * What a reference reads from the parse context when it is made: the document
20
+ * it resolves through, and the trail it records. `clone` passes them itself.
21
+ */
22
+ type RefContext = Pick<ParseContextType, 'parsedDocument' | 'currentStackTrail'>;
23
+ /**
24
+ * Field data for creating OAS reference objects: the reference, its use-site
25
+ * flags, and the other keywords next to it in a one-member `allOf`
26
+ * (`{ allOf: [{ $ref }], minLength: 3, description: '…' }`), parsed without
27
+ * the target's type (see {@link SiblingKeywords}). {@link OasRef.resolve}
28
+ * applies the keywords to a copy of the target, so the shared target never
29
+ * changes, and the reference stays lazy, so a self-reference still ends.
19
30
  *
20
31
  * @template T - The type of component being referenced (e.g., 'schema', 'response')
21
32
  */
22
- export type RefFields<T extends OasRefData['refType']> = {
33
+ export type RefFields<T extends OasRefData['refType']> = SiblingKeywords & {
23
34
  refType: T;
24
35
  $ref: string;
25
- /**
26
- * Use-site nullability. A `$ref` is a per-reference node: the same
27
- * refName may be referenced nullable at one site and non-nullable at
28
- * another, so nullability rides the reference, not the shared referent.
29
- * Set by the single-member `oneOf`/`anyOf` collapse for the 3.1
30
- * `oneOf:[{$ref},{type:null}]` idiom; consumed directly by generators
31
- * (`'nullable' in schema ? schema.nullable`) to render `Foo | null`,
32
- * while `ModelDriver` builds the un-nullable shared model from the
33
- * refName.
34
- */
35
- nullable?: boolean;
36
36
  };
37
37
  /**
38
38
  * Represents an OpenAPI reference ($ref) in the SKMTC OAS processing system.
@@ -126,16 +126,81 @@ export declare class OasRef<T extends OasRefData['refType']> extends OasBase {
126
126
  oasType: 'ref';
127
127
  /** Type identifier */
128
128
  type: 'ref';
129
+ /** The kind of component the reference points to. */
130
+ refType: T;
131
+ /** The JSON Reference: `#/components/<bucket>/<name>`. */
132
+ $ref: string;
133
+ /**
134
+ * Use-site nullability (see {@link SiblingKeywords.nullable}). Assigned
135
+ * even when `undefined`, so `'nullable' in ref` is always true and the
136
+ * value-function nullable read picks it up uniformly.
137
+ */
138
+ nullable: SiblingKeywords['nullable'];
139
+ /** Use-site `readOnly` (see {@link SiblingKeywords.readOnly}). */
140
+ readOnly: SiblingKeywords['readOnly'];
141
+ /** Use-site `writeOnly` (see {@link SiblingKeywords.writeOnly}). */
142
+ writeOnly: SiblingKeywords['writeOnly'];
143
+ /** The `type` written next to this reference (see {@link SiblingKeywords._type}). */
144
+ _type: SiblingKeywords['_type'];
145
+ /** The `title` next to this reference (see {@link SiblingKeywords}). */
146
+ title: SiblingKeywords['title'];
147
+ /** The `description` next to this reference (see {@link SiblingKeywords}). */
148
+ description: SiblingKeywords['description'];
149
+ /** The `deprecated` next to this reference (see {@link SiblingKeywords}). */
150
+ deprecated: SiblingKeywords['deprecated'];
151
+ /** The `example` next to this reference (see {@link SiblingKeywords}). */
152
+ example: SiblingKeywords['example'];
153
+ /** The `default` next to this reference (see {@link SiblingKeywords}). */
154
+ default: SiblingKeywords['default'];
155
+ /** The `enum` next to this reference (see {@link SiblingKeywords}). */
156
+ enums: SiblingKeywords['enums'];
157
+ /** The extensions (`x-*`) next to this reference (see {@link SiblingKeywords}). */
158
+ extensionFields: SiblingKeywords['extensionFields'];
159
+ /** The `format` next to this reference (see {@link SiblingKeywords}). */
160
+ format: SiblingKeywords['format'];
161
+ /** The `minLength` next to this reference (see {@link SiblingKeywords}). */
162
+ minLength: SiblingKeywords['minLength'];
163
+ /** The `maxLength` next to this reference (see {@link SiblingKeywords}). */
164
+ maxLength: SiblingKeywords['maxLength'];
165
+ /** The `pattern` next to this reference (see {@link SiblingKeywords}). */
166
+ pattern: SiblingKeywords['pattern'];
167
+ /** The `multipleOf` next to this reference (see {@link SiblingKeywords}). */
168
+ multipleOf: SiblingKeywords['multipleOf'];
169
+ /** The `minimum` next to this reference (see {@link SiblingKeywords}). */
170
+ minimum: SiblingKeywords['minimum'];
171
+ /** The `maximum` next to this reference (see {@link SiblingKeywords}). */
172
+ maximum: SiblingKeywords['maximum'];
173
+ /** The `exclusiveMinimum` next to this reference (see {@link SiblingKeywords}). */
174
+ exclusiveMinimum: SiblingKeywords['exclusiveMinimum'];
175
+ /** The `exclusiveMaximum` next to this reference (see {@link SiblingKeywords}). */
176
+ exclusiveMaximum: SiblingKeywords['exclusiveMaximum'];
177
+ /** The `minItems` next to this reference (see {@link SiblingKeywords}). */
178
+ minItems: SiblingKeywords['minItems'];
179
+ /** The `maxItems` next to this reference (see {@link SiblingKeywords}). */
180
+ maxItems: SiblingKeywords['maxItems'];
181
+ /** The `uniqueItems` next to this reference (see {@link SiblingKeywords}). */
182
+ uniqueItems: SiblingKeywords['uniqueItems'];
183
+ /** The `properties` next to this reference (see {@link SiblingKeywords}). */
184
+ properties: SiblingKeywords['properties'];
185
+ /** The `required` next to this reference (see {@link SiblingKeywords}). */
186
+ required: SiblingKeywords['required'];
187
+ /** The `additionalProperties` next to this reference (see {@link SiblingKeywords}). */
188
+ additionalProperties: SiblingKeywords['additionalProperties'];
189
+ /** The `minProperties` next to this reference (see {@link SiblingKeywords}). */
190
+ minProperties: SiblingKeywords['minProperties'];
191
+ /** The `maxProperties` next to this reference (see {@link SiblingKeywords}). */
192
+ maxProperties: SiblingKeywords['maxProperties'];
129
193
  /**
130
194
  * Creates a new OAS reference instance.
131
195
  *
132
196
  * @param fields - Reference field data including refType and $ref
133
- * @param document - Discriminated document containing the referenced
134
- * component. For OAS, refs resolve through the document's components;
135
- * for GQL, through the document's registry (GQL only ever creates
136
- * schema refs).
197
+ * @param context - The parse context, or what `clone` passes in its place:
198
+ * the discriminated document containing the referenced component (for
199
+ * OAS, refs resolve through the document's components; for GQL, through
200
+ * the document's registry, as GQL only ever creates schema refs) and the
201
+ * current trail.
137
202
  */
138
- constructor(fields: RefFields<T>, context: ParseContextType);
203
+ constructor(fields: RefFields<T>, context: RefContext);
139
204
  /**
140
205
  * Type guard to check if this instance is a reference.
141
206
  *
@@ -146,7 +211,15 @@ export declare class OasRef<T extends OasRefData['refType']> extends OasBase {
146
211
  * Recursively resolves this reference to its final target component.
147
212
  *
148
213
  * Follows reference chains until reaching a non-reference component,
149
- * with protection against infinite loops.
214
+ * with protection against infinite loops. A schema reference returns the
215
+ * schema at this site: when the keywords next to it, or next to a
216
+ * reference on the chain ({@link SiblingKeywords}), change the target, a
217
+ * copy of the target with them applied. When they change nothing, the
218
+ * shared target itself. `resolveOnce()` applies no siblings.
219
+ *
220
+ * The result is shared, so do not modify it: the shared target is the
221
+ * model every reference to it sees, and a copy is built once, kept on
222
+ * this reference, and returned on every call.
150
223
  *
151
224
  * @param lookupsPerformed - Internal counter to prevent infinite recursion
152
225
  * @returns The resolved component
@@ -159,6 +232,11 @@ export declare class OasRef<T extends OasRefData['refType']> extends OasBase {
159
232
  * reads from `document.registry.schemas`.
160
233
  *
161
234
  * @returns Either the resolved component or another reference in the chain
235
+ * @throws {DanglingRefError} when the reference names nothing in the
236
+ * document (kept under `client.json` `system.danglingRefs: keep`),
237
+ * including a `$ref` with no name, such as `#/components/schemas/`
238
+ * @throws Error when it names a component of another kind, such as a
239
+ * `requestBody` ref to `#/components/schemas/…`
162
240
  */
163
241
  resolveOnce(): OasRef<T> | ResolvedRef<T>;
164
242
  toRefName(): RefName;
@@ -182,14 +260,55 @@ export declare class OasRef<T extends OasRefData['refType']> extends OasBase {
182
260
  * @throws Error when called on a non-schema ref.
183
261
  */
184
262
  traverse(path: SchemaPath): OasSchema | OasRef<'schema'>;
185
- get $ref(): string;
186
- get refType(): OasRefData['refType'];
187
263
  /**
188
- * Use-site nullability of this reference (see {@link RefFields.nullable}).
189
- * The getter exists on the prototype, so `'nullable' in ref` is always
190
- * true and the value-function nullable read picks it up uniformly.
264
+ * Whether this reference adds anything at its site: a use-site flag
265
+ * (`nullable`, `readOnly`, `writeOnly`) or another keyword next to it (see
266
+ * {@link RefFields}). {@link resolve} then returns a copy of the target with
267
+ * them applied, not the shared target.
191
268
  */
192
- get nullable(): boolean | undefined;
269
+ hasSiblings(): boolean;
270
+ /**
271
+ * A copy of this reference with what `ref` adds at its site merged in: its
272
+ * flags, and its keywords over this reference's own
273
+ * ({@link mergeSiblingKeywords}). It points at the same target. Each schema
274
+ * class's `clone` does the same for a schema, so one step along a chain of
275
+ * references can carry a site's keywords (`resolveSchemaRefOnce`). This
276
+ * reference does not change.
277
+ */
278
+ clone(ref?: OasRef<'schema'>): OasRef<T>;
279
+ /**
280
+ * Whether the keywords next to this reference change which values it
281
+ * accepts (`minLength` next to a string, `properties` next to an object),
282
+ * not only how it is described (`description`, `deprecated`, `x-*`). No
283
+ * shared model accepts the same values as such a site, so a generator
284
+ * applies these keywords where it renders the reference by name. See
285
+ * {@link changesValues}.
286
+ */
287
+ hasValueSiblings(): boolean;
288
+ /**
289
+ * The keywords next to this reference that {@link resolve} leaves out, by
290
+ * their names in the document: ones the target's type does not take
291
+ * (`minLength` next to an array), a `type` that disagrees, and values that
292
+ * do not fit. The parser cannot tell them while the reference is lazy, so a
293
+ * generator logs them when it renders the site. See {@link toSkippedSiblings}.
294
+ */
295
+ toSkippedSiblings(): string[];
296
+ /**
297
+ * Whether the value is `readOnly` at this site, as Forge reads it: on this
298
+ * reference (`{ allOf: [{ $ref }], readOnly: true }`), or on what it points
299
+ * to, through any chain of references. A `readOnly: false` does not undo
300
+ * another's `true`. `false` for a reference to anything but a schema.
301
+ *
302
+ * @param lookupsPerformed - Internal counter that stops a chain of references with no schema
303
+ */
304
+ isReadOnly(lookupsPerformed?: number): boolean;
305
+ /**
306
+ * Whether the value is `writeOnly` at this site: on this reference, or on
307
+ * what it points to, as {@link isReadOnly} reads `readOnly`.
308
+ *
309
+ * @param lookupsPerformed - Internal counter that stops a chain of references with no schema
310
+ */
311
+ isWriteOnly(lookupsPerformed?: number): boolean;
193
312
  /**
194
313
  * Returns the discriminated parsed document this ref resolves
195
314
  * through. OAS variant carries the parent `OasDocument`; GQL variant
@@ -197,7 +316,14 @@ export declare class OasRef<T extends OasRefData['refType']> extends OasBase {
197
316
  * schemas).
198
317
  */
199
318
  get document(): SkmtcParsedDocument;
319
+ /**
320
+ * The reference as JSON Schema. With `resolve`, the schema at this site,
321
+ * with the keywords next to the reference applied. Without it, only
322
+ * `{ $ref }`: the keywords next to the reference are not written yet
323
+ * (skmtc/skmtc#338).
324
+ */
200
325
  toJsonSchema({ resolve }: ToJsonSchemaOptions): OpenAPIV3.ReferenceObject | ResolvedRefJsonType<T>;
326
+ /** `{ $ref }` only, as {@link toJsonSchema} without `resolve` (skmtc/skmtc#338). */
201
327
  toJSON(): object;
202
328
  }
203
329
  /**
@@ -220,3 +346,4 @@ export type OasComponentType = OasSchema | OasResponse | OasParameter | OasExamp
220
346
  export type ResolvedRef<T extends OasRefData['refType']> = Extract<OasComponentType, {
221
347
  oasType: T;
222
348
  }>;
349
+ export {};