openapi-typesafe 1.0.0-rc.3 → 1.0.0-rc.5

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 (596) hide show
  1. package/CHANGELOG.md +1972 -0
  2. package/dist/adapters/node-file-system/file-claims.cjs +105 -0
  3. package/dist/adapters/node-file-system/file-claims.cjs.map +1 -0
  4. package/dist/adapters/node-file-system/file-claims.mjs +95 -0
  5. package/dist/adapters/node-file-system/file-claims.mjs.map +1 -0
  6. package/dist/adapters/node-file-system/file-identity.cjs +82 -0
  7. package/dist/adapters/node-file-system/file-identity.cjs.map +1 -0
  8. package/dist/adapters/node-file-system/file-identity.mjs +74 -0
  9. package/dist/adapters/node-file-system/file-identity.mjs.map +1 -0
  10. package/dist/adapters/node-file-system/node-file-system.cjs +97 -14
  11. package/dist/adapters/node-file-system/node-file-system.cjs.map +1 -1
  12. package/dist/adapters/node-file-system/node-file-system.mjs +97 -14
  13. package/dist/adapters/node-file-system/node-file-system.mjs.map +1 -1
  14. package/dist/adapters/pipe-safe-writer/pipe-safe-writer.cjs +19 -0
  15. package/dist/adapters/pipe-safe-writer/pipe-safe-writer.cjs.map +1 -0
  16. package/dist/adapters/pipe-safe-writer/pipe-safe-writer.mjs +17 -0
  17. package/dist/adapters/pipe-safe-writer/pipe-safe-writer.mjs.map +1 -0
  18. package/dist/adapters/redocly-loader/bundled-mapping-copies.cjs +48 -0
  19. package/dist/adapters/redocly-loader/bundled-mapping-copies.cjs.map +1 -0
  20. package/dist/adapters/redocly-loader/bundled-mapping-copies.mjs +45 -0
  21. package/dist/adapters/redocly-loader/bundled-mapping-copies.mjs.map +1 -0
  22. package/dist/adapters/redocly-loader/bundled-ref-repair.cjs +1 -1
  23. package/dist/adapters/redocly-loader/bundled-ref-repair.cjs.map +1 -1
  24. package/dist/adapters/redocly-loader/bundled-ref-repair.mjs +2 -2
  25. package/dist/adapters/redocly-loader/bundled-ref-repair.mjs.map +1 -1
  26. package/dist/adapters/redocly-loader/component-schemas.cjs +17 -0
  27. package/dist/adapters/redocly-loader/component-schemas.cjs.map +1 -0
  28. package/dist/adapters/redocly-loader/component-schemas.mjs +14 -0
  29. package/dist/adapters/redocly-loader/component-schemas.mjs.map +1 -0
  30. package/dist/adapters/redocly-loader/loaded-documents.cjs +28 -0
  31. package/dist/adapters/redocly-loader/loaded-documents.cjs.map +1 -0
  32. package/dist/adapters/redocly-loader/loaded-documents.mjs +21 -0
  33. package/dist/adapters/redocly-loader/loaded-documents.mjs.map +1 -0
  34. package/dist/adapters/redocly-loader/mapping-schema-names.cjs +22 -0
  35. package/dist/adapters/redocly-loader/mapping-schema-names.cjs.map +1 -0
  36. package/dist/adapters/redocly-loader/mapping-schema-names.mjs +20 -0
  37. package/dist/adapters/redocly-loader/mapping-schema-names.mjs.map +1 -0
  38. package/dist/adapters/redocly-loader/query-named-components.cjs +137 -0
  39. package/dist/adapters/redocly-loader/query-named-components.cjs.map +1 -0
  40. package/dist/adapters/redocly-loader/query-named-components.mjs +134 -0
  41. package/dist/adapters/redocly-loader/query-named-components.mjs.map +1 -0
  42. package/dist/adapters/redocly-loader/redocly-schema-loader.cjs +40 -29
  43. package/dist/adapters/redocly-loader/redocly-schema-loader.cjs.map +1 -1
  44. package/dist/adapters/redocly-loader/redocly-schema-loader.mjs +38 -27
  45. package/dist/adapters/redocly-loader/redocly-schema-loader.mjs.map +1 -1
  46. package/dist/adapters/redocly-loader/ref-access.cjs +45 -4
  47. package/dist/adapters/redocly-loader/ref-access.cjs.map +1 -1
  48. package/dist/adapters/redocly-loader/ref-access.mjs +45 -4
  49. package/dist/adapters/redocly-loader/ref-access.mjs.map +1 -1
  50. package/dist/adapters/redocly-loader/ref-holders.cjs +52 -10
  51. package/dist/adapters/redocly-loader/ref-holders.cjs.map +1 -1
  52. package/dist/adapters/redocly-loader/ref-holders.mjs +53 -12
  53. package/dist/adapters/redocly-loader/ref-holders.mjs.map +1 -1
  54. package/dist/adapters/redocly-loader/remote-body-limit.cjs +50 -0
  55. package/dist/adapters/redocly-loader/remote-body-limit.cjs.map +1 -0
  56. package/dist/adapters/redocly-loader/remote-body-limit.mjs +48 -0
  57. package/dist/adapters/redocly-loader/remote-body-limit.mjs.map +1 -0
  58. package/dist/adapters/redocly-loader/remote-fetch.cjs +40 -9
  59. package/dist/adapters/redocly-loader/remote-fetch.cjs.map +1 -1
  60. package/dist/adapters/redocly-loader/remote-fetch.mjs +40 -9
  61. package/dist/adapters/redocly-loader/remote-fetch.mjs.map +1 -1
  62. package/dist/adapters/redocly-loader/remote-node-limit.cjs +61 -0
  63. package/dist/adapters/redocly-loader/remote-node-limit.cjs.map +1 -0
  64. package/dist/adapters/redocly-loader/remote-node-limit.mjs +58 -0
  65. package/dist/adapters/redocly-loader/remote-node-limit.mjs.map +1 -0
  66. package/dist/adapters/redocly-loader/schema-load-errors.cjs +32 -8
  67. package/dist/adapters/redocly-loader/schema-load-errors.cjs.map +1 -1
  68. package/dist/adapters/redocly-loader/schema-load-errors.mjs +32 -9
  69. package/dist/adapters/redocly-loader/schema-load-errors.mjs.map +1 -1
  70. package/dist/adapters/redocly-loader/schema-source.cjs +18 -9
  71. package/dist/adapters/redocly-loader/schema-source.cjs.map +1 -1
  72. package/dist/adapters/redocly-loader/schema-source.mjs +20 -11
  73. package/dist/adapters/redocly-loader/schema-source.mjs.map +1 -1
  74. package/dist/adapters/redocly-loader/unsupported-keys.cjs +3 -5
  75. package/dist/adapters/redocly-loader/unsupported-keys.cjs.map +1 -1
  76. package/dist/adapters/redocly-loader/unsupported-keys.mjs +3 -5
  77. package/dist/adapters/redocly-loader/unsupported-keys.mjs.map +1 -1
  78. package/dist/adapters/terminal-logger/terminal-logger.cjs +10 -4
  79. package/dist/adapters/terminal-logger/terminal-logger.cjs.map +1 -1
  80. package/dist/adapters/terminal-logger/terminal-logger.mjs +10 -4
  81. package/dist/adapters/terminal-logger/terminal-logger.mjs.map +1 -1
  82. package/dist/api/default-ports.cjs +14 -2
  83. package/dist/api/default-ports.cjs.map +1 -1
  84. package/dist/api/default-ports.mjs +14 -2
  85. package/dist/api/default-ports.mjs.map +1 -1
  86. package/dist/api/discriminator-enum-parent.cjs +2 -2
  87. package/dist/api/discriminator-enum-parent.cjs.map +1 -1
  88. package/dist/api/discriminator-enum-parent.mjs +3 -3
  89. package/dist/api/discriminator-enum-parent.mjs.map +1 -1
  90. package/dist/api/discriminator-other-owners.cjs +5 -3
  91. package/dist/api/discriminator-other-owners.cjs.map +1 -1
  92. package/dist/api/discriminator-other-owners.mjs +5 -3
  93. package/dist/api/discriminator-other-owners.mjs.map +1 -1
  94. package/dist/api/discriminator-patch.cjs +5 -1
  95. package/dist/api/discriminator-patch.cjs.map +1 -1
  96. package/dist/api/discriminator-patch.mjs +5 -1
  97. package/dist/api/discriminator-patch.mjs.map +1 -1
  98. package/dist/api/discriminator-scan.cjs +15 -8
  99. package/dist/api/discriminator-scan.cjs.map +1 -1
  100. package/dist/api/discriminator-scan.mjs +15 -8
  101. package/dist/api/discriminator-scan.mjs.map +1 -1
  102. package/dist/api/document-refs.cjs +16 -1
  103. package/dist/api/document-refs.cjs.map +1 -1
  104. package/dist/api/document-refs.mjs +16 -1
  105. package/dist/api/document-refs.mjs.map +1 -1
  106. package/dist/api/document-run.cjs +6 -12
  107. package/dist/api/document-run.cjs.map +1 -1
  108. package/dist/api/document-run.mjs +6 -12
  109. package/dist/api/document-run.mjs.map +1 -1
  110. package/dist/api/legacy-utils.cjs.map +1 -1
  111. package/dist/api/legacy-utils.mjs.map +1 -1
  112. package/dist/api/openapi-ts.cjs +9 -6
  113. package/dist/api/openapi-ts.cjs.map +1 -1
  114. package/dist/api/openapi-ts.mjs +10 -8
  115. package/dist/api/openapi-ts.mjs.map +1 -1
  116. package/dist/api/ref-limit-options.cjs +63 -0
  117. package/dist/api/ref-limit-options.cjs.map +1 -0
  118. package/dist/api/ref-limit-options.mjs +57 -0
  119. package/dist/api/ref-limit-options.mjs.map +1 -0
  120. package/dist/api/schema-callbacks.cjs +36 -12
  121. package/dist/api/schema-callbacks.cjs.map +1 -1
  122. package/dist/api/schema-callbacks.mjs +36 -12
  123. package/dist/api/schema-callbacks.mjs.map +1 -1
  124. package/dist/api/transform-context.cjs +7 -3
  125. package/dist/api/transform-context.cjs.map +1 -1
  126. package/dist/api/transform-context.mjs +7 -3
  127. package/dist/api/transform-context.mjs.map +1 -1
  128. package/dist/api/transform-schema.cjs +47 -10
  129. package/dist/api/transform-schema.cjs.map +1 -1
  130. package/dist/api/transform-schema.mjs +48 -11
  131. package/dist/api/transform-schema.mjs.map +1 -1
  132. package/dist/application/print/text-writer.cjs +10 -3
  133. package/dist/application/print/text-writer.cjs.map +1 -1
  134. package/dist/application/print/text-writer.mjs +10 -3
  135. package/dist/application/print/text-writer.mjs.map +1 -1
  136. package/dist/application/stack-overflow.cjs +2 -1
  137. package/dist/application/stack-overflow.cjs.map +1 -1
  138. package/dist/application/stack-overflow.mjs +2 -1
  139. package/dist/application/stack-overflow.mjs.map +1 -1
  140. package/dist/application/transform/declared-value-types.cjs +36 -0
  141. package/dist/application/transform/declared-value-types.cjs.map +1 -0
  142. package/dist/application/transform/declared-value-types.mjs +34 -0
  143. package/dist/application/transform/declared-value-types.mjs.map +1 -0
  144. package/dist/application/transform/document/components.cjs +1 -1
  145. package/dist/application/transform/document/components.cjs.map +1 -1
  146. package/dist/application/transform/document/components.mjs +2 -2
  147. package/dist/application/transform/document/components.mjs.map +1 -1
  148. package/dist/application/transform/document/declared-type-names.cjs +23 -0
  149. package/dist/application/transform/document/declared-type-names.cjs.map +1 -0
  150. package/dist/application/transform/document/declared-type-names.mjs +20 -0
  151. package/dist/application/transform/document/declared-type-names.mjs.map +1 -0
  152. package/dist/application/transform/document/defs-root.cjs +1 -1
  153. package/dist/application/transform/document/defs-root.cjs.map +1 -1
  154. package/dist/application/transform/document/defs-root.mjs +2 -2
  155. package/dist/application/transform/document/defs-root.mjs.map +1 -1
  156. package/dist/application/transform/document/document.cjs +7 -2
  157. package/dist/application/transform/document/document.cjs.map +1 -1
  158. package/dist/application/transform/document/document.mjs +6 -3
  159. package/dist/application/transform/document/document.mjs.map +1 -1
  160. package/dist/application/transform/document/enum-names-given-back.cjs +62 -0
  161. package/dist/application/transform/document/enum-names-given-back.cjs.map +1 -0
  162. package/dist/application/transform/document/enum-names-given-back.mjs +58 -0
  163. package/dist/application/transform/document/enum-names-given-back.mjs.map +1 -0
  164. package/dist/application/transform/document/exploded-query-values.cjs +63 -0
  165. package/dist/application/transform/document/exploded-query-values.cjs.map +1 -0
  166. package/dist/application/transform/document/exploded-query-values.mjs +59 -0
  167. package/dist/application/transform/document/exploded-query-values.mjs.map +1 -0
  168. package/dist/application/transform/document/global-type-references.cjs +1 -0
  169. package/dist/application/transform/document/global-type-references.cjs.map +1 -1
  170. package/dist/application/transform/document/global-type-references.mjs +1 -1
  171. package/dist/application/transform/document/global-type-references.mjs.map +1 -1
  172. package/dist/application/transform/document/header.cjs +11 -3
  173. package/dist/application/transform/document/header.cjs.map +1 -1
  174. package/dist/application/transform/document/header.mjs +10 -2
  175. package/dist/application/transform/document/header.mjs.map +1 -1
  176. package/dist/application/transform/document/media-type.cjs +2 -2
  177. package/dist/application/transform/document/media-type.cjs.map +1 -1
  178. package/dist/application/transform/document/media-type.mjs +3 -3
  179. package/dist/application/transform/document/media-type.mjs.map +1 -1
  180. package/dist/application/transform/document/operation-keys-written.cjs +26 -0
  181. package/dist/application/transform/document/operation-keys-written.cjs.map +1 -0
  182. package/dist/application/transform/document/operation-keys-written.mjs +24 -0
  183. package/dist/application/transform/document/operation-keys-written.mjs.map +1 -0
  184. package/dist/application/transform/document/operation.cjs +1 -1
  185. package/dist/application/transform/document/operation.cjs.map +1 -1
  186. package/dist/application/transform/document/operation.mjs +2 -2
  187. package/dist/application/transform/document/operation.mjs.map +1 -1
  188. package/dist/application/transform/document/parameter-entries.cjs +34 -0
  189. package/dist/application/transform/document/parameter-entries.cjs.map +1 -0
  190. package/dist/application/transform/document/parameter-entries.mjs +30 -0
  191. package/dist/application/transform/document/parameter-entries.mjs.map +1 -0
  192. package/dist/application/transform/document/parameter.cjs +12 -4
  193. package/dist/application/transform/document/parameter.cjs.map +1 -1
  194. package/dist/application/transform/document/parameter.mjs +13 -5
  195. package/dist/application/transform/document/parameter.mjs.map +1 -1
  196. package/dist/application/transform/document/parameters.cjs +29 -34
  197. package/dist/application/transform/document/parameters.cjs.map +1 -1
  198. package/dist/application/transform/document/parameters.mjs +29 -34
  199. package/dist/application/transform/document/parameters.mjs.map +1 -1
  200. package/dist/application/transform/document/path-item.cjs +15 -17
  201. package/dist/application/transform/document/path-item.cjs.map +1 -1
  202. package/dist/application/transform/document/path-item.mjs +15 -19
  203. package/dist/application/transform/document/path-item.mjs.map +1 -1
  204. package/dist/application/transform/document/path-template-key.cjs +84 -0
  205. package/dist/application/transform/document/path-template-key.cjs.map +1 -0
  206. package/dist/application/transform/document/path-template-key.mjs +79 -0
  207. package/dist/application/transform/document/path-template-key.mjs.map +1 -0
  208. package/dist/application/transform/document/path-template-refs.cjs +70 -0
  209. package/dist/application/transform/document/path-template-refs.cjs.map +1 -0
  210. package/dist/application/transform/document/path-template-refs.mjs +67 -0
  211. package/dist/application/transform/document/path-template-refs.mjs.map +1 -0
  212. package/dist/application/transform/document/paths-enum.cjs +8 -6
  213. package/dist/application/transform/document/paths-enum.cjs.map +1 -1
  214. package/dist/application/transform/document/paths-enum.mjs +8 -7
  215. package/dist/application/transform/document/paths-enum.mjs.map +1 -1
  216. package/dist/application/transform/document/paths.cjs +43 -67
  217. package/dist/application/transform/document/paths.cjs.map +1 -1
  218. package/dist/application/transform/document/paths.mjs +42 -68
  219. package/dist/application/transform/document/paths.mjs.map +1 -1
  220. package/dist/application/transform/document/referenced-parameter.cjs +80 -0
  221. package/dist/application/transform/document/referenced-parameter.cjs.map +1 -0
  222. package/dist/application/transform/document/referenced-parameter.mjs +78 -0
  223. package/dist/application/transform/document/referenced-parameter.mjs.map +1 -0
  224. package/dist/application/transform/document/request-body.cjs +1 -1
  225. package/dist/application/transform/document/request-body.cjs.map +1 -1
  226. package/dist/application/transform/document/request-body.mjs +2 -2
  227. package/dist/application/transform/document/request-body.mjs.map +1 -1
  228. package/dist/application/transform/document/response.cjs +2 -2
  229. package/dist/application/transform/document/response.cjs.map +1 -1
  230. package/dist/application/transform/document/response.mjs +3 -3
  231. package/dist/application/transform/document/response.mjs.map +1 -1
  232. package/dist/application/transform/document/responses.cjs +1 -1
  233. package/dist/application/transform/document/responses.cjs.map +1 -1
  234. package/dist/application/transform/document/responses.mjs +2 -2
  235. package/dist/application/transform/document/responses.mjs.map +1 -1
  236. package/dist/application/transform/document/root-type-aliases.cjs +8 -23
  237. package/dist/application/transform/document/root-type-aliases.cjs.map +1 -1
  238. package/dist/application/transform/document/root-type-aliases.mjs +8 -24
  239. package/dist/application/transform/document/root-type-aliases.mjs.map +1 -1
  240. package/dist/application/transform/document/type-resolution.cjs +3 -1
  241. package/dist/application/transform/document/type-resolution.cjs.map +1 -1
  242. package/dist/application/transform/document/type-resolution.mjs +3 -1
  243. package/dist/application/transform/document/type-resolution.mjs.map +1 -1
  244. package/dist/application/transform/document/webhooks.cjs +10 -3
  245. package/dist/application/transform/document/webhooks.cjs.map +1 -1
  246. package/dist/application/transform/document/webhooks.mjs +10 -3
  247. package/dist/application/transform/document/webhooks.mjs.map +1 -1
  248. package/dist/application/transform/footer/document-footer.cjs +16 -5
  249. package/dist/application/transform/footer/document-footer.cjs.map +1 -1
  250. package/dist/application/transform/footer/document-footer.mjs +16 -5
  251. package/dist/application/transform/footer/document-footer.mjs.map +1 -1
  252. package/dist/application/transform/footer/enum-name-claims.cjs +48 -0
  253. package/dist/application/transform/footer/enum-name-claims.cjs.map +1 -0
  254. package/dist/application/transform/footer/enum-name-claims.mjs +46 -0
  255. package/dist/application/transform/footer/enum-name-claims.mjs.map +1 -0
  256. package/dist/application/transform/footer/operation-keys.cjs +23 -0
  257. package/dist/application/transform/footer/operation-keys.cjs.map +1 -0
  258. package/dist/application/transform/footer/operation-keys.mjs +21 -0
  259. package/dist/application/transform/footer/operation-keys.mjs.map +1 -0
  260. package/dist/application/transform/footer/type-evaluation.cjs +4 -4
  261. package/dist/application/transform/footer/type-evaluation.cjs.map +1 -1
  262. package/dist/application/transform/footer/type-evaluation.mjs +4 -4
  263. package/dist/application/transform/footer/type-evaluation.mjs.map +1 -1
  264. package/dist/application/transform/helper-types.cjs +3 -3
  265. package/dist/application/transform/helper-types.cjs.map +1 -1
  266. package/dist/application/transform/helper-types.mjs +3 -3
  267. package/dist/application/transform/helper-types.mjs.map +1 -1
  268. package/dist/application/transform/numbered-names.cjs +9 -0
  269. package/dist/application/transform/numbered-names.cjs.map +1 -1
  270. package/dist/application/transform/numbered-names.mjs +9 -1
  271. package/dist/application/transform/numbered-names.mjs.map +1 -1
  272. package/dist/application/transform/ref-pointer/generated-location.cjs +5 -5
  273. package/dist/application/transform/ref-pointer/generated-location.cjs.map +1 -1
  274. package/dist/application/transform/ref-pointer/generated-location.mjs +3 -3
  275. package/dist/application/transform/ref-pointer/generated-location.mjs.map +1 -1
  276. package/dist/application/transform/ref-pointer/generated-shape.cjs +47 -66
  277. package/dist/application/transform/ref-pointer/generated-shape.cjs.map +1 -1
  278. package/dist/application/transform/ref-pointer/generated-shape.mjs +36 -50
  279. package/dist/application/transform/ref-pointer/generated-shape.mjs.map +1 -1
  280. package/dist/application/transform/ref-pointer/inline-cycles.cjs +2 -2
  281. package/dist/application/transform/ref-pointer/inline-cycles.cjs.map +1 -1
  282. package/dist/application/transform/ref-pointer/inline-cycles.mjs +1 -1
  283. package/dist/application/transform/ref-pointer/inline-cycles.mjs.map +1 -1
  284. package/dist/application/transform/ref-pointer/located-node.cjs +23 -0
  285. package/dist/application/transform/ref-pointer/located-node.cjs.map +1 -0
  286. package/dist/application/transform/ref-pointer/located-node.mjs +18 -0
  287. package/dist/application/transform/ref-pointer/located-node.mjs.map +1 -0
  288. package/dist/application/transform/ref-pointer/original-index.cjs +68 -13
  289. package/dist/application/transform/ref-pointer/original-index.cjs.map +1 -1
  290. package/dist/application/transform/ref-pointer/original-index.mjs +70 -15
  291. package/dist/application/transform/ref-pointer/original-index.mjs.map +1 -1
  292. package/dist/application/transform/ref-pointer/pointer-type.cjs +2 -2
  293. package/dist/application/transform/ref-pointer/pointer-type.cjs.map +1 -1
  294. package/dist/application/transform/ref-pointer/pointer-type.mjs +1 -1
  295. package/dist/application/transform/ref-pointer/pointer-type.mjs.map +1 -1
  296. package/dist/application/transform/ref-pointer/pointer-walk.cjs +54 -13
  297. package/dist/application/transform/ref-pointer/pointer-walk.cjs.map +1 -1
  298. package/dist/application/transform/ref-pointer/pointer-walk.mjs +46 -7
  299. package/dist/application/transform/ref-pointer/pointer-walk.mjs.map +1 -1
  300. package/dist/application/transform/ref-pointer/property-shape.cjs +52 -0
  301. package/dist/application/transform/ref-pointer/property-shape.cjs.map +1 -0
  302. package/dist/application/transform/ref-pointer/property-shape.mjs +45 -0
  303. package/dist/application/transform/ref-pointer/property-shape.mjs.map +1 -0
  304. package/dist/application/transform/ref-pointer/typed-walk.cjs +79 -21
  305. package/dist/application/transform/ref-pointer/typed-walk.cjs.map +1 -1
  306. package/dist/application/transform/ref-pointer/typed-walk.mjs +76 -18
  307. package/dist/application/transform/ref-pointer/typed-walk.mjs.map +1 -1
  308. package/dist/application/transform/ref-type.cjs +2 -1
  309. package/dist/application/transform/ref-type.cjs.map +1 -1
  310. package/dist/application/transform/ref-type.mjs +2 -1
  311. package/dist/application/transform/ref-type.mjs.map +1 -1
  312. package/dist/application/transform/schema/access-flags.cjs.map +1 -1
  313. package/dist/application/transform/schema/access-flags.mjs.map +1 -1
  314. package/dist/application/transform/schema/composition-type.cjs +1 -1
  315. package/dist/application/transform/schema/composition-type.cjs.map +1 -1
  316. package/dist/application/transform/schema/composition-type.mjs +2 -2
  317. package/dist/application/transform/schema/composition-type.mjs.map +1 -1
  318. package/dist/application/transform/schema/enum-rule.cjs +1 -1
  319. package/dist/application/transform/schema/enum-rule.cjs.map +1 -1
  320. package/dist/application/transform/schema/enum-rule.mjs +2 -2
  321. package/dist/application/transform/schema/enum-rule.mjs.map +1 -1
  322. package/dist/application/transform/schema/index-signature-type.cjs +21 -0
  323. package/dist/application/transform/schema/index-signature-type.cjs.map +1 -0
  324. package/dist/application/transform/schema/index-signature-type.mjs +19 -0
  325. package/dist/application/transform/schema/index-signature-type.mjs.map +1 -0
  326. package/dist/application/transform/schema/input-location.cjs +23 -0
  327. package/dist/application/transform/schema/input-location.cjs.map +1 -0
  328. package/dist/application/transform/schema/input-location.mjs +21 -0
  329. package/dist/application/transform/schema/input-location.mjs.map +1 -0
  330. package/dist/application/transform/schema/object-type.cjs +18 -8
  331. package/dist/application/transform/schema/object-type.cjs.map +1 -1
  332. package/dist/application/transform/schema/object-type.mjs +19 -9
  333. package/dist/application/transform/schema/object-type.mjs.map +1 -1
  334. package/dist/application/transform/schema/ref-siblings.cjs +47 -0
  335. package/dist/application/transform/schema/ref-siblings.cjs.map +1 -0
  336. package/dist/application/transform/schema/ref-siblings.mjs +45 -0
  337. package/dist/application/transform/schema/ref-siblings.mjs.map +1 -0
  338. package/dist/application/transform/schema/schema-transform.cjs +6 -3
  339. package/dist/application/transform/schema/schema-transform.cjs.map +1 -1
  340. package/dist/application/transform/schema/schema-transform.mjs +6 -3
  341. package/dist/application/transform/schema/schema-transform.mjs.map +1 -1
  342. package/dist/application/transform/schema/unevaluated-properties.cjs +2 -30
  343. package/dist/application/transform/schema/unevaluated-properties.cjs.map +1 -1
  344. package/dist/application/transform/schema/unevaluated-properties.mjs +3 -31
  345. package/dist/application/transform/schema/unevaluated-properties.mjs.map +1 -1
  346. package/dist/application/transform/schema-comment.cjs +5 -1
  347. package/dist/application/transform/schema-comment.cjs.map +1 -1
  348. package/dist/application/transform/schema-comment.mjs +5 -1
  349. package/dist/application/transform/schema-comment.mjs.map +1 -1
  350. package/dist/cli/api-logger.cjs +13 -0
  351. package/dist/cli/api-logger.cjs.map +1 -0
  352. package/dist/cli/api-logger.mjs +11 -0
  353. package/dist/cli/api-logger.mjs.map +1 -0
  354. package/dist/cli/api-settings.cjs +57 -9
  355. package/dist/cli/api-settings.cjs.map +1 -1
  356. package/dist/cli/api-settings.mjs +56 -11
  357. package/dist/cli/api-settings.mjs.map +1 -1
  358. package/dist/cli/api-writes.cjs +72 -0
  359. package/dist/cli/api-writes.cjs.map +1 -0
  360. package/dist/cli/api-writes.mjs +69 -0
  361. package/dist/cli/api-writes.mjs.map +1 -0
  362. package/dist/cli/cli-arguments.cjs +51 -11
  363. package/dist/cli/cli-arguments.cjs.map +1 -1
  364. package/dist/cli/cli-arguments.mjs +51 -11
  365. package/dist/cli/cli-arguments.mjs.map +1 -1
  366. package/dist/cli/cli-errors.cjs +29 -1
  367. package/dist/cli/cli-errors.cjs.map +1 -1
  368. package/dist/cli/cli-errors.mjs +29 -2
  369. package/dist/cli/cli-errors.mjs.map +1 -1
  370. package/dist/cli/cli-output.cjs +111 -4
  371. package/dist/cli/cli-output.cjs.map +1 -1
  372. package/dist/cli/cli-output.mjs +104 -5
  373. package/dist/cli/cli-output.mjs.map +1 -1
  374. package/dist/cli/main.cjs +13 -3
  375. package/dist/cli/main.cjs.map +1 -1
  376. package/dist/cli/main.mjs +14 -4
  377. package/dist/cli/main.mjs.map +1 -1
  378. package/dist/cli/redocly-apis.cjs +94 -37
  379. package/dist/cli/redocly-apis.cjs.map +1 -1
  380. package/dist/cli/redocly-apis.mjs +99 -42
  381. package/dist/cli/redocly-apis.mjs.map +1 -1
  382. package/dist/cli/ref-limits.cjs +15 -1
  383. package/dist/cli/ref-limits.cjs.map +1 -1
  384. package/dist/cli/ref-limits.mjs +15 -2
  385. package/dist/cli/ref-limits.mjs.map +1 -1
  386. package/dist/cli/run-cli.cjs +37 -14
  387. package/dist/cli/run-cli.cjs.map +1 -1
  388. package/dist/cli/run-cli.mjs +39 -16
  389. package/dist/cli/run-cli.mjs.map +1 -1
  390. package/dist/domain/append-all.cjs +10 -0
  391. package/dist/domain/append-all.cjs.map +1 -0
  392. package/dist/domain/append-all.mjs +8 -0
  393. package/dist/domain/append-all.mjs.map +1 -0
  394. package/dist/domain/cause-secrets.cjs +52 -0
  395. package/dist/domain/cause-secrets.cjs.map +1 -0
  396. package/dist/domain/cause-secrets.mjs +50 -0
  397. package/dist/domain/cause-secrets.mjs.map +1 -0
  398. package/dist/domain/errors.cjs +11 -3
  399. package/dist/domain/errors.cjs.map +1 -1
  400. package/dist/domain/errors.mjs +11 -3
  401. package/dist/domain/errors.mjs.map +1 -1
  402. package/dist/domain/ir/identifier-text.cjs.map +1 -1
  403. package/dist/domain/ir/identifier-text.mjs +1 -1
  404. package/dist/domain/ir/identifier-text.mjs.map +1 -1
  405. package/dist/domain/ir/ir-shape.cjs +187 -0
  406. package/dist/domain/ir/ir-shape.cjs.map +1 -0
  407. package/dist/domain/ir/ir-shape.mjs +184 -0
  408. package/dist/domain/ir/ir-shape.mjs.map +1 -0
  409. package/dist/domain/ir/newer-identifier-ranges.cjs +182 -29
  410. package/dist/domain/ir/newer-identifier-ranges.cjs.map +1 -1
  411. package/dist/domain/ir/newer-identifier-ranges.mjs +182 -29
  412. package/dist/domain/ir/newer-identifier-ranges.mjs.map +1 -1
  413. package/dist/domain/location-text.cjs +9 -0
  414. package/dist/domain/location-text.cjs.map +1 -0
  415. package/dist/domain/location-text.mjs +7 -0
  416. package/dist/domain/location-text.mjs.map +1 -0
  417. package/dist/domain/openapi/alias-expansion.cjs +3 -1
  418. package/dist/domain/openapi/alias-expansion.cjs.map +1 -1
  419. package/dist/domain/openapi/alias-expansion.mjs +3 -1
  420. package/dist/domain/openapi/alias-expansion.mjs.map +1 -1
  421. package/dist/domain/openapi/discriminated-union.cjs +3 -3
  422. package/dist/domain/openapi/discriminated-union.cjs.map +1 -1
  423. package/dist/domain/openapi/discriminated-union.mjs +4 -4
  424. package/dist/domain/openapi/discriminated-union.mjs.map +1 -1
  425. package/dist/domain/openapi/discriminator-conflicts.cjs +10 -6
  426. package/dist/domain/openapi/discriminator-conflicts.cjs.map +1 -1
  427. package/dist/domain/openapi/discriminator-conflicts.mjs +11 -7
  428. package/dist/domain/openapi/discriminator-conflicts.mjs.map +1 -1
  429. package/dist/domain/openapi/document-places.cjs +55 -0
  430. package/dist/domain/openapi/document-places.cjs.map +1 -0
  431. package/dist/domain/openapi/document-places.mjs +53 -0
  432. package/dist/domain/openapi/document-places.mjs.map +1 -0
  433. package/dist/domain/openapi/json-pointer.cjs +43 -1
  434. package/dist/domain/openapi/json-pointer.cjs.map +1 -1
  435. package/dist/domain/openapi/json-pointer.mjs +40 -2
  436. package/dist/domain/openapi/json-pointer.mjs.map +1 -1
  437. package/dist/domain/openapi/schema-dialect.cjs +15 -0
  438. package/dist/domain/openapi/schema-dialect.cjs.map +1 -0
  439. package/dist/domain/openapi/schema-dialect.mjs +12 -0
  440. package/dist/domain/openapi/schema-dialect.mjs.map +1 -0
  441. package/dist/domain/openapi/unsupported-features.cjs +1 -1
  442. package/dist/domain/openapi/unsupported-features.cjs.map +1 -1
  443. package/dist/domain/openapi/unsupported-features.mjs +2 -2
  444. package/dist/domain/openapi/unsupported-features.mjs.map +1 -1
  445. package/dist/domain/output-fixes.cjs +20 -0
  446. package/dist/domain/output-fixes.cjs.map +1 -1
  447. package/dist/domain/output-fixes.mjs +20 -0
  448. package/dist/domain/output-fixes.mjs.map +1 -1
  449. package/dist/domain/terminal-text.cjs +31 -0
  450. package/dist/domain/terminal-text.cjs.map +1 -0
  451. package/dist/domain/terminal-text.mjs +29 -0
  452. package/dist/domain/terminal-text.mjs.map +1 -0
  453. package/dist/domain/url-secrets.cjs +48 -0
  454. package/dist/domain/url-secrets.cjs.map +1 -0
  455. package/dist/domain/url-secrets.mjs +45 -0
  456. package/dist/domain/url-secrets.mjs.map +1 -0
  457. package/dist/domain/warnings.cjs +1 -0
  458. package/dist/domain/warnings.cjs.map +1 -1
  459. package/dist/domain/warnings.mjs +1 -0
  460. package/dist/domain/warnings.mjs.map +1 -1
  461. package/dist/index.d.cts +46 -20
  462. package/dist/index.d.mts +46 -20
  463. package/dist/index.d.ts +46 -20
  464. package/package.json +4 -5
  465. package/src/adapters/node-file-system/file-claims.ts +138 -0
  466. package/src/adapters/node-file-system/file-identity.ts +137 -0
  467. package/src/adapters/node-file-system/node-file-system.ts +158 -18
  468. package/src/adapters/pipe-safe-writer/pipe-safe-writer.ts +29 -0
  469. package/src/adapters/redocly-loader/bundled-mapping-copies.ts +60 -0
  470. package/src/adapters/redocly-loader/bundled-ref-repair.ts +2 -2
  471. package/src/adapters/redocly-loader/component-schemas.ts +19 -0
  472. package/src/adapters/redocly-loader/loaded-documents.ts +46 -0
  473. package/src/adapters/redocly-loader/mapping-schema-names.ts +25 -0
  474. package/src/adapters/redocly-loader/query-named-components.ts +201 -0
  475. package/src/adapters/redocly-loader/redocly-schema-loader.ts +64 -38
  476. package/src/adapters/redocly-loader/ref-access.ts +51 -4
  477. package/src/adapters/redocly-loader/ref-holders.ts +76 -15
  478. package/src/adapters/redocly-loader/remote-body-limit.ts +66 -0
  479. package/src/adapters/redocly-loader/remote-fetch.ts +85 -13
  480. package/src/adapters/redocly-loader/remote-node-limit.ts +102 -0
  481. package/src/adapters/redocly-loader/schema-load-errors.ts +52 -13
  482. package/src/adapters/redocly-loader/schema-source.ts +35 -11
  483. package/src/adapters/redocly-loader/unsupported-keys.ts +3 -7
  484. package/src/adapters/terminal-logger/terminal-logger.ts +17 -6
  485. package/src/api/default-ports.ts +33 -4
  486. package/src/api/discriminator-enum-parent.ts +3 -3
  487. package/src/api/discriminator-other-owners.ts +5 -3
  488. package/src/api/discriminator-patch.ts +5 -1
  489. package/src/api/discriminator-scan.ts +16 -8
  490. package/src/api/document-refs.ts +29 -1
  491. package/src/api/document-run.ts +10 -19
  492. package/src/api/legacy-utils.ts +5 -1
  493. package/src/api/openapi-ts.ts +26 -8
  494. package/src/api/ref-limit-options.ts +76 -0
  495. package/src/api/run-context.ts +3 -0
  496. package/src/api/schema-callbacks.ts +60 -17
  497. package/src/api/transform-context.ts +7 -3
  498. package/src/api/transform-schema.ts +79 -12
  499. package/src/application/ports/file-system.ts +47 -0
  500. package/src/application/ports/schema-loader.ts +11 -1
  501. package/src/application/print/text-writer.ts +10 -3
  502. package/src/application/stack-overflow.ts +9 -5
  503. package/src/application/transform/declared-value-types.ts +42 -0
  504. package/src/application/transform/document/components.ts +2 -2
  505. package/src/application/transform/document/declared-type-names.ts +36 -0
  506. package/src/application/transform/document/defs-root.ts +2 -2
  507. package/src/application/transform/document/document.ts +8 -5
  508. package/src/application/transform/document/enum-names-given-back.ts +91 -0
  509. package/src/application/transform/document/exploded-query-values.ts +88 -0
  510. package/src/application/transform/document/global-type-references.ts +1 -1
  511. package/src/application/transform/document/header.ts +25 -5
  512. package/src/application/transform/document/media-type.ts +4 -3
  513. package/src/application/transform/document/operation-keys-written.ts +27 -0
  514. package/src/application/transform/document/operation.ts +2 -2
  515. package/src/application/transform/document/parameter-entries.ts +70 -0
  516. package/src/application/transform/document/parameter.ts +21 -9
  517. package/src/application/transform/document/parameters.ts +56 -66
  518. package/src/application/transform/document/path-item.ts +16 -34
  519. package/src/application/transform/document/path-template-key.ts +152 -0
  520. package/src/application/transform/document/path-template-refs.ts +106 -0
  521. package/src/application/transform/document/paths-enum.ts +24 -10
  522. package/src/application/transform/document/paths.ts +59 -125
  523. package/src/application/transform/document/referenced-parameter.ts +146 -0
  524. package/src/application/transform/document/request-body.ts +2 -2
  525. package/src/application/transform/document/response.ts +3 -3
  526. package/src/application/transform/document/responses.ts +2 -2
  527. package/src/application/transform/document/root-type-aliases.ts +17 -38
  528. package/src/application/transform/document/type-resolution.ts +2 -1
  529. package/src/application/transform/document/webhooks.ts +19 -6
  530. package/src/application/transform/footer/document-footer.ts +36 -9
  531. package/src/application/transform/footer/enum-name-claims.ts +62 -0
  532. package/src/application/transform/footer/operation-keys.ts +28 -0
  533. package/src/application/transform/footer/type-evaluation.ts +4 -4
  534. package/src/application/transform/helper-types.ts +8 -7
  535. package/src/application/transform/numbered-names.ts +15 -0
  536. package/src/application/transform/ref-pointer/generated-location.ts +3 -3
  537. package/src/application/transform/ref-pointer/generated-shape.ts +67 -78
  538. package/src/application/transform/ref-pointer/inline-cycles.ts +1 -1
  539. package/src/application/transform/ref-pointer/located-node.ts +38 -0
  540. package/src/application/transform/ref-pointer/original-index.ts +100 -17
  541. package/src/application/transform/ref-pointer/pointer-type.ts +1 -1
  542. package/src/application/transform/ref-pointer/pointer-walk.ts +82 -8
  543. package/src/application/transform/ref-pointer/property-shape.ts +97 -0
  544. package/src/application/transform/ref-pointer/typed-walk.ts +117 -25
  545. package/src/application/transform/ref-type.ts +2 -1
  546. package/src/application/transform/schema/access-flags.ts +5 -2
  547. package/src/application/transform/schema/composition-type.ts +2 -2
  548. package/src/application/transform/schema/enum-rule.ts +6 -2
  549. package/src/application/transform/schema/index-signature-type.ts +31 -0
  550. package/src/application/transform/schema/input-location.ts +35 -0
  551. package/src/application/transform/schema/object-type.ts +22 -12
  552. package/src/application/transform/schema/ref-siblings.ts +76 -0
  553. package/src/application/transform/schema/schema-context.ts +3 -0
  554. package/src/application/transform/schema/schema-transform.ts +6 -3
  555. package/src/application/transform/schema/unevaluated-properties.ts +4 -44
  556. package/src/application/transform/schema-comment.ts +5 -1
  557. package/src/application/transform/transform-context.ts +5 -0
  558. package/src/cli/api-logger.ts +17 -0
  559. package/src/cli/api-settings.ts +80 -13
  560. package/src/cli/api-writes.ts +117 -0
  561. package/src/cli/cli-arguments.ts +90 -14
  562. package/src/cli/cli-dependencies.ts +26 -4
  563. package/src/cli/cli-errors.ts +42 -1
  564. package/src/cli/cli-output.ts +195 -15
  565. package/src/cli/main.ts +14 -5
  566. package/src/cli/redocly-apis.ts +177 -52
  567. package/src/cli/ref-limits.ts +21 -2
  568. package/src/cli/run-cli.ts +76 -15
  569. package/src/domain/append-all.ts +10 -0
  570. package/src/domain/cause-secrets.ts +86 -0
  571. package/src/domain/errors.ts +16 -5
  572. package/src/domain/ir/identifier-text.ts +6 -5
  573. package/src/domain/ir/ir-shape.ts +299 -0
  574. package/src/domain/ir/newer-identifier-ranges.ts +183 -30
  575. package/src/domain/location-text.ts +12 -0
  576. package/src/domain/openapi/alias-expansion.ts +4 -1
  577. package/src/domain/openapi/discriminated-union.ts +6 -4
  578. package/src/domain/openapi/discriminator-conflicts.ts +21 -7
  579. package/src/domain/openapi/document-object.ts +2 -0
  580. package/src/domain/openapi/document-places.ts +78 -0
  581. package/src/domain/openapi/json-pointer.ts +96 -7
  582. package/src/domain/openapi/schema-dialect.ts +22 -0
  583. package/src/domain/openapi/unsupported-features.ts +2 -2
  584. package/src/domain/output-fixes.ts +28 -2
  585. package/src/domain/terminal-text.ts +44 -0
  586. package/src/domain/url-secrets.ts +72 -0
  587. package/src/domain/warnings.ts +1 -0
  588. package/src/types/generator-options.ts +1 -1
  589. package/dist/cli/main.d.cts +0 -2
  590. package/dist/cli/main.d.mts +0 -2
  591. package/dist/cli/main.d.ts +0 -2
  592. package/dist/domain/url-credentials.cjs +0 -10
  593. package/dist/domain/url-credentials.cjs.map +0 -1
  594. package/dist/domain/url-credentials.mjs +0 -8
  595. package/dist/domain/url-credentials.mjs.map +0 -1
  596. package/src/domain/url-credentials.ts +0 -18
