@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
@@ -0,0 +1,127 @@
1
+ import type { OasSchema } from './Schema.js';
2
+ import type { OasRef } from '../ref/Ref.js';
3
+ /**
4
+ * The keywords next to a reference in a one-member `allOf`
5
+ * (`{ allOf: [{ $ref }], minLength: 3, description: '…' }`), the use-site
6
+ * flags `nullable`, `readOnly` and `writeOnly` among them: the fields a
7
+ * reference adds at its site (`RefFields`).
8
+ *
9
+ * The parser reads them without knowing the target's type: the reference
10
+ * stays lazy. Each schema class's `clone(ref)` takes the keywords its type
11
+ * has ({@link SIBLINGS_BY_TYPE}). A value whose type depends on the target
12
+ * (`example`, `default`, `enums`, `format`) is kept as written, and `clone`
13
+ * takes it only when it fits. {@link toSkippedSiblings} names the keywords
14
+ * `clone` leaves out, for a generator to log.
15
+ */
16
+ export type SiblingKeywords = {
17
+ /**
18
+ * Use-site nullability. A `$ref` is a per-reference node: the same
19
+ * refName may be referenced nullable at one site and non-nullable at
20
+ * another, so nullability rides the reference, not the shared referent.
21
+ * Set by the single-member `oneOf`/`anyOf` collapse for the 3.1
22
+ * `oneOf:[{$ref},{type:null}]` idiom, and next to a one-member `allOf`.
23
+ * Generators read it off the reference (`'nullable' in schema ?
24
+ * schema.nullable`) to render `Foo | null`, while `ModelDriver` builds the
25
+ * un-nullable shared model from the refName.
26
+ */
27
+ nullable?: boolean;
28
+ /**
29
+ * Use-site `readOnly`: set where a property marks a reference read-only,
30
+ * `{ allOf: [{ $ref }], readOnly: true }` (the 3.0 idiom, as keywords next
31
+ * to a bare `$ref` are ignored there). Like `nullable`, it rides the
32
+ * reference: the shared model is not read-only everywhere. Read it through
33
+ * `isReadOnly`, which also looks at what the reference points to.
34
+ */
35
+ readOnly?: boolean;
36
+ /** Use-site `writeOnly`, as {@link readOnly}. */
37
+ writeOnly?: boolean;
38
+ /**
39
+ * The `type` written next to the reference, merged in from the schema that
40
+ * holds the one-member `allOf`. It must agree with the target's; the copy
41
+ * always has the target's type. Not `type`, which on an `OasRef` is `'ref'`.
42
+ */
43
+ _type?: unknown;
44
+ title?: string;
45
+ description?: string;
46
+ deprecated?: boolean;
47
+ example?: unknown;
48
+ default?: unknown;
49
+ enums?: unknown[];
50
+ extensionFields?: Record<string, unknown>;
51
+ format?: string;
52
+ minLength?: number;
53
+ maxLength?: number;
54
+ pattern?: string;
55
+ multipleOf?: number;
56
+ minimum?: number;
57
+ maximum?: number;
58
+ exclusiveMinimum?: boolean;
59
+ exclusiveMaximum?: boolean;
60
+ minItems?: number;
61
+ maxItems?: number;
62
+ uniqueItems?: boolean;
63
+ properties?: Record<string, OasSchema | OasRef<'schema'>>;
64
+ required?: string[];
65
+ additionalProperties?: boolean | OasSchema | OasRef<'schema'>;
66
+ minProperties?: number;
67
+ maxProperties?: number;
68
+ };
69
+ /** A keyword `clone` can apply. `_type` only has to agree. */
70
+ export type SiblingKeyword = Exclude<keyof SiblingKeywords, '_type'>;
71
+ /** The keywords each schema class's `clone` takes: the fields its type has. */
72
+ export declare const SIBLINGS_BY_TYPE: Record<OasSchema['type'], SiblingKeyword[]>;
73
+ /**
74
+ * The keywords of `over` merged over those of `base`, for a reference copied
75
+ * with what another site adds (`OasRef.clone`): a flag set on either stays
76
+ * set, a keyword `over` sets wins, extension fields and `properties` merge,
77
+ * and `required` names add up, as each schema class's `clone` merges them
78
+ * into a schema.
79
+ */
80
+ export declare const mergeSiblingKeywords: (base: SiblingKeywords, over: SiblingKeywords | undefined) => SiblingKeywords;
81
+ /** Whether `siblings` holds any keyword. */
82
+ export declare const hasSiblingKeywords: (siblings: SiblingKeywords) => boolean;
83
+ /** Whether the keywords next to a reference change `target` at that site. The engine behind `OasRef.resolve`. */
84
+ export declare const changesTarget: (copy: OasSchema, target: OasSchema, siblings: SiblingKeywords) => boolean;
85
+ /**
86
+ * Whether the keywords next to a reference change which values `target`
87
+ * accepts at that site (`minLength` next to a string, `properties` next to an
88
+ * object), not only how it is described (`description`, `deprecated`,
89
+ * `default`, `x-*`). The engine behind `OasRef.hasValueSiblings`.
90
+ */
91
+ export declare const changesValues: (copy: OasSchema, target: OasSchema, siblings: SiblingKeywords) => boolean;
92
+ /**
93
+ * The keywords next to a reference that `clone` leaves out for `target`, by
94
+ * their names in the document: one its type does not have (`minLength` next
95
+ * to an array), a `type` that disagrees with the target's, and an `example`,
96
+ * `default`, `enum` or `format` whose value does not fit. `nullable` says
97
+ * whether the site takes `null` among the `enum` members. The engine behind
98
+ * `OasRef.toSkippedSiblings`.
99
+ */
100
+ export declare const toSkippedSiblings: (target: OasSchema, siblings: SiblingKeywords, nullable: boolean | undefined) => string[];
101
+ /** The annotations of `target` with those of `siblings` applied: a sibling's value wins, and extension fields merge. */
102
+ export declare const toSiblingAnnotations: (target: OasSchema, siblings: SiblingKeywords | undefined) => {
103
+ title: string | undefined;
104
+ description: string | undefined;
105
+ extensionFields: {
106
+ [x: string]: unknown;
107
+ } | undefined;
108
+ };
109
+ /** The value checks the parser makes for `example`, `default` and each `enum` member, by type. */
110
+ export declare const isStringValue: (value: unknown) => value is string;
111
+ export declare const isNumberValue: (value: unknown) => value is number;
112
+ export declare const isIntegerValue: (value: unknown) => value is number;
113
+ export declare const isBooleanValue: (value: unknown) => value is boolean;
114
+ export declare const isArrayValue: (value: unknown) => value is unknown[];
115
+ export declare const isObjectValue: (value: unknown) => value is Record<string, unknown>;
116
+ /** {@link isStringValue} and the others, keyed by the type they check for. A union or unknown takes any value. */
117
+ export declare const VALUE_CHECKS: Record<OasSchema['type'], (value: unknown) => boolean>;
118
+ /** The formats a number and an integer take. A string takes any format. */
119
+ export declare const isNumberFormat: (value: unknown) => value is "float" | "double";
120
+ export declare const isIntegerFormat: (value: unknown) => value is "int32" | "int64";
121
+ /** `value` when it passes `check`, else `undefined`: for `example`, `default` and `format`. */
122
+ export declare const toSiblingValue: <T>(value: unknown, check: (value: unknown) => value is T) => T | undefined;
123
+ /**
124
+ * `enums` when every member passes `check`, or is `null` at a nullable site,
125
+ * else `undefined`. The parser reports the members that do not.
126
+ */
127
+ export declare const toSiblingEnums: <T>(enums: unknown[] | undefined, check: (value: unknown) => value is T, nullable: boolean | undefined) => (T | null)[] | undefined;
@@ -0,0 +1,305 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.toSiblingEnums = exports.toSiblingValue = exports.isIntegerFormat = exports.isNumberFormat = exports.VALUE_CHECKS = exports.isObjectValue = exports.isArrayValue = exports.isBooleanValue = exports.isIntegerValue = exports.isNumberValue = exports.isStringValue = exports.toSiblingAnnotations = exports.toSkippedSiblings = exports.changesValues = exports.changesTarget = exports.hasSiblingKeywords = exports.mergeSiblingKeywords = exports.SIBLINGS_BY_TYPE = void 0;
40
+ const v = __importStar(require("valibot"));
41
+ const isEqual_js_1 = __importDefault(require("lodash-es/isEqual.js"));
42
+ const DanglingRefError_js_1 = require("../ref/DanglingRefError.js");
43
+ const number_types_js_1 = require("../number/number-types.js");
44
+ const integer_types_js_1 = require("../integer/integer-types.js");
45
+ /**
46
+ * The use-site flags, taken by every type, so they are never reported as
47
+ * left out. A union's or unknown's copy has no `readOnly` or `writeOnly`
48
+ * field, but the reference still answers `isReadOnly()` and
49
+ * `isWriteOnly()` from its own flag.
50
+ */
51
+ const FLAGS = ['nullable', 'readOnly', 'writeOnly'];
52
+ const DESCRIBING = [...FLAGS, 'title', 'description', 'extensionFields', 'example'];
53
+ const NUMERIC = [
54
+ 'deprecated',
55
+ 'default',
56
+ 'enums',
57
+ 'format',
58
+ 'multipleOf',
59
+ 'minimum',
60
+ 'maximum',
61
+ 'exclusiveMinimum',
62
+ 'exclusiveMaximum'
63
+ ];
64
+ /** The keywords each schema class's `clone` takes: the fields its type has. */
65
+ exports.SIBLINGS_BY_TYPE = {
66
+ string: [...DESCRIBING, 'deprecated', 'default', 'enums', 'format', 'minLength', 'maxLength', 'pattern'],
67
+ number: [...DESCRIBING, ...NUMERIC],
68
+ integer: [...DESCRIBING, ...NUMERIC],
69
+ boolean: [...DESCRIBING, 'deprecated', 'default', 'enums'],
70
+ array: [...DESCRIBING, 'deprecated', 'default', 'enums', 'minItems', 'maxItems', 'uniqueItems'],
71
+ object: [
72
+ ...DESCRIBING,
73
+ 'deprecated',
74
+ 'default',
75
+ 'enums',
76
+ 'properties',
77
+ 'required',
78
+ 'additionalProperties',
79
+ 'minProperties',
80
+ 'maxProperties'
81
+ ],
82
+ union: [...DESCRIBING, 'default'],
83
+ unknown: DESCRIBING
84
+ };
85
+ /** Every keyword `clone` can apply, for any type. */
86
+ const SIBLING_KEYWORDS = [...new Set(Object.values(exports.SIBLINGS_BY_TYPE).flat())];
87
+ /**
88
+ * The keywords of `over` merged over those of `base`, for a reference copied
89
+ * with what another site adds (`OasRef.clone`): a flag set on either stays
90
+ * set, a keyword `over` sets wins, extension fields and `properties` merge,
91
+ * and `required` names add up, as each schema class's `clone` merges them
92
+ * into a schema.
93
+ */
94
+ const mergeSiblingKeywords = (base, over) => ({
95
+ nullable: base.nullable || over?.nullable || undefined,
96
+ readOnly: base.readOnly || over?.readOnly || undefined,
97
+ writeOnly: base.writeOnly || over?.writeOnly || undefined,
98
+ _type: over?._type ?? base._type,
99
+ title: over?.title ?? base.title,
100
+ description: over?.description ?? base.description,
101
+ deprecated: over?.deprecated ?? base.deprecated,
102
+ example: over?.example ?? base.example,
103
+ default: over?.default ?? base.default,
104
+ enums: over?.enums ?? base.enums,
105
+ extensionFields: base.extensionFields === undefined && over?.extensionFields === undefined
106
+ ? undefined
107
+ : { ...base.extensionFields, ...over?.extensionFields },
108
+ format: over?.format ?? base.format,
109
+ minLength: over?.minLength ?? base.minLength,
110
+ maxLength: over?.maxLength ?? base.maxLength,
111
+ pattern: over?.pattern ?? base.pattern,
112
+ multipleOf: over?.multipleOf ?? base.multipleOf,
113
+ minimum: over?.minimum ?? base.minimum,
114
+ maximum: over?.maximum ?? base.maximum,
115
+ exclusiveMinimum: over?.exclusiveMinimum ?? base.exclusiveMinimum,
116
+ exclusiveMaximum: over?.exclusiveMaximum ?? base.exclusiveMaximum,
117
+ minItems: over?.minItems ?? base.minItems,
118
+ maxItems: over?.maxItems ?? base.maxItems,
119
+ uniqueItems: over?.uniqueItems ?? base.uniqueItems,
120
+ properties: over?.properties === undefined ? base.properties : { ...base.properties, ...over.properties },
121
+ required: over?.required === undefined ? base.required : [...new Set([...(base.required ?? []), ...over.required])],
122
+ additionalProperties: over?.additionalProperties ?? base.additionalProperties,
123
+ minProperties: over?.minProperties ?? base.minProperties,
124
+ maxProperties: over?.maxProperties ?? base.maxProperties
125
+ });
126
+ exports.mergeSiblingKeywords = mergeSiblingKeywords;
127
+ /** Whether `siblings` holds any keyword. */
128
+ const hasSiblingKeywords = (siblings) => siblings._type !== undefined || SIBLING_KEYWORDS.some(keyword => siblings[keyword] !== undefined);
129
+ exports.hasSiblingKeywords = hasSiblingKeywords;
130
+ /** The keywords that change which values a site accepts, not only how it is described. */
131
+ const VALUE_KEYWORDS = [
132
+ 'enums',
133
+ 'format',
134
+ 'minLength',
135
+ 'maxLength',
136
+ 'pattern',
137
+ 'multipleOf',
138
+ 'minimum',
139
+ 'maximum',
140
+ 'exclusiveMinimum',
141
+ 'exclusiveMaximum',
142
+ 'minItems',
143
+ 'maxItems',
144
+ 'uniqueItems',
145
+ 'properties',
146
+ 'required',
147
+ 'additionalProperties',
148
+ 'minProperties',
149
+ 'maxProperties'
150
+ ];
151
+ /** Keywords that `clone` merges with `||`: `false` and absent mean the same. */
152
+ const BOOLEAN_KEYWORDS = [
153
+ 'nullable',
154
+ 'readOnly',
155
+ 'writeOnly',
156
+ 'deprecated',
157
+ 'exclusiveMinimum',
158
+ 'exclusiveMaximum',
159
+ 'uniqueItems'
160
+ ];
161
+ /**
162
+ * The keywords next to a reference that make `copy` (the target with them
163
+ * applied) differ from `target`. A keyword the target's type does not take,
164
+ * a flag the target already has, and a value equal to the target's change
165
+ * nothing.
166
+ */
167
+ const toChangedKeywords = (copy, target, siblings) => exports.SIBLINGS_BY_TYPE[target.type].filter(keyword => {
168
+ if (siblings[keyword] === undefined) {
169
+ return false;
170
+ }
171
+ const applied = Reflect.get(copy, keyword);
172
+ const original = Reflect.get(target, keyword);
173
+ return BOOLEAN_KEYWORDS.includes(keyword) ? (applied === true) !== (original === true) : !(0, isEqual_js_1.default)(applied, original);
174
+ });
175
+ /** Whether the keywords next to a reference change `target` at that site. The engine behind `OasRef.resolve`. */
176
+ const changesTarget = (copy, target, siblings) => toChangedKeywords(copy, target, siblings).length > 0;
177
+ exports.changesTarget = changesTarget;
178
+ /**
179
+ * Whether the keywords next to a reference change which values `target`
180
+ * accepts at that site (`minLength` next to a string, `properties` next to an
181
+ * object), not only how it is described (`description`, `deprecated`,
182
+ * `default`, `x-*`). The engine behind `OasRef.hasValueSiblings`.
183
+ */
184
+ const changesValues = (copy, target, siblings) => toChangedKeywords(copy, target, siblings).some(keyword => VALUE_KEYWORDS.includes(keyword));
185
+ exports.changesValues = changesValues;
186
+ /**
187
+ * The keywords next to a reference that `clone` leaves out for `target`, by
188
+ * their names in the document: one its type does not have (`minLength` next
189
+ * to an array), a `type` that disagrees with the target's, and an `example`,
190
+ * `default`, `enum` or `format` whose value does not fit. `nullable` says
191
+ * whether the site takes `null` among the `enum` members. The engine behind
192
+ * `OasRef.toSkippedSiblings`.
193
+ */
194
+ const toSkippedSiblings = (target, siblings, nullable) => {
195
+ const taken = exports.SIBLINGS_BY_TYPE[target.type];
196
+ const fits = exports.VALUE_CHECKS[target.type];
197
+ const isSkipped = (keyword, value) => {
198
+ if (value === undefined) {
199
+ return false;
200
+ }
201
+ if (!taken.includes(keyword)) {
202
+ return true;
203
+ }
204
+ switch (keyword) {
205
+ case 'example':
206
+ case 'default':
207
+ return !fits(value);
208
+ case 'enums':
209
+ return !Array.isArray(value) || !value.every(item => fits(item) || (nullable === true && item === null));
210
+ case 'format':
211
+ return !fitsFormat(target.type, value);
212
+ default:
213
+ return false;
214
+ }
215
+ };
216
+ const type = siblings._type !== undefined && !agrees(siblings._type, target, 0) ? ['type'] : [];
217
+ const others = SIBLING_KEYWORDS.filter(keyword => isSkipped(keyword, siblings[keyword])).map(toDocumentKeyword);
218
+ return [...type, ...others];
219
+ };
220
+ exports.toSkippedSiblings = toSkippedSiblings;
221
+ /** How deep {@link agrees} follows union members, so a union that contains itself ends. */
222
+ const MAX_DEPTH = 10;
223
+ /**
224
+ * A `type` next to a reference agrees with the target's when it names it, or
225
+ * `number` for an integer. Next to a union, it agrees when every member,
226
+ * followed through references, has that type (`type: object` next to a
227
+ * `oneOf` of objects): leaving it out then loses nothing.
228
+ */
229
+ const agrees = (type, target, depth) => {
230
+ if (target.type === 'union') {
231
+ try {
232
+ return depth < MAX_DEPTH &&
233
+ target.members.every(member => agrees(type, member.isRef() ? member.resolve() : member, depth + 1));
234
+ }
235
+ catch (error) {
236
+ // A member that is a dangling reference has no known type, so it does not agree.
237
+ if (DanglingRefError_js_1.DanglingRefError.is(error)) {
238
+ return false;
239
+ }
240
+ throw error;
241
+ }
242
+ }
243
+ return type === target.type || (type === 'number' && target.type === 'integer');
244
+ };
245
+ /** Whether `format` fits a schema of `type`, as `clone` reads it: any string for a string. */
246
+ const fitsFormat = (type, format) => {
247
+ switch (type) {
248
+ case 'number':
249
+ return (0, exports.isNumberFormat)(format);
250
+ case 'integer':
251
+ return (0, exports.isIntegerFormat)(format);
252
+ default:
253
+ return (0, exports.isStringValue)(format);
254
+ }
255
+ };
256
+ /** The document's name for a keyword: `enum` for `enums`. */
257
+ const toDocumentKeyword = (keyword) => (keyword === 'enums' ? 'enum' : keyword);
258
+ /** The annotations of `target` with those of `siblings` applied: a sibling's value wins, and extension fields merge. */
259
+ const toSiblingAnnotations = (target, siblings) => ({
260
+ title: siblings?.title ?? target.title,
261
+ description: siblings?.description ?? target.description,
262
+ extensionFields: target.extensionFields === undefined && siblings?.extensionFields === undefined
263
+ ? undefined
264
+ : { ...target.extensionFields, ...siblings?.extensionFields }
265
+ });
266
+ exports.toSiblingAnnotations = toSiblingAnnotations;
267
+ /** The value checks the parser makes for `example`, `default` and each `enum` member, by type. */
268
+ const isStringValue = (value) => typeof value === 'string';
269
+ exports.isStringValue = isStringValue;
270
+ const isNumberValue = (value) => typeof value === 'number';
271
+ exports.isNumberValue = isNumberValue;
272
+ const isIntegerValue = (value) => Number.isInteger(value);
273
+ exports.isIntegerValue = isIntegerValue;
274
+ const isBooleanValue = (value) => typeof value === 'boolean';
275
+ exports.isBooleanValue = isBooleanValue;
276
+ const isArrayValue = (value) => Array.isArray(value);
277
+ exports.isArrayValue = isArrayValue;
278
+ const isObjectValue = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
279
+ exports.isObjectValue = isObjectValue;
280
+ const isAnyValue = (_value) => true;
281
+ /** {@link isStringValue} and the others, keyed by the type they check for. A union or unknown takes any value. */
282
+ exports.VALUE_CHECKS = {
283
+ string: exports.isStringValue,
284
+ number: exports.isNumberValue,
285
+ integer: exports.isIntegerValue,
286
+ boolean: exports.isBooleanValue,
287
+ array: exports.isArrayValue,
288
+ object: exports.isObjectValue,
289
+ union: isAnyValue,
290
+ unknown: isAnyValue
291
+ };
292
+ /** The formats a number and an integer take. A string takes any format. */
293
+ const isNumberFormat = (value) => v.is(number_types_js_1.numberFormat, value);
294
+ exports.isNumberFormat = isNumberFormat;
295
+ const isIntegerFormat = (value) => v.is(integer_types_js_1.integerFormat, value);
296
+ exports.isIntegerFormat = isIntegerFormat;
297
+ /** `value` when it passes `check`, else `undefined`: for `example`, `default` and `format`. */
298
+ const toSiblingValue = (value, check) => check(value) ? value : undefined;
299
+ exports.toSiblingValue = toSiblingValue;
300
+ /**
301
+ * `enums` when every member passes `check`, or is `null` at a nullable site,
302
+ * else `undefined`. The parser reports the members that do not.
303
+ */
304
+ const toSiblingEnums = (enums, check, nullable) => enums?.every((item) => check(item) || (nullable === true && item === null)) ? enums : undefined;
305
+ exports.toSiblingEnums = toSiblingEnums;
@@ -73,6 +73,10 @@ export declare class OasHttpSecurityScheme {
73
73
  bearerFormat: string | undefined;
74
74
  constructor(fields: HttpSecuritySchemeFields);
75
75
  isRef(): this is OasRef<'securityScheme'>;
76
+ /** Always `false`: `readOnly` is a schema keyword. */
77
+ isReadOnly(): boolean;
78
+ /** Always `false`: `writeOnly` is a schema keyword. */
79
+ isWriteOnly(): boolean;
76
80
  resolve(): OasHttpSecurityScheme;
77
81
  resolveOnce(): OasHttpSecurityScheme;
78
82
  toJsonSchema(): HttpSecuritySchemeJson;
@@ -86,6 +90,10 @@ export declare class OasApiKeySecurityScheme {
86
90
  location: 'query' | 'header' | 'cookie';
87
91
  constructor(fields: ApiKeySecuritySchemeFields);
88
92
  isRef(): this is OasRef<'securityScheme'>;
93
+ /** Always `false`: `readOnly` is a schema keyword. */
94
+ isReadOnly(): boolean;
95
+ /** Always `false`: `writeOnly` is a schema keyword. */
96
+ isWriteOnly(): boolean;
89
97
  resolve(): OasApiKeySecurityScheme;
90
98
  resolveOnce(): OasApiKeySecurityScheme;
91
99
  toJsonSchema(): ApiKeySecuritySchemeJson;
@@ -136,6 +144,10 @@ export declare class OasOAuth2SecurityScheme {
136
144
  };
137
145
  constructor(fields: OAuth2SecuritySchemeFields);
138
146
  isRef(): this is OasRef<'securityScheme'>;
147
+ /** Always `false`: `readOnly` is a schema keyword. */
148
+ isReadOnly(): boolean;
149
+ /** Always `false`: `writeOnly` is a schema keyword. */
150
+ isWriteOnly(): boolean;
139
151
  resolve(): OasOAuth2SecurityScheme;
140
152
  resolveOnce(): OasOAuth2SecurityScheme;
141
153
  toJsonSchema(): OAuth2SecuritySchemeJson;
@@ -148,6 +160,10 @@ export declare class OasOpenIdSecurityScheme {
148
160
  openIdConnectUrl: string;
149
161
  constructor(fields: OpenIdSecuritySchemeFields);
150
162
  isRef(): this is OasRef<'securityScheme'>;
163
+ /** Always `false`: `readOnly` is a schema keyword. */
164
+ isReadOnly(): boolean;
165
+ /** Always `false`: `writeOnly` is a schema keyword. */
166
+ isWriteOnly(): boolean;
151
167
  resolve(): OasOpenIdSecurityScheme;
152
168
  resolveOnce(): OasOpenIdSecurityScheme;
153
169
  toJsonSchema(): OpenIdSecuritySchemeJson;
@@ -47,6 +47,14 @@ class OasHttpSecurityScheme {
47
47
  isRef() {
48
48
  return false;
49
49
  }
50
+ /** Always `false`: `readOnly` is a schema keyword. */
51
+ isReadOnly() {
52
+ return false;
53
+ }
54
+ /** Always `false`: `writeOnly` is a schema keyword. */
55
+ isWriteOnly() {
56
+ return false;
57
+ }
50
58
  resolve() {
51
59
  return this;
52
60
  }
@@ -110,6 +118,14 @@ class OasApiKeySecurityScheme {
110
118
  isRef() {
111
119
  return false;
112
120
  }
121
+ /** Always `false`: `readOnly` is a schema keyword. */
122
+ isReadOnly() {
123
+ return false;
124
+ }
125
+ /** Always `false`: `writeOnly` is a schema keyword. */
126
+ isWriteOnly() {
127
+ return false;
128
+ }
113
129
  resolve() {
114
130
  return this;
115
131
  }
@@ -172,6 +188,14 @@ class OasOAuth2SecurityScheme {
172
188
  isRef() {
173
189
  return false;
174
190
  }
191
+ /** Always `false`: `readOnly` is a schema keyword. */
192
+ isReadOnly() {
193
+ return false;
194
+ }
195
+ /** Always `false`: `writeOnly` is a schema keyword. */
196
+ isWriteOnly() {
197
+ return false;
198
+ }
175
199
  resolve() {
176
200
  return this;
177
201
  }
@@ -238,6 +262,14 @@ class OasOpenIdSecurityScheme {
238
262
  isRef() {
239
263
  return false;
240
264
  }
265
+ /** Always `false`: `readOnly` is a schema keyword. */
266
+ isReadOnly() {
267
+ return false;
268
+ }
269
+ /** Always `false`: `writeOnly` is a schema keyword. */
270
+ isWriteOnly() {
271
+ return false;
272
+ }
241
273
  resolve() {
242
274
  return this;
243
275
  }
@@ -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 { OasSchema, ToJsonSchemaOptions } from '../schema/Schema.js';
@@ -102,8 +103,26 @@ export declare class OasString<Nullable extends boolean | undefined = boolean |
102
103
  * Whether the string is deprecated.
103
104
  */
104
105
  deprecated: boolean | undefined;
106
+ /**
107
+ * The schema's `not`, kept as an `OasUnknown` under `client.json`
108
+ * `system.not: unknown`: the document says "not something", and core does
109
+ * not read what. `undefined` otherwise.
110
+ */
111
+ not: OasUnknown | undefined;
105
112
  constructor(fields?: StringFields<Nullable>, context?: ParseContextType);
106
113
  isRef(): this is OasRef<'schema'>;
114
+ /** Whether the value is `readOnly`: sent by the API only, never in a request. */
115
+ isReadOnly(): boolean;
116
+ /** Whether the value is `writeOnly`: sent in a request only, never by the API. */
117
+ isWriteOnly(): boolean;
118
+ /**
119
+ * A copy of this schema with what `ref` adds at its site applied: its
120
+ * `nullable`, `readOnly`, `writeOnly` and the keywords next to it (`SiblingKeywords`) that
121
+ * this type takes, a sibling's value winning. A value that does not fit
122
+ * this type is left out (the parser reports it). For `OasRef.resolve()`.
123
+ * This schema does not change, and the copy shares its child schemas.
124
+ */
125
+ clone(ref?: OasRef<'schema'>): OasString;
107
126
  traverse(path: SchemaPath): OasSchema | OasRef<'schema'>;
108
127
  resolve(): OasString<Nullable>;
109
128
  resolveOnce(): OasString<Nullable>;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OasString = void 0;
4
4
  require("../../_dnt.polyfills.js");
5
5
  const traverseSchema_js_1 = require("../schemaPath/traverseSchema.js");
6
+ const siblings_js_1 = require("../schema/siblings.js");
6
7
  const OasBase_js_1 = require("../../types/OasBase.js");
7
8
  class OasString extends OasBase_js_1.OasBase {
8
9
  constructor(fields = {}, context) {
@@ -148,6 +149,17 @@ class OasString extends OasBase_js_1.OasBase {
148
149
  writable: true,
149
150
  value: void 0
150
151
  });
152
+ /**
153
+ * The schema's `not`, kept as an `OasUnknown` under `client.json`
154
+ * `system.not: unknown`: the document says "not something", and core does
155
+ * not read what. `undefined` otherwise.
156
+ */
157
+ Object.defineProperty(this, "not", {
158
+ enumerable: true,
159
+ configurable: true,
160
+ writable: true,
161
+ value: undefined
162
+ });
151
163
  this.title = fields.title;
152
164
  this.description = fields.description;
153
165
  this.format = fields.format;
@@ -166,6 +178,41 @@ class OasString extends OasBase_js_1.OasBase {
166
178
  isRef() {
167
179
  return false;
168
180
  }
181
+ /** Whether the value is `readOnly`: sent by the API only, never in a request. */
182
+ isReadOnly() {
183
+ return this.readOnly === true;
184
+ }
185
+ /** Whether the value is `writeOnly`: sent in a request only, never by the API. */
186
+ isWriteOnly() {
187
+ return this.writeOnly === true;
188
+ }
189
+ /**
190
+ * A copy of this schema with what `ref` adds at its site applied: its
191
+ * `nullable`, `readOnly`, `writeOnly` and the keywords next to it (`SiblingKeywords`) that
192
+ * this type takes, a sibling's value winning. A value that does not fit
193
+ * this type is left out (the parser reports it). For `OasRef.resolve()`.
194
+ * This schema does not change, and the copy shares its child schemas.
195
+ */
196
+ clone(ref) {
197
+ const nullable = this.nullable || ref?.nullable || undefined;
198
+ const copy = new OasString({
199
+ ...(0, siblings_js_1.toSiblingAnnotations)(this, ref),
200
+ example: (0, siblings_js_1.toSiblingValue)(ref?.example, siblings_js_1.isStringValue) ?? this.example,
201
+ format: ref?.format ?? this.format,
202
+ enums: (0, siblings_js_1.toSiblingEnums)(ref?.enums, siblings_js_1.isStringValue, nullable) ?? this.enums,
203
+ nullable,
204
+ maxLength: ref?.maxLength ?? this.maxLength,
205
+ minLength: ref?.minLength ?? this.minLength,
206
+ pattern: ref?.pattern ?? this.pattern,
207
+ default: (0, siblings_js_1.toSiblingValue)(ref?.default, siblings_js_1.isStringValue) ?? this.default,
208
+ readOnly: this.readOnly || ref?.readOnly || undefined,
209
+ writeOnly: this.writeOnly || ref?.writeOnly || undefined,
210
+ deprecated: ref?.deprecated ?? this.deprecated,
211
+ });
212
+ copy.stackTrail = this.stackTrail;
213
+ copy.not = this.not;
214
+ return copy;
215
+ }
169
216
  traverse(path) {
170
217
  return (0, traverseSchema_js_1.traverseSchema)(this, path);
171
218
  }