@@ -12,12 +12,14 @@ import type {
12
12
  EnumValuesRequest,
13
13
  } from "../schema/schema-context.js";
14
14
  import type { DocumentFooter } from "../transform-context.js";
15
+ import { EnumNameClaims } from "./enum-name-claims.js";
15
16
  import {
16
17
  type DeclaredMembers,
17
18
  EnumNaming,
18
19
  enumDeclaration,
19
20
  withoutDeclaredMembers,
20
21
  } from "./enum-naming.js";
22
+ import { OperationKeys } from "./operation-keys.js";
21
23
  import { FIRST_SCHEMA_NAMES, type SharedEnumNames } from "./shared-enum-names.js";
22
24
 
23
25
  /** Where footer declarations go, in order: the run's `ctx.injectFooter`, open to user code. */
@@ -30,14 +32,23 @@ export interface FooterSink {
30
32
  }
31
33
 
32
34
  /**
33
- * The `--dedupe-enums` key of the original: the values in default sort order, each paired with
34
- * the metadata at its sorted position (not the value's own metadata), as the original does.
35
+ * The `--dedupe-enums` key. Two enums share a declaration only when the original shares it and
36
+ * each value has the same name and description in both. The original key pairs the values in
37
+ * default sort order with the metadata at the sorted position, not with the value's own metadata,
38
+ * so `[desc, asc]` and `[asc, desc]`, both named `[Desc, Asc]`, shared one declaration, and one of
39
+ * them typed `asc` as `Desc = "desc"`. The original also joined `name:description` texts with
40
+ * `,`, and a member name stood in for its value, so enums with other values (`"1"` and `1`, `A`
41
+ * and `1` both named `Active`, `["a", "b"]` and `["a:,b"]`) shared one key. As JSON, an equal key
42
+ * means the same values and metadata; enums the original kept apart still are.
35
43
  */
36
44
  function dedupeKey(request: EnumDeclarationRequest): string {
37
- return [...request.values]
38
- .sort(compareAsStrings)
39
- .map((value, index) => metadataKey(String(value), request.metadata[index]))
40
- .join(",");
45
+ const sorted = [...request.values].sort(compareAsStrings);
46
+ const originalPairs = sorted.map((value, index) => memberKey(value, request.metadata[index]));
47
+ const ownPairs = request.values
48
+ .map((value, index) => ({ value, member: memberKey(value, request.metadata[index]) }))
49
+ .sort((left, right) => compareAsStrings(left.value, right.value))
50
+ .map(({ member }) => member);
51
+ return JSON.stringify([originalPairs, ownPairs]);
41
52
  }
42
53
 
43
54
  /** `Array.prototype.sort` without a comparator: compares the values as strings. */
@@ -50,8 +61,9 @@ function compareAsStrings(left: string | number, right: string | number): number
50
61
  return leftText < rightText ? -1 : 1;
51
62
  }
52
63
 
53
- function metadataKey(value: string, metadata: EnumMemberMetadata | undefined): string {
54
- return `${metadata?.name ?? value}:${metadata?.description || ""}`;
64
+ /** One member: the value (JSON keeps `"1"` and `1` apart), its name and its description. */
65
+ function memberKey(value: string | number, metadata: EnumMemberMetadata | undefined) {
66
+ return [value, metadata?.name ?? null, metadata?.description || null];
55
67
  }
56
68
 
57
69
  /** Separates a repeated `--enum-values` array name from its number, as root type aliases do. */
@@ -62,6 +74,12 @@ function declarationKey(name: string, request: EnumDeclarationRequest): string {
62
74
  return JSON.stringify([name, request.values, request.metadata]);
63
75
  }
64
76
 
77
+ /** The naming state a run's footer shares with the rest of the run. */
78
+ export interface RunFooterNames {
79
+ readonly enums: EnumNameClaims;
80
+ readonly operations: OperationKeys;
81
+ }
82
+
65
83
  /**
66
84
  * The footer of one run: enums (deduplicated with `--dedupe-enums`), `--enum-values` arrays, the
67
85
  * helper types they need, and the `operations` interface. Replaces the original's module-level
@@ -83,15 +101,18 @@ export class RunFooter implements DocumentFooter {
83
101
  private readonly sink: FooterSink;
84
102
  private readonly isDedupingEnums: boolean;
85
103
  private readonly sharedNames: SharedEnumNames;
104
+ private readonly names: RunFooterNames;
86
105
 
87
106
  constructor(
88
107
  sink: FooterSink,
89
108
  isDedupingEnums: boolean,
90
109
  sharedNames: SharedEnumNames = FIRST_SCHEMA_NAMES,
110
+ names: RunFooterNames = { enums: new EnumNameClaims(), operations: new OperationKeys() },
91
111
  ) {
92
112
  this.sink = sink;
93
113
  this.isDedupingEnums = isDedupingEnums;
94
114
  this.sharedNames = sharedNames;
115
+ this.names = names;
95
116
  }
96
117
 
97
118
  addEnum(request: EnumDeclarationRequest): string {
@@ -99,11 +120,13 @@ export class RunFooter implements DocumentFooter {
99
120
  const ownName = this.naming.enumName(request.name);
100
121
  const key = this.isDedupingEnums ? dedupeKey(request) : null;
101
122
  // Every schema of a shared enum goes to `sharedNames`, the later ones too.
102
- const name = key === null ? ownName : this.sharedNames.nameOf(key, ownName, request);
123
+ const sharedName = key === null ? ownName : this.sharedNames.nameOf(key, ownName, request);
103
124
  const known = key === null ? undefined : this.enumNamesByKey.get(key);
104
125
  if (known !== undefined) {
105
126
  return known;
106
127
  }
128
+ // The owner is the schema location: its requests share one enum, with `--dedupe-enums` too.
129
+ const name = this.names.enums.nameFor(sharedName, request.name);
107
130
  // Only a repeated member fails to compile; two empty declarations merge, so they stay.
108
131
  const declared = request.values.length > 0 ? declarationKey(name, request) : null;
109
132
  if (declared !== null && this.declaredEnums.has(declared)) {
@@ -200,6 +223,10 @@ export class RunFooter implements DocumentFooter {
200
223
  this.sink.addOperation(build);
201
224
  }
202
225
 
226
+ operationKey(operationId: string): string {
227
+ return this.names.operations.keyFor(operationId);
228
+ }
229
+
203
230
  private require(helper: HelperType): void {
204
231
  if (!this.sink.hasTypeAlias(helper.name)) {
205
232
  this.sink.add({ kind: "rawDeclaration", name: helper.name, text: helper.text });
@@ -0,0 +1,62 @@
1
+ import { freeNumberedName } from "../numbered-names.js";
2
+
3
+ /**
4
+ * The names of the `--enum` declarations of one run, unique across the enums and apart from the
5
+ * names the rest of the output may need.
6
+ *
7
+ * Every enum has an owner: the schema location it is named after, or with `--dedupe-enums` its
8
+ * members. Two owners whose names come out the same (`status` and `Status`) merged into one enum
9
+ * before, so each accepted the values of the other (upstream behavior). Now the first owner keeps
10
+ * the name and each later one gets the next free `Name_2`, `Name_3`, …; requests of one owner (a
11
+ * property and an inline `allOf` item of one schema) still share one enum.
12
+ *
13
+ * An enum also gives way to a name the output may need, which is only known at the end: a global
14
+ * type the output refers to (the `Blob` of `--binary-as-blob`, the `Record` of
15
+ * `Record<string, never>`), a helper type, or `ApiPaths`. Until then it takes the numbered name;
16
+ * `givenBack` lists the ones whose own name the output turned out not to need, so output that
17
+ * compiled before keeps its names (ADR-021).
18
+ */
19
+ export class EnumNameClaims {
20
+ private readonly mayBeNeeded: ReadonlySet<string>;
21
+ /** The first owner of each name an enum asked for. */
22
+ private readonly owners = new Map<string, string>();
23
+ /** The name given to each owner, by name asked for and owner. */
24
+ private readonly given = new Map<string, string>();
25
+ /** Every name given, and every name the output may need. */
26
+ private readonly taken: Set<string>;
27
+ /** A numbered name given only because the output may need the name asked for: that name. */
28
+ private readonly standIns = new Map<string, string>();
29
+
30
+ /** `mayBeNeeded`: the names an enum avoids until the end of the run; empty outside a run. */
31
+ constructor(mayBeNeeded: ReadonlySet<string> = new Set()) {
32
+ this.mayBeNeeded = mayBeNeeded;
33
+ this.taken = new Set(mayBeNeeded);
34
+ }
35
+
36
+ /** The declaration name of the enum `owner` asks to name `name`; the same for every request. */
37
+ nameFor(name: string, owner: string): string {
38
+ const key = JSON.stringify([name, owner]);
39
+ const known = this.given.get(key);
40
+ if (known !== undefined) {
41
+ return known;
42
+ }
43
+ const isFirstOwner = (this.owners.get(name) ?? owner) === owner;
44
+ this.owners.set(name, this.owners.get(name) ?? owner);
45
+ const isFree = isFirstOwner && !this.taken.has(name);
46
+ const declared = isFree ? name : freeNumberedName(name, this.taken);
47
+ if (isFirstOwner && this.mayBeNeeded.has(name)) {
48
+ this.standIns.set(declared, name);
49
+ }
50
+ this.taken.add(declared);
51
+ this.given.set(key, declared);
52
+ return declared;
53
+ }
54
+
55
+ /**
56
+ * The numbered names to rename back to the name asked for, because `needed` (the names the
57
+ * finished output declares or refers to) does not hold that name.
58
+ */
59
+ givenBack(needed: ReadonlySet<string>): ReadonlyMap<string, string> {
60
+ return new Map([...this.standIns].filter(([, name]) => !needed.has(name)));
61
+ }
62
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * The keys of the `operations` interface in one run. A repeated `operationId` (Redocly warns
3
+ * about it) gave the interface two members of one name, which did not compile (TS2300). Now the
4
+ * first operation with an ID keeps it, and each later one gets the lowest number from 2 whose key
5
+ * no operation of the document has: the second `listItems` is `listItems2`, the name
6
+ * `--make-paths-enum` gives it in `ApiPaths` too. Keys follow the order the operations are
7
+ * transformed in, which is the document order (or the `--alphabetize` order).
8
+ */
9
+ export class OperationKeys {
10
+ private readonly written: ReadonlySet<string>;
11
+ private readonly taken = new Set<string>();
12
+
13
+ /** `written`: every operation key of the document; empty outside a document run. */
14
+ constructor(written: ReadonlySet<string> = new Set()) {
15
+ this.written = written;
16
+ }
17
+
18
+ /** The key of the next operation with this key, written or numbered. */
19
+ keyFor(key: string): string {
20
+ let unique = key;
21
+ for (let count = 2; this.taken.has(unique); count += 1) {
22
+ const candidate = `${key}${count}`;
23
+ unique = this.written.has(candidate) ? unique : candidate;
24
+ }
25
+ this.taken.add(unique);
26
+ return unique;
27
+ }
28
+ }
@@ -22,7 +22,7 @@ import { extracted, markerObject, omitted } from "./type-rules.js";
22
22
 
23
23
  /** How many references one evaluation expands; a deeper one is opaque. */
24
24
  const MAX_EXPANSIONS = 200;
25
- const DEEP_PREFIX = "FlattenedDeepRequired<";
25
+ const DEEP_HELPER = "FlattenedDeepRequired";
26
26
  /** How many members distributing an intersection may give; more is opaque. */
27
27
  const MAX_DISTRIBUTED = 64;
28
28
 
@@ -75,15 +75,15 @@ export class TypeEvaluator {
75
75
  if (this.expansions++ > MAX_EXPANSIONS) {
76
76
  return OPAQUE;
77
77
  }
78
- if (name.startsWith(DEEP_PREFIX) && name.endsWith(">")) {
79
- const root = this.declared.get(name.slice(DEEP_PREFIX.length, -1));
78
+ const [first, second] = args;
79
+ if (name === DEEP_HELPER && first?.kind === "reference" && first.typeArguments.length === 0) {
80
+ const root = this.declared.get(first.name);
80
81
  return root === undefined ? OPAQUE : this.expand({ kind: "type", type: root, deep: true });
81
82
  }
82
83
  const declared = args.length === 0 ? this.declared.get(name) : undefined;
83
84
  if (declared !== undefined) {
84
85
  return this.expand({ ...value, type: declared });
85
86
  }
86
- const [first, second] = args;
87
87
  if (first === undefined) {
88
88
  return OPAQUE;
89
89
  }
@@ -51,9 +51,10 @@ export const HELPER_TYPES = {
51
51
  /**
52
52
  * The `--read-write-markers` helper types, written before the root types. Task 7.6 replaces the
53
53
  * original text on purpose (ADR-014): primitives (also branded), readonly arrays, tuples,
54
- * intersected arrays and null-only properties keep their types (upstream #2615, #2620, #2632,
55
- * #2717, #2765). The declarations equal `Readable` / `Writable` of openapi-typesafe-helpers
56
- * (`test/api/read-write-marker-types.test.ts`); the text is what the TypeScript printer prints.
54
+ * intersected arrays, null-only and `any` properties keep their types (upstream #2615, #2620,
55
+ * #2632, #2717, #2765). The declarations equal the `Readable` / `Writable` that
56
+ * openapi-typesafe-fetch declares (`test/api/read-write-marker-types.test.ts`); the text is what
57
+ * the TypeScript printer prints.
57
58
  */
58
59
  export const READ_WRITE_MARKER_TYPES = lines(
59
60
  "export type $Read<T> = {",
@@ -64,10 +65,10 @@ export const READ_WRITE_MARKER_TYPES = lines(
64
65
  "};",
65
66
  "type ReadWritePrimitive = string | number | boolean | bigint | symbol | null | undefined;",
66
67
  "type ReadWriteLeaf = ReadWritePrimitive | ((...args: never) => unknown);",
67
- "type ReadWriteMarkedKeys<T, Marker> = {",
68
- " [K in keyof T]-?: NonNullable<T[K]> extends never ? never : NonNullable<T[K]> " +
69
- "extends Marker ? K : never;",
70
- "}[keyof T];",
68
+ "type ReadWriteMarkedKeys<T, Marker> = keyof {",
69
+ " [K in keyof T as 0 extends 1 & T[K] ? never : NonNullable<T[K]> extends never ? never : " +
70
+ "NonNullable<T[K]> extends Marker ? K : never]: never;",
71
+ "};",
71
72
  'type ReadWriteResolveArray<T extends readonly unknown[], Resolved extends "read" | ' +
72
73
  '"write"> = T[number][] extends T ? T extends unknown[] ? ReadWriteResolve<T[number], ' +
73
74
  "Resolved>[] : readonly ReadWriteResolve<T[number], Resolved>[] : {",
@@ -18,3 +18,18 @@ export function withNumberedRepeats(names: readonly string[], numbered: Numbered
18
18
  return unique;
19
19
  });
20
20
  }
21
+
22
+ /** Separates a repeated declaration name from its number: `Status` → `Status_2`. */
23
+ const DECLARATION_NUMBER_SEPARATOR = "_";
24
+
25
+ /**
26
+ * The first of `Name_2`, `Name_3`, … that `taken` does not hold: the suffix `--root-types` uses for
27
+ * its own conflicts, and every other declaration that must give way to another name.
28
+ */
29
+ export function freeNumberedName(name: string, taken: ReadonlySet<string>): string {
30
+ let count = 2;
31
+ while (taken.has(`${name}${DECLARATION_NUMBER_SEPARATOR}${count}`)) {
32
+ count += 1;
33
+ }
34
+ return `${name}${DECLARATION_NUMBER_SEPARATOR}${count}`;
35
+ }
@@ -1,6 +1,6 @@
1
- import { createRef } from "../../../domain/openapi/json-pointer.js";
1
+ import { appendPointer, ROOT_POINTER } from "../../../domain/openapi/json-pointer.js";
2
2
  import type { RefResolver } from "../schema/schema-context.js";
3
- import { isJsonObject } from "./generated-shape.js";
3
+ import { isJsonObject } from "./located-node.js";
4
4
  import {
5
5
  leadingSegmentsOf,
6
6
  type RefPointer,
@@ -205,7 +205,7 @@ function walkTo(ref: string, refs: RefResolver, seen: readonly string[]): Locati
205
205
  export function generatedLocationOf(ref: string, refs: RefResolver): GeneratedLocation {
206
206
  const walk = walkTo(ref, refs, []);
207
207
  return {
208
- path: walk === null ? ref : createRef(walk.path),
208
+ path: walk === null ? ref : appendPointer(ROOT_POINTER, walk.path),
209
209
  isFromAdditionalProperties: walk?.isFromAdditionalProperties ?? false,
210
210
  };
211
211
  }
@@ -1,5 +1,18 @@
1
1
  import { isRawBinarySchema } from "../../../domain/openapi/binary-content.js";
2
2
  import type { RefResolver, SchemaOptions } from "../schema/schema-context.js";
3
+ import {
4
+ childLocation,
5
+ followLocated,
6
+ isJsonObject,
7
+ type JsonObject,
8
+ type LocatedNode,
9
+ } from "./located-node.js";
10
+ import {
11
+ isExcludedProperty,
12
+ isMarkedProperty,
13
+ isNullableSchema,
14
+ isOptionalProperty,
15
+ } from "./property-shape.js";
3
16
 
4
17
  /**
5
18
  * What the generated type of a schema has under a key, read from the schema itself. It answers the
@@ -8,14 +21,19 @@ import type { RefResolver, SchemaOptions } from "../schema/schema-context.js";
8
21
  */
9
22
 
10
23
  export type GeneratedMember =
11
- | { readonly kind: "property"; readonly node: unknown; readonly isOptional: boolean }
24
+ | {
25
+ readonly kind: "property";
26
+ readonly node: unknown;
27
+ readonly location: string | undefined;
28
+ readonly isOptional: boolean;
29
+ /** `$Read<T>` or `$Write<T>` (`isMarkedProperty`): no member but the marker's own. */
30
+ readonly isMarked: boolean;
31
+ }
12
32
  /** An index signature; `node` is undefined when its value type is `unknown`. */
13
- | { readonly kind: "index"; readonly node: unknown }
33
+ | { readonly kind: "index"; readonly node: unknown; readonly location: string | undefined }
14
34
  | { readonly kind: "missing" }
15
35
  | { readonly kind: "opaque" };
16
36
 
17
- type JsonObject = Readonly<Record<string, unknown>>;
18
-
19
37
  const OPAQUE_KEYS = ["not", "enum", "const", "$ref"] as const;
20
38
  /** How deep `allOf`/`anyOf`/`oneOf` members are read; deeper shapes count as opaque. */
21
39
  const MAX_DEPTH = 8;
@@ -23,23 +41,6 @@ const INDEX_RE = /^\d+$/;
23
41
  const MISSING: GeneratedMember = { kind: "missing" };
24
42
  const OPAQUE: GeneratedMember = { kind: "opaque" };
25
43
 
26
- export function isJsonObject(value: unknown): value is JsonObject {
27
- return typeof value === "object" && value !== null && !Array.isArray(value);
28
- }
29
-
30
- /** The schema a node stands for: a `$ref` is followed to its target. */
31
- export function followRefs(node: unknown, refs: RefResolver): unknown {
32
- return isJsonObject(node) && typeof node.$ref === "string" ? refs.resolve(node.$ref) : node;
33
- }
34
-
35
- /** `nullable: true` or a `type` list with `null`: the generated type includes `null`. */
36
- export function isNullableSchema(node: unknown): boolean {
37
- if (!isJsonObject(node)) {
38
- return false;
39
- }
40
- return node.nullable === true || (Array.isArray(node.type) && node.type.includes("null"));
41
- }
42
-
43
44
  function typeNames(node: JsonObject): readonly unknown[] {
44
45
  return Array.isArray(node.type) ? node.type : [node.type];
45
46
  }
@@ -90,39 +91,37 @@ function isBuiltInMember(key: string, prototype: object): boolean {
90
91
  return key in prototype;
91
92
  }
92
93
 
93
- function indexMember(node: JsonObject, options: SchemaOptions): GeneratedMember | null {
94
- const { additionalProperties: values, patternProperties: patterns } = node;
94
+ function indexMember(owner: LocatedNode & { node: JsonObject }, options: SchemaOptions) {
95
+ const { additionalProperties: values, patternProperties: patterns } = owner.node;
95
96
  if (isJsonObject(patterns) && Object.keys(patterns).length > 0) {
96
97
  return OPAQUE;
97
98
  }
98
99
  if (isJsonObject(values) && Object.keys(values).length > 0) {
99
- return { kind: "index", node: values };
100
+ const location = childLocation(owner.location, "additionalProperties");
101
+ return { kind: "index", node: values, location } satisfies GeneratedMember;
100
102
  }
101
103
  const isImplicit = values === true || (isJsonObject(values) && Object.keys(values).length === 0);
102
104
  return isImplicit || (!values && options.additionalProperties)
103
- ? { kind: "index", node: undefined }
105
+ ? ({ kind: "index", node: undefined, location: undefined } satisfies GeneratedMember)
104
106
  : null;
105
107
  }
106
108
 
107
- function isOptionalProperty(node: JsonObject, key: string, options: SchemaOptions): boolean {
108
- const required = Array.isArray(node.required) ? node.required : undefined;
109
- const property = (node.properties as JsonObject)[key];
110
- const hasDefault = isJsonObject(property) && property.default !== undefined;
111
- const isRequired =
112
- required?.includes(key) === true ||
113
- (required === undefined && options.propertiesRequiredByDefault) ||
114
- (hasDefault && options.defaultNonNullable);
115
- return !isRequired;
116
- }
117
-
118
- function objectMember(node: JsonObject, key: string, options: SchemaOptions): GeneratedMember {
109
+ function objectMember(
110
+ owner: LocatedNode & { node: JsonObject },
111
+ key: string,
112
+ input: MemberInput,
113
+ ): GeneratedMember {
114
+ const { options } = input;
115
+ const { node } = owner;
119
116
  const properties = isJsonObject(node.properties) ? node.properties : {};
120
- if (Object.hasOwn(properties, key)) {
121
- const property = properties[key];
122
- const isExcluded = options.excludeDeprecated && isJsonObject(property) && property.deprecated;
123
- return isExcluded || isJsonObject(node.discriminator)
124
- ? OPAQUE
125
- : { kind: "property", node: property, isOptional: isOptionalProperty(node, key, options) };
117
+ if (Object.hasOwn(properties, key) && !isExcludedProperty(properties[key], options, input.refs)) {
118
+ if (isJsonObject(node.discriminator)) {
119
+ return OPAQUE;
120
+ }
121
+ const location = childLocation(owner.location, "properties", key);
122
+ const isOptional = isOptionalProperty(owner, key, options);
123
+ const isMarked = isMarkedProperty(properties[key], options, input.refs);
124
+ return { kind: "property", node: properties[key], location, isOptional, isMarked };
126
125
  }
127
126
  // `unevaluatedProperties` adds an index signature with its fix, so it counts as opaque too.
128
127
  const isUnknownShape =
@@ -131,38 +130,23 @@ function objectMember(node: JsonObject, key: string, options: SchemaOptions): Ge
131
130
  return OPAQUE;
132
131
  }
133
132
  return hasObjectKeywords(node)
134
- ? (indexMember(node, options) ?? MISSING)
133
+ ? (indexMember(owner, options) ?? MISSING)
135
134
  : emptyObjectMember(node, options);
136
135
  }
137
136
 
138
- /** Whether a value is there: `present`, `absent` (may be `undefined` or `null`) or `unknown`. */
139
- export type Presence = "present" | "absent" | "unknown";
140
-
141
- /** The presence of a value of `schema` itself: `absent` when its type includes `null`. */
142
- export function schemaPresence(schema: unknown, refs: RefResolver): Presence {
143
- return isNullableSchema(followRefs(schema, refs)) ? "absent" : "present";
144
- }
145
-
146
- /** The presence of property `key` of `schema`: optional or nullable is `absent`. */
147
- export function propertyPresence(
148
- schema: unknown,
149
- key: string,
150
- options: SchemaOptions,
151
- refs: RefResolver,
152
- ): Presence {
153
- const node = followRefs(schema, refs);
154
- const properties = isJsonObject(node) && isJsonObject(node.properties) ? node.properties : {};
155
- if (!isJsonObject(node) || !Object.hasOwn(properties, key)) {
156
- return "unknown";
157
- }
158
- return isOptionalProperty(node, key, options) ? "absent" : schemaPresence(properties[key], refs);
159
- }
160
-
161
137
  function membersOf(node: JsonObject, keyword: string): readonly unknown[] {
162
138
  const members = node[keyword];
163
139
  return Array.isArray(members) ? members : [];
164
140
  }
165
141
 
142
+ /** The members of a composition keyword with their locations. */
143
+ function locatedMembers(owner: LocatedNode & { node: JsonObject }, keyword: string): LocatedNode[] {
144
+ return membersOf(owner.node, keyword).map((node, index) => ({
145
+ node,
146
+ location: childLocation(owner.location, keyword, String(index)),
147
+ }));
148
+ }
149
+
166
150
  function withoutComposition(node: JsonObject): JsonObject {
167
151
  const { allOf: _allOf, anyOf: _anyOf, oneOf: _oneOf, ...own } = node;
168
152
  return own;
@@ -178,8 +162,13 @@ function hasOwnObjectType(own: JsonObject): boolean {
178
162
  * `anyOf` or `oneOf` alone is a union: a key is missing if one member misses it. A mix of both
179
163
  * is written in more than one way (`anyof-properties`), so it counts as opaque.
180
164
  */
181
- function composedMember(node: JsonObject, key: string, input: MemberInput): GeneratedMember {
182
- const variants = [...membersOf(node, "anyOf"), ...membersOf(node, "oneOf")];
165
+ function composedMember(
166
+ owner: LocatedNode & { node: JsonObject },
167
+ key: string,
168
+ input: MemberInput,
169
+ ): GeneratedMember {
170
+ const { node } = owner;
171
+ const variants = [...locatedMembers(owner, "anyOf"), ...locatedMembers(owner, "oneOf")];
183
172
  const own = withoutComposition(node);
184
173
  const hasOwn = hasOwnObjectType(own);
185
174
  if (variants.length > 0) {
@@ -187,7 +176,8 @@ function composedMember(node: JsonObject, key: string, input: MemberInput): Gene
187
176
  const members = variants.map((variant) => memberAt(variant, key, input));
188
177
  return isAlone && members.some((member) => member.kind === "missing") ? MISSING : OPAQUE;
189
178
  }
190
- const parts = [...membersOf(node, "allOf"), ...(hasOwn ? [own] : [])];
179
+ const ownPart = { node: own, location: owner.location };
180
+ const parts = [...locatedMembers(owner, "allOf"), ...(hasOwn ? [ownPart] : [])];
191
181
  return intersectionMember(parts.map((part) => memberAt(part, key, input)));
192
182
  }
193
183
 
@@ -216,23 +206,22 @@ interface MemberInput {
216
206
  readonly depth: number;
217
207
  }
218
208
 
219
- function memberAt(schema: unknown, key: string, input: MemberInput): GeneratedMember {
220
- const node = followRefs(schema, input.refs);
209
+ function memberAt(schema: LocatedNode, key: string, input: MemberInput): GeneratedMember {
210
+ const followed = followLocated(schema, input.refs);
211
+ const { node } = followed;
221
212
  if (!isJsonObject(node) || OPAQUE_KEYS.some((name) => name in node) || input.depth > MAX_DEPTH) {
222
213
  return OPAQUE;
223
214
  }
215
+ const owner = { ...followed, node };
224
216
  if (isNullableSchema(node)) {
225
217
  // Every key of `T | null` is an error, unless `T` is unknown (then the type is `unknown`).
226
218
  return isObjectShape(node) || isArrayShape(node) ? MISSING : OPAQUE;
227
219
  }
228
- if (input.options.readWriteMarkers) {
229
- return OPAQUE;
230
- }
231
220
  if ("allOf" in node || "anyOf" in node || "oneOf" in node) {
232
- return composedMember(node, key, { ...input, depth: input.depth + 1 });
221
+ return composedMember(owner, key, { ...input, depth: input.depth + 1 });
233
222
  }
234
223
  if (isObjectShape(node)) {
235
- return objectMember(node, key, input.options);
224
+ return objectMember(owner, key, input);
236
225
  }
237
226
  if (isArrayShape(node)) {
238
227
  return INDEX_RE.test(key) || isBuiltInMember(key, []) ? OPAQUE : MISSING;
@@ -266,7 +255,7 @@ function primitiveMember(node: JsonObject, key: string): GeneratedMember {
266
255
 
267
256
  /** The member `key` of the type generated for `schema` (a `$ref` is followed first). */
268
257
  export function generatedMember(
269
- schema: unknown,
258
+ schema: LocatedNode,
270
259
  key: string,
271
260
  options: SchemaOptions,
272
261
  refs: RefResolver,
@@ -1,5 +1,5 @@
1
1
  import type { RefResolver, SchemaOptions } from "../schema/schema-context.js";
2
- import { isJsonObject } from "./generated-shape.js";
2
+ import { isJsonObject } from "./located-node.js";
3
3
  import { pointerNode, refPointerOf } from "./pointer-walk.js";
4
4
  import { typedWalk } from "./typed-walk.js";
5
5
 
@@ -0,0 +1,38 @@
1
+ import { appendPointer } from "../../../domain/openapi/json-pointer.js";
2
+ import type { RefResolver } from "../schema/schema-context.js";
3
+
4
+ /** Document nodes as the `$ref` pointer walks read them: with their place in the document. */
5
+
6
+ export type JsonObject = Readonly<Record<string, unknown>>;
7
+
8
+ /**
9
+ * A schema node and its JSON Pointer in the document. The generator writes the type of a schema
10
+ * reached by a `$ref` at the target, and the location decides whether a property with a `default`
11
+ * is required (`isInputLocation`). Undefined for a node that is not in the document.
12
+ */
13
+ export interface LocatedNode {
14
+ readonly node: unknown;
15
+ readonly location: string | undefined;
16
+ }
17
+
18
+ export function isJsonObject(value: unknown): value is JsonObject {
19
+ return typeof value === "object" && value !== null && !Array.isArray(value);
20
+ }
21
+
22
+ /** The schema a node stands for: a `$ref` is followed to its target. */
23
+ export function followRefs(node: unknown, refs: RefResolver): unknown {
24
+ return isJsonObject(node) && typeof node.$ref === "string" ? refs.resolve(node.$ref) : node;
25
+ }
26
+
27
+ /** `followRefs` with the location: a `$ref` is followed to its target and the target's pointer. */
28
+ export function followLocated(located: LocatedNode, refs: RefResolver): LocatedNode {
29
+ const { node } = located;
30
+ return isJsonObject(node) && typeof node.$ref === "string"
31
+ ? { node: refs.resolve(node.$ref), location: node.$ref }
32
+ : located;
33
+ }
34
+
35
+ /** The location of a child of a node at `location`, or undefined outside the document. */
36
+ export function childLocation(location: string | undefined, ...segments: string[]) {
37
+ return location === undefined ? undefined : appendPointer(location, segments);
38
+ }