@skmtc/core 0.48.0 → 0.49.1

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 (177) hide show
  1. package/esm/context/CoreContext.d.ts +1 -1
  2. package/esm/context/CoreContext.js +6 -2
  3. package/esm/context/GenerateContext.d.ts +1 -1
  4. package/esm/context/GenerateContext.js +1 -1
  5. package/esm/context/ParseContext.d.ts +4 -4
  6. package/esm/context/ParseContext.js +6 -6
  7. package/esm/context/generateTypes.d.ts +4 -4
  8. package/esm/context/tryParseAt.d.ts +1 -1
  9. package/esm/context/tryParseAt.js +1 -1
  10. package/esm/enrichments/EnrichmentAudit.d.ts +1 -1
  11. package/esm/enrichments/EnrichmentWarning.d.ts +1 -1
  12. package/esm/enrichments/findUnknownKeys.d.ts +1 -1
  13. package/esm/enrichments/findUnknownKeys.js +1 -1
  14. package/esm/enrichments/parseEnrichmentUmbrella.d.ts +1 -1
  15. package/esm/enrichments/parseEnrichmentUmbrella.js +1 -1
  16. package/esm/enrichments/parseEnrichmentValue.d.ts +2 -2
  17. package/esm/enrichments/parseEnrichmentValue.js +2 -2
  18. package/esm/enrichments/readEnrichments.d.ts +4 -4
  19. package/esm/enrichments/readEnrichments.js +4 -4
  20. package/esm/enrichments/validateConfig.d.ts +1 -1
  21. package/esm/helpers/ResultsLog.js +7 -1
  22. package/esm/helpers/applyGeneratedSuffix.d.ts +1 -1
  23. package/esm/helpers/applyGeneratedSuffix.js +1 -1
  24. package/esm/helpers/normalizeWorkspacePath.d.ts +1 -1
  25. package/esm/helpers/normalizeWorkspacePath.js +1 -1
  26. package/esm/helpers/refFns.js +11 -0
  27. package/esm/oas/array/Array.d.ts +2 -2
  28. package/esm/oas/array/Array.js +2 -2
  29. package/esm/oas/boolean/Boolean.d.ts +2 -2
  30. package/esm/oas/boolean/Boolean.js +2 -2
  31. package/esm/oas/integer/Integer.d.ts +2 -2
  32. package/esm/oas/integer/Integer.js +2 -2
  33. package/esm/oas/intersection/Intersection.d.ts +3 -3
  34. package/esm/oas/intersection/Intersection.js +3 -3
  35. package/esm/oas/number/Number.d.ts +2 -2
  36. package/esm/oas/number/Number.js +2 -2
  37. package/esm/oas/object/Object.d.ts +2 -2
  38. package/esm/oas/object/Object.js +2 -2
  39. package/esm/oas/operation/Operation.d.ts +1 -1
  40. package/esm/oas/operation/Operation.js +1 -1
  41. package/esm/oas/operation/toEffectiveParameters.d.ts +2 -2
  42. package/esm/oas/operation/toEffectiveParameters.js +2 -2
  43. package/esm/oas/ref/DanglingRefError.d.ts +1 -1
  44. package/esm/oas/ref/DanglingRefError.js +1 -1
  45. package/esm/oas/ref/Ref.d.ts +2 -2
  46. package/esm/oas/ref/Ref.js +2 -2
  47. package/esm/oas/string/String.d.ts +2 -2
  48. package/esm/oas/string/String.js +2 -2
  49. package/esm/oas/union/Union.d.ts +3 -3
  50. package/esm/oas/union/Union.js +3 -3
  51. package/esm/oas/unknown/Unknown.d.ts +2 -2
  52. package/esm/oas/unknown/Unknown.js +2 -2
  53. package/esm/parse/allOfSystem.d.ts +4 -4
  54. package/esm/parse/allOfSystem.js +2 -2
  55. package/esm/parse/anyOfSystem.d.ts +5 -5
  56. package/esm/parse/anyOfSystem.js +4 -4
  57. package/esm/parse/keptRefs.d.ts +2 -2
  58. package/esm/parse/toCyclicRefs.js +27 -16
  59. package/esm/parse/v3-0/_merge-all-of/merge-union.d.ts +1 -1
  60. package/esm/parse/v3-0/_merge-all-of/merge-union.js +3 -3
  61. package/esm/parse/v3-0/_merge-all-of/merge.js +2 -2
  62. package/esm/parse/v3-0/_merge-all-of/types.d.ts +4 -4
  63. package/esm/parse/v3-0/ref/toRefV31.js +1 -1
  64. package/esm/parse/v3-0/schema/toSchemasV3.js +3 -3
  65. package/esm/parse/v3-1/_merge-all-of/merge-union.d.ts +1 -1
  66. package/esm/parse/v3-1/_merge-all-of/merge-union.js +3 -3
  67. package/esm/parse/v3-1/_merge-all-of/merge.js +2 -2
  68. package/esm/parse/v3-1/_merge-all-of/types.d.ts +4 -4
  69. package/esm/parse/v3-1/ref/toRefV31.js +1 -1
  70. package/esm/parse/v3-1/schema/toSchemasV3.js +3 -3
  71. package/esm/parse/v3-2/_merge-all-of/merge-union.d.ts +1 -1
  72. package/esm/parse/v3-2/_merge-all-of/merge-union.js +3 -3
  73. package/esm/parse/v3-2/_merge-all-of/merge.js +2 -2
  74. package/esm/parse/v3-2/_merge-all-of/types.d.ts +4 -4
  75. package/esm/parse/v3-2/ref/toRefV31.js +1 -1
  76. package/esm/parse/v3-2/schema/toSchemasV3.js +3 -3
  77. package/esm/run/toEnrichmentDefaults.d.ts +1 -1
  78. package/esm/run/toEnrichmentDefaults.js +1 -1
  79. package/esm/types/EnrichmentDefaults.d.ts +1 -1
  80. package/esm/types/EnrichmentDefaults.js +1 -1
  81. package/esm/types/Enrichments.d.ts +1 -1
  82. package/esm/types/JsonPointer.js +2 -2
  83. package/esm/types/Manifest.d.ts +1 -1
  84. package/esm/types/ModuleSelect.d.ts +1 -1
  85. package/esm/types/Settings.d.ts +29 -11
  86. package/esm/types/Settings.js +13 -6
  87. package/esm/types/Variant.d.ts +3 -3
  88. package/esm/types/Variant.js +3 -3
  89. package/package.json +1 -1
  90. package/script/context/CoreContext.d.ts +1 -1
  91. package/script/context/CoreContext.js +6 -2
  92. package/script/context/GenerateContext.d.ts +1 -1
  93. package/script/context/GenerateContext.js +1 -1
  94. package/script/context/ParseContext.d.ts +4 -4
  95. package/script/context/ParseContext.js +6 -6
  96. package/script/context/generateTypes.d.ts +4 -4
  97. package/script/context/tryParseAt.d.ts +1 -1
  98. package/script/context/tryParseAt.js +1 -1
  99. package/script/enrichments/EnrichmentAudit.d.ts +1 -1
  100. package/script/enrichments/EnrichmentWarning.d.ts +1 -1
  101. package/script/enrichments/findUnknownKeys.d.ts +1 -1
  102. package/script/enrichments/findUnknownKeys.js +1 -1
  103. package/script/enrichments/parseEnrichmentUmbrella.d.ts +1 -1
  104. package/script/enrichments/parseEnrichmentUmbrella.js +1 -1
  105. package/script/enrichments/parseEnrichmentValue.d.ts +2 -2
  106. package/script/enrichments/parseEnrichmentValue.js +2 -2
  107. package/script/enrichments/readEnrichments.d.ts +4 -4
  108. package/script/enrichments/readEnrichments.js +4 -4
  109. package/script/enrichments/validateConfig.d.ts +1 -1
  110. package/script/helpers/ResultsLog.js +7 -1
  111. package/script/helpers/applyGeneratedSuffix.d.ts +1 -1
  112. package/script/helpers/applyGeneratedSuffix.js +1 -1
  113. package/script/helpers/normalizeWorkspacePath.d.ts +1 -1
  114. package/script/helpers/normalizeWorkspacePath.js +1 -1
  115. package/script/helpers/refFns.js +11 -0
  116. package/script/oas/array/Array.d.ts +2 -2
  117. package/script/oas/array/Array.js +2 -2
  118. package/script/oas/boolean/Boolean.d.ts +2 -2
  119. package/script/oas/boolean/Boolean.js +2 -2
  120. package/script/oas/integer/Integer.d.ts +2 -2
  121. package/script/oas/integer/Integer.js +2 -2
  122. package/script/oas/intersection/Intersection.d.ts +3 -3
  123. package/script/oas/intersection/Intersection.js +3 -3
  124. package/script/oas/number/Number.d.ts +2 -2
  125. package/script/oas/number/Number.js +2 -2
  126. package/script/oas/object/Object.d.ts +2 -2
  127. package/script/oas/object/Object.js +2 -2
  128. package/script/oas/operation/Operation.d.ts +1 -1
  129. package/script/oas/operation/Operation.js +1 -1
  130. package/script/oas/operation/toEffectiveParameters.d.ts +2 -2
  131. package/script/oas/operation/toEffectiveParameters.js +2 -2
  132. package/script/oas/ref/DanglingRefError.d.ts +1 -1
  133. package/script/oas/ref/DanglingRefError.js +1 -1
  134. package/script/oas/ref/Ref.d.ts +2 -2
  135. package/script/oas/ref/Ref.js +2 -2
  136. package/script/oas/string/String.d.ts +2 -2
  137. package/script/oas/string/String.js +2 -2
  138. package/script/oas/union/Union.d.ts +3 -3
  139. package/script/oas/union/Union.js +3 -3
  140. package/script/oas/unknown/Unknown.d.ts +2 -2
  141. package/script/oas/unknown/Unknown.js +2 -2
  142. package/script/parse/allOfSystem.d.ts +4 -4
  143. package/script/parse/allOfSystem.js +2 -2
  144. package/script/parse/anyOfSystem.d.ts +5 -5
  145. package/script/parse/anyOfSystem.js +4 -4
  146. package/script/parse/keptRefs.d.ts +2 -2
  147. package/script/parse/toCyclicRefs.js +27 -16
  148. package/script/parse/v3-0/_merge-all-of/merge-union.d.ts +1 -1
  149. package/script/parse/v3-0/_merge-all-of/merge-union.js +3 -3
  150. package/script/parse/v3-0/_merge-all-of/merge.js +2 -2
  151. package/script/parse/v3-0/_merge-all-of/types.d.ts +4 -4
  152. package/script/parse/v3-0/ref/toRefV31.js +1 -1
  153. package/script/parse/v3-0/schema/toSchemasV3.js +3 -3
  154. package/script/parse/v3-1/_merge-all-of/merge-union.d.ts +1 -1
  155. package/script/parse/v3-1/_merge-all-of/merge-union.js +3 -3
  156. package/script/parse/v3-1/_merge-all-of/merge.js +2 -2
  157. package/script/parse/v3-1/_merge-all-of/types.d.ts +4 -4
  158. package/script/parse/v3-1/ref/toRefV31.js +1 -1
  159. package/script/parse/v3-1/schema/toSchemasV3.js +3 -3
  160. package/script/parse/v3-2/_merge-all-of/merge-union.d.ts +1 -1
  161. package/script/parse/v3-2/_merge-all-of/merge-union.js +3 -3
  162. package/script/parse/v3-2/_merge-all-of/merge.js +2 -2
  163. package/script/parse/v3-2/_merge-all-of/types.d.ts +4 -4
  164. package/script/parse/v3-2/ref/toRefV31.js +1 -1
  165. package/script/parse/v3-2/schema/toSchemasV3.js +3 -3
  166. package/script/run/toEnrichmentDefaults.d.ts +1 -1
  167. package/script/run/toEnrichmentDefaults.js +1 -1
  168. package/script/types/EnrichmentDefaults.d.ts +1 -1
  169. package/script/types/EnrichmentDefaults.js +1 -1
  170. package/script/types/Enrichments.d.ts +1 -1
  171. package/script/types/JsonPointer.js +2 -2
  172. package/script/types/Manifest.d.ts +1 -1
  173. package/script/types/ModuleSelect.d.ts +1 -1
  174. package/script/types/Settings.d.ts +29 -11
  175. package/script/types/Settings.js +14 -7
  176. package/script/types/Variant.d.ts +3 -3
  177. package/script/types/Variant.js +3 -3
@@ -260,8 +260,8 @@ export class OasObject extends OasBase {
260
260
  * ```
261
261
  */
262
262
  /**
263
- * The schema's `not`, kept as an `OasUnknown` under `client.json`
264
- * `system.not: unknown`: the document says "not something", and core does
263
+ * The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
264
+ * `parse.not: unknown`: the document says "not something", and core does
265
265
  * not read what. `undefined` otherwise.
266
266
  */
267
267
  Object.defineProperty(this, "not", {
@@ -153,7 +153,7 @@ export declare class OasOperation extends OasBase {
153
153
  * The path item's come first.
154
154
  *
155
155
  * References stay references, so a caller can resolve each one on its own.
156
- * A reference that names nothing (kept when `system.danglingRefs` lists
156
+ * A reference that names nothing (kept when `parse.danglingRefs` lists
157
157
  * `parameter`) keeps its place, and resolving it throws `DanglingRefError`.
158
158
  * {@link OasOperation.toParams} resolves them all.
159
159
  *
@@ -226,7 +226,7 @@ export class OasOperation extends OasBase {
226
226
  * The path item's come first.
227
227
  *
228
228
  * References stay references, so a caller can resolve each one on its own.
229
- * A reference that names nothing (kept when `system.danglingRefs` lists
229
+ * A reference that names nothing (kept when `parse.danglingRefs` lists
230
230
  * `parameter`) keeps its place, and resolving it throws `DanglingRefError`.
231
231
  * {@link OasOperation.toParams} resolves them all.
232
232
  *
@@ -12,14 +12,14 @@ type ToEffectiveParametersArgs = {
12
12
  * them: the path item's first, then its own. An own parameter with the same
13
13
  * name and location replaces the path item's. References stay references.
14
14
  *
15
- * A reference that names nothing (kept when `system.danglingRefs` lists
15
+ * A reference that names nothing (kept when `parse.danglingRefs` lists
16
16
  * `parameter`) has no name or location. It keeps its place, and only the
17
17
  * same `$ref` replaces it.
18
18
  */
19
19
  export declare const toEffectiveParameters: ({ own, shared }: ToEffectiveParametersArgs) => Parameter[];
20
20
  /**
21
21
  * True for a parameter `$ref` that names nothing in the document, which the
22
- * parser keeps when `system.danglingRefs` lists `parameter`.
22
+ * parser keeps when `parse.danglingRefs` lists `parameter`.
23
23
  */
24
24
  export declare const namesNothing: (parameter: Parameter) => boolean;
25
25
  export {};
@@ -4,7 +4,7 @@ import { DanglingRefError } from '../ref/DanglingRefError.js';
4
4
  * them: the path item's first, then its own. An own parameter with the same
5
5
  * name and location replaces the path item's. References stay references.
6
6
  *
7
- * A reference that names nothing (kept when `system.danglingRefs` lists
7
+ * A reference that names nothing (kept when `parse.danglingRefs` lists
8
8
  * `parameter`) has no name or location. It keeps its place, and only the
9
9
  * same `$ref` replaces it.
10
10
  */
@@ -14,7 +14,7 @@ export const toEffectiveParameters = ({ own = [], shared = [] }) => {
14
14
  };
15
15
  /**
16
16
  * True for a parameter `$ref` that names nothing in the document, which the
17
- * parser keeps when `system.danglingRefs` lists `parameter`.
17
+ * parser keeps when `parse.danglingRefs` lists `parameter`.
18
18
  */
19
19
  export const namesNothing = (parameter) => {
20
20
  if (!parameter.isRef()) {
@@ -18,7 +18,7 @@ type DanglingRefErrorOptions = {
18
18
  * component.
19
19
  *
20
20
  * By default the parser removes what holds such a reference, so a generator
21
- * never meets one. When `client.json` `system.danglingRefs` lists the
21
+ * never meets one. When `skmtc.config.json` `parse.danglingRefs` lists the
22
22
  * reference's kind, it stays, and a generator that resolves it can catch
23
23
  * this error and render something else in its place. Test for it with
24
24
  * {@link DanglingRefError.is}, not `instanceof`.
@@ -7,7 +7,7 @@ import "../../_dnt.polyfills.js";
7
7
  * component.
8
8
  *
9
9
  * By default the parser removes what holds such a reference, so a generator
10
- * never meets one. When `client.json` `system.danglingRefs` lists the
10
+ * never meets one. When `skmtc.config.json` `parse.danglingRefs` lists the
11
11
  * reference's kind, it stays, and a generator that resolves it can catch
12
12
  * this error and render something else in its place. Test for it with
13
13
  * {@link DanglingRefError.is}, not `instanceof`.
@@ -241,7 +241,7 @@ export declare class OasRef<T extends OasRefData['refType']> extends OasBase {
241
241
  * @returns The resolved component
242
242
  * @throws {DanglingRefError} when a reference on the chain names nothing,
243
243
  * or the chain loops ({@link toLoop}), so it never reaches a component.
244
- * The parser keeps either one only when `system.danglingRefs` lists its kind.
244
+ * The parser keeps either one only when `parse.danglingRefs` lists its kind.
245
245
  * @throws Error when a reference on the chain names a component of another
246
246
  * kind (see {@link resolveOnce})
247
247
  */
@@ -264,7 +264,7 @@ export declare class OasRef<T extends OasRefData['refType']> extends OasBase {
264
264
  *
265
265
  * @returns Either the resolved component or another reference in the chain
266
266
  * @throws {DanglingRefError} when the reference names nothing in the
267
- * document (kept when `client.json` `system.danglingRefs` lists its kind),
267
+ * document (kept when `skmtc.config.json` `parse.danglingRefs` lists its kind),
268
268
  * including a `$ref` with no name, such as `#/components/schemas/`
269
269
  * @throws Error when it names a component of another kind, such as a
270
270
  * `requestBody` ref to `#/components/schemas/…`
@@ -438,7 +438,7 @@ export class OasRef extends OasBase {
438
438
  * @returns The resolved component
439
439
  * @throws {DanglingRefError} when a reference on the chain names nothing,
440
440
  * or the chain loops ({@link toLoop}), so it never reaches a component.
441
- * The parser keeps either one only when `system.danglingRefs` lists its kind.
441
+ * The parser keeps either one only when `parse.danglingRefs` lists its kind.
442
442
  * @throws Error when a reference on the chain names a component of another
443
443
  * kind (see {@link resolveOnce})
444
444
  */
@@ -465,7 +465,7 @@ export class OasRef extends OasBase {
465
465
  *
466
466
  * @returns Either the resolved component or another reference in the chain
467
467
  * @throws {DanglingRefError} when the reference names nothing in the
468
- * document (kept when `client.json` `system.danglingRefs` lists its kind),
468
+ * document (kept when `skmtc.config.json` `parse.danglingRefs` lists its kind),
469
469
  * including a `$ref` with no name, such as `#/components/schemas/`
470
470
  * @throws Error when it names a component of another kind, such as a
471
471
  * `requestBody` ref to `#/components/schemas/…`
@@ -104,8 +104,8 @@ export declare class OasString<Nullable extends boolean | undefined = boolean |
104
104
  */
105
105
  deprecated: boolean | undefined;
106
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
107
+ * The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
108
+ * `parse.not: unknown`: the document says "not something", and core does
109
109
  * not read what. `undefined` otherwise.
110
110
  */
111
111
  not: OasUnknown | undefined;
@@ -147,8 +147,8 @@ export class OasString extends OasBase {
147
147
  value: void 0
148
148
  });
149
149
  /**
150
- * The schema's `not`, kept as an `OasUnknown` under `client.json`
151
- * `system.not: unknown`: the document says "not something", and core does
150
+ * The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
151
+ * `parse.not: unknown`: the document says "not something", and core does
152
152
  * not read what. `undefined` otherwise.
153
153
  */
154
154
  Object.defineProperty(this, "not", {
@@ -188,8 +188,8 @@ export declare class OasUnion extends OasBase {
188
188
  */
189
189
  default?: unknown;
190
190
  /**
191
- * The schema's `not`, kept as an `OasUnknown` under `client.json`
192
- * `system.not: unknown`: the document says "not something", and core does
191
+ * The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
192
+ * `parse.not: unknown`: the document says "not something", and core does
193
193
  * not read what. `undefined` otherwise.
194
194
  */
195
195
  not: OasUnknown | undefined;
@@ -217,7 +217,7 @@ export declare class OasUnion extends OasBase {
217
217
  * property, and that allows only string literals for it. No value may
218
218
  * belong to two members. A member that is a union, or anything other than
219
219
  * an object, makes it `false`, as does a reference on the way that names
220
- * nothing in the document (kept when `system.danglingRefs` lists `schema`).
220
+ * nothing in the document (kept when `parse.danglingRefs` lists `schema`).
221
221
  *
222
222
  * It reads the schemas only. A generator may refuse more: one that leaves
223
223
  * out `readOnly` properties cannot discriminate on one.
@@ -216,8 +216,8 @@ export class OasUnion extends OasBase {
216
216
  value: void 0
217
217
  });
218
218
  /**
219
- * The schema's `not`, kept as an `OasUnknown` under `client.json`
220
- * `system.not: unknown`: the document says "not something", and core does
219
+ * The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
220
+ * `parse.not: unknown`: the document says "not something", and core does
221
221
  * not read what. `undefined` otherwise.
222
222
  */
223
223
  Object.defineProperty(this, "not", {
@@ -285,7 +285,7 @@ export class OasUnion extends OasBase {
285
285
  * property, and that allows only string literals for it. No value may
286
286
  * belong to two members. A member that is a union, or anything other than
287
287
  * an object, makes it `false`, as does a reference on the way that names
288
- * nothing in the document (kept when `system.danglingRefs` lists `schema`).
288
+ * nothing in the document (kept when `parse.danglingRefs` lists `schema`).
289
289
  *
290
290
  * It reads the schemas only. A generator may refuse more: one that leaves
291
291
  * out `readOnly` properties cannot discriminate on one.
@@ -44,8 +44,8 @@ export declare class OasUnknown extends OasBase {
44
44
  /** Whether the unknown type is nullable */
45
45
  nullable: boolean | undefined;
46
46
  /**
47
- * The schema's `not`, kept as an `OasUnknown` under `client.json`
48
- * `system.not: unknown`: the document says "not something", and core does
47
+ * The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
48
+ * `parse.not: unknown`: the document says "not something", and core does
49
49
  * not read what. `undefined` otherwise.
50
50
  */
51
51
  not: OasUnknown | undefined;
@@ -71,8 +71,8 @@ export class OasUnknown extends OasBase {
71
71
  value: void 0
72
72
  });
73
73
  /**
74
- * The schema's `not`, kept as an `OasUnknown` under `client.json`
75
- * `system.not: unknown`: the document says "not something", and core does
74
+ * The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
75
+ * `parse.not: unknown`: the document says "not something", and core does
76
76
  * not read what. `undefined` otherwise.
77
77
  */
78
78
  Object.defineProperty(this, "not", {
@@ -1,16 +1,16 @@
1
1
  import type { ParseContextType } from '../context/parseTypes.js';
2
2
  import type { KeptRefs } from './keptRefs.js';
3
3
  import type { StackTrail } from '../context/StackTrail.js';
4
- /** What the `allOf` merge reads of `client.json#settings.system`, and what it reports back. */
4
+ /** What the `allOf` merge reads of `skmtc.config.json#settings.parse`, and what it reports back. */
5
5
  type AllOfSystem = {
6
6
  allOf: 'strict' | 'latestWins';
7
7
  not: 'strict' | 'unknown';
8
8
  anyOf: 'union' | 'unknown';
9
9
  /** The keywords a later member replaced under `latestWins`. */
10
10
  replaced: Set<string>;
11
- /** The keywords the merge read as any value: `anyOf` under `system.anyOf: unknown`. */
11
+ /** The keywords the merge read as any value: `anyOf` under `parse.anyOf: unknown`. */
12
12
  unknown: Set<string>;
13
- /** The refs that stay refs (`system.intersections`). */
13
+ /** The refs that stay refs (`parse.intersections`). */
14
14
  keptRefs: KeptRefs | undefined;
15
15
  };
16
16
  /**
@@ -28,7 +28,7 @@ type LogAllOfContradictionsArgs = {
28
28
  };
29
29
  /**
30
30
  * One warning for a schema whose `allOf` members contradicted, naming the
31
- * keywords the later member kept (`system.allOf: latestWins`). Nothing when
31
+ * keywords the later member kept (`parse.allOf: latestWins`). Nothing when
32
32
  * no keyword was replaced.
33
33
  */
34
34
  export declare const logAllOfContradictions: ({ system, stackTrail, parent, context }: LogAllOfContradictionsArgs) => void;
@@ -14,7 +14,7 @@ export const toAllOfSystem = (context) => ({
14
14
  });
15
15
  /**
16
16
  * One warning for a schema whose `allOf` members contradicted, naming the
17
- * keywords the later member kept (`system.allOf: latestWins`). Nothing when
17
+ * keywords the later member kept (`parse.allOf: latestWins`). Nothing when
18
18
  * no keyword was replaced.
19
19
  */
20
20
  export const logAllOfContradictions = ({ system, stackTrail, parent, context }) => {
@@ -23,7 +23,7 @@ export const logAllOfContradictions = ({ system, stackTrail, parent, context })
23
23
  }
24
24
  context.logIssueNoKey({
25
25
  level: 'warning',
26
- message: `The allOf members contradict on ${[...system.replaced].join(', ')}; the later member's values are kept (system.allOf is latestWins).`,
26
+ message: `The allOf members contradict on ${[...system.replaced].join(', ')}; the later member's values are kept (parse.allOf is latestWins).`,
27
27
  parent,
28
28
  stackTrail,
29
29
  type: 'ALLOF_CONTRADICTION'
@@ -9,12 +9,12 @@ type GetRefFn = (ref: OpenAPIV3.ReferenceObject) => OpenAPIV3.SchemaObject;
9
9
  type IsUnknownAnyOfArgs = {
10
10
  /** The `anyOf` members, as the document writes them. */
11
11
  members: readonly (OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject)[];
12
- /** `client.json` `system.anyOf`. A test's mock context may have none. */
12
+ /** `skmtc.config.json` `parse.anyOf`. A test's mock context may have none. */
13
13
  setting: 'union' | 'unknown' | undefined;
14
14
  getRef: GetRefFn;
15
15
  };
16
16
  /**
17
- * Whether `system.anyOf: unknown` reads an `anyOf` as any value, as
17
+ * Whether `parse.anyOf: unknown` reads an `anyOf` as any value, as
18
18
  * Cloudflare's `cf` reads it: when it has two or more members, not counting a
19
19
  * `null` one, and one of them is not a single value.
20
20
  *
@@ -27,13 +27,13 @@ export declare const isUnknownAnyOf: ({ members, setting, getRef }: IsUnknownAny
27
27
  /** Arguments for {@link withoutUnknownAnyOf}. */
28
28
  type WithoutUnknownAnyOfArgs = {
29
29
  schema: OpenAPIV3.SchemaObject;
30
- /** `client.json` `system.anyOf`. */
30
+ /** `skmtc.config.json` `parse.anyOf`. */
31
31
  setting: 'union' | 'unknown' | undefined;
32
32
  getRef: GetRefFn;
33
33
  };
34
34
  /**
35
35
  * `schema` with its other keywords and without an `anyOf` that
36
- * `system.anyOf: unknown` reads as any value ({@link isUnknownAnyOf}), so the
36
+ * `parse.anyOf: unknown` reads as any value ({@link isUnknownAnyOf}), so the
37
37
  * properties next to the `anyOf` stay. A `null` member makes it nullable. Any
38
38
  * other schema is returned as it is.
39
39
  */
@@ -63,6 +63,6 @@ type LogMergedUnknownAnyOfArgs = LogUnknownAnyOfArgs & {
63
63
  };
64
64
  /** One warning for a schema whose merge read an `anyOf` as any value. Nothing when it read none. */
65
65
  export declare const logMergedUnknownAnyOf: ({ system, stackTrail, parent, context }: LogMergedUnknownAnyOfArgs) => void;
66
- /** One warning for a schema whose `anyOf` was read as any value (`system.anyOf: unknown`). */
66
+ /** One warning for a schema whose `anyOf` was read as any value (`parse.anyOf: unknown`). */
67
67
  export declare const logUnknownAnyOf: ({ stackTrail, parent, context }: LogUnknownAnyOfArgs) => void;
68
68
  export {};
@@ -36,7 +36,7 @@ const isScalarMember = (member) => {
36
36
  */
37
37
  const toMemberSchema = (member, getRef) => ('$ref' in member ? getRef(member) : member);
38
38
  /**
39
- * Whether `system.anyOf: unknown` reads an `anyOf` as any value, as
39
+ * Whether `parse.anyOf: unknown` reads an `anyOf` as any value, as
40
40
  * Cloudflare's `cf` reads it: when it has two or more members, not counting a
41
41
  * `null` one, and one of them is not a single value.
42
42
  *
@@ -54,7 +54,7 @@ export const isUnknownAnyOf = ({ members, setting, getRef }) => {
54
54
  };
55
55
  /**
56
56
  * `schema` with its other keywords and without an `anyOf` that
57
- * `system.anyOf: unknown` reads as any value ({@link isUnknownAnyOf}), so the
57
+ * `parse.anyOf: unknown` reads as any value ({@link isUnknownAnyOf}), so the
58
58
  * properties next to the `anyOf` stay. A `null` member makes it nullable. Any
59
59
  * other schema is returned as it is.
60
60
  */
@@ -93,11 +93,11 @@ export const logMergedUnknownAnyOf = ({ system, stackTrail, parent, context }) =
93
93
  logUnknownAnyOf({ stackTrail, parent, context });
94
94
  }
95
95
  };
96
- /** One warning for a schema whose `anyOf` was read as any value (`system.anyOf: unknown`). */
96
+ /** One warning for a schema whose `anyOf` was read as any value (`parse.anyOf: unknown`). */
97
97
  export const logUnknownAnyOf = ({ stackTrail, parent, context }) => {
98
98
  context.logIssueNoKey({
99
99
  level: 'warning',
100
- message: 'The anyOf is read as any value (system.anyOf is unknown): the schema keeps its other keywords, without the anyOf members.',
100
+ message: 'The anyOf is read as any value (parse.anyOf is unknown): the schema keeps its other keywords, without the anyOf members.',
101
101
  parent,
102
102
  stackTrail,
103
103
  type: 'ANYOF_AS_UNKNOWN'
@@ -2,7 +2,7 @@ import type { OpenAPIV3 } from 'openapi-types';
2
2
  type SchemaObject = OpenAPIV3.SchemaObject;
3
3
  type ReferenceObject = OpenAPIV3.ReferenceObject;
4
4
  type SchemaOrReference = SchemaObject | ReferenceObject;
5
- /** The refs that `system.intersections` keeps out of a merge. */
5
+ /** The refs that `parse.intersections` keeps out of a merge. */
6
6
  export type KeptRefs = {
7
7
  /** Whether a merge keeps this `$ref` object as a ref. */
8
8
  has: (ref: ReferenceObject) => boolean;
@@ -15,7 +15,7 @@ export type KeptRefs = {
15
15
  };
16
16
  type ToKeptRefsArgs = {
17
17
  documentObject: OpenAPIV3.Document;
18
- /** `client.json` `system.intersections`. */
18
+ /** `skmtc.config.json` `parse.intersections`. */
19
19
  setting: 'merge' | 'cycles' | 'all' | undefined;
20
20
  };
21
21
  /** The refs a merge of this document keeps, or `undefined` under `merge`. */
@@ -4,34 +4,45 @@ import { isRef, toRawRefTarget, toRefParts, toRefPathBucket, toRefPointer, toSch
4
4
  const DATA_KEYWORDS = ['default', 'example', 'examples', 'enum', 'const'];
5
5
  /** Keywords whose value is a map of names to schemas: a name in it is not a keyword. */
6
6
  const SCHEMA_MAP_KEYWORDS = ['properties', 'patternProperties', '$defs', 'definitions', 'dependentSchemas'];
7
- /** Every `$ref` object anywhere inside a raw schema. */
8
- const toSchemaRefs = (value) => {
7
+ /** Every `$ref` object anywhere inside a raw schema, added to `found` in document order. */
8
+ const toSchemaRefs = (value, found = []) => {
9
9
  if (Array.isArray(value)) {
10
- return value.flatMap(toSchemaRefs);
10
+ value.forEach(item => toSchemaRefs(item, found));
11
+ return found;
11
12
  }
12
13
  if (!isPlainObject(value)) {
13
- return [];
14
+ return found;
14
15
  }
15
- const nested = Object.entries(value).flatMap(([key, child]) => {
16
+ if (isRef(value)) {
17
+ found.push(value);
18
+ }
19
+ Object.entries(value).forEach(([key, child]) => {
16
20
  if (DATA_KEYWORDS.includes(key) || key.startsWith('x-')) {
17
- return [];
21
+ return;
22
+ }
23
+ if (SCHEMA_MAP_KEYWORDS.includes(key) && isPlainObject(child)) {
24
+ Object.values(child).forEach(member => toSchemaRefs(member, found));
25
+ }
26
+ else {
27
+ toSchemaRefs(child, found);
18
28
  }
19
- return SCHEMA_MAP_KEYWORDS.includes(key) && isPlainObject(child)
20
- ? Object.values(child).flatMap(toSchemaRefs)
21
- : toSchemaRefs(child);
22
29
  });
23
- return isRef(value) ? [value, ...nested] : nested;
30
+ return found;
24
31
  };
25
- /** Every `$ref` object anywhere in a raw document. */
26
- const toDocumentRefs = (value) => {
32
+ /** Every `$ref` object anywhere in a raw document, added to `found` in document order. */
33
+ const toDocumentRefs = (value, found = []) => {
27
34
  if (Array.isArray(value)) {
28
- return value.flatMap(toDocumentRefs);
35
+ value.forEach(item => toDocumentRefs(item, found));
36
+ return found;
29
37
  }
30
38
  if (!isPlainObject(value)) {
31
- return [];
39
+ return found;
40
+ }
41
+ if (isRef(value)) {
42
+ found.push(value);
32
43
  }
33
- const nested = Object.values(value).flatMap(toDocumentRefs);
34
- return isRef(value) ? [value, ...nested] : nested;
44
+ Object.values(value).forEach(child => toDocumentRefs(child, found));
45
+ return found;
35
46
  };
36
47
  /** Whether a ref can point at a schema: not a remote one, and not one to another kind of component. */
37
48
  const canNameSchema = ({ refName, refPath }) => {
@@ -14,7 +14,7 @@ type MergeCrossProductArgs = {
14
14
  groupType: 'oneOf' | 'anyOf';
15
15
  };
16
16
  /**
17
- * The `system` a member's own `allOf` merges under: the `client.json`
17
+ * The `system` a member's own `allOf` merges under: the `skmtc.config.json`
18
18
  * setting, also in the first pass over a cross product's pairs.
19
19
  */
20
20
  export declare const toOwnSystem: (system: MergeSystem) => MergeSystem;
@@ -30,7 +30,7 @@ export const mergeUnion = ({ schema, getRef, system, groupType }) => {
30
30
  return output;
31
31
  };
32
32
  /**
33
- * The `system` a member's own `allOf` merges under: the `client.json`
33
+ * The `system` a member's own `allOf` merges under: the `skmtc.config.json`
34
34
  * setting, also in the first pass over a cross product's pairs.
35
35
  */
36
36
  export const toOwnSystem = (system) => ({
@@ -46,13 +46,13 @@ export const toOwnSystem = (system) => ({
46
46
  * collections say `result` is an object or a string, then an array.
47
47
  *
48
48
  * The first pass is strict between the two members of a pair only. A
49
- * member's own `allOf` merges under the `client.json` setting
49
+ * member's own `allOf` merges under the `skmtc.config.json` setting
50
50
  * ({@link toOwnSystem}). Inside an outer first pass under `latestWins`, a
51
51
  * cross product with no pair that merges fails its pair: the outer pass then
52
52
  * leaves the pair out, or lets the later member win.
53
53
  *
54
54
  * A `$ref` that names nothing is not a contradiction, so its pair is not left
55
- * out for it: the `DanglingRefError` is thrown on, and `system.danglingRefs`
55
+ * out for it: the `DanglingRefError` is thrown on, and `parse.danglingRefs`
56
56
  * decides (`allOfMember`).
57
57
  */
58
58
  const mergePairs = ({ pairs, merge, system }) => {
@@ -41,7 +41,7 @@ export const mergeSchemasOrRefs = ({ first, second, getRef, system }) => {
41
41
  if (isRef(second)) {
42
42
  throw new Error('Ref in second');
43
43
  }
44
- // Under `system.anyOf: unknown` an `anyOf` of two or more members is any
44
+ // Under `parse.anyOf: unknown` an `anyOf` of two or more members is any
45
45
  // value, so it adds nothing to the merge: its members are left out, and the
46
46
  // keywords next to it merge as usual.
47
47
  const firstKeywords = withoutUnknownAnyOf({ schema: first, setting: system.anyOf, getRef });
@@ -51,7 +51,7 @@ export const mergeSchemasOrRefs = ({ first, second, getRef, system }) => {
51
51
  return mergeSchemasOrRefs({ first: firstKeywords, second: secondKeywords, getRef, system });
52
52
  }
53
53
  if (containsAllOf(first) || containsAllOf(second)) {
54
- // Each member's own `allOf` merges under the `client.json` setting, also in
54
+ // Each member's own `allOf` merges under the `skmtc.config.json` setting, also in
55
55
  // the strict first pass over a cross product's pairs.
56
56
  const ownSystem = toOwnSystem(system);
57
57
  const mergedFirst = containsAllOf(first) ? mergeIntersection({ schema: first, getRef, system: ownSystem }) : first;
@@ -3,7 +3,7 @@ import * as v from 'valibot';
3
3
  import type { KeptRefs } from '../../keptRefs.js';
4
4
  export type GetRefFn = (ref: OpenAPIV3.ReferenceObject) => OpenAPIV3.SchemaObject;
5
5
  /**
6
- * The `system` settings as the merge reads them (`client.json#settings.system`),
6
+ * The `system` settings as the merge reads them (`skmtc.config.json#settings.parse`),
7
7
  * and the keywords a later `allOf` member replaced under `latestWins`, so
8
8
  * the parser can name them in one warning for the schema.
9
9
  */
@@ -13,7 +13,7 @@ export type MergeSystem = {
13
13
  /** `unknown`: a member with `not` merges, its `not` carried as written. Left out: `strict`, which refuses it. */
14
14
  not?: 'strict' | 'unknown';
15
15
  /**
16
- * `client.json` `system.allOf`, kept while the first pass over a cross
16
+ * `skmtc.config.json` `parse.allOf`, kept while the first pass over a cross
17
17
  * product's pairs sets `allOf` to `strict`. A member's own `allOf` merges
18
18
  * under this setting in every pass. Left out: `allOf` is the setting.
19
19
  */
@@ -21,9 +21,9 @@ export type MergeSystem = {
21
21
  replaced: Set<string>;
22
22
  /** `unknown`: an `anyOf` of two or more members is any value, so it adds nothing to the merge. Left out: `union`. */
23
23
  anyOf?: 'union' | 'unknown';
24
- /** The keywords the merge read as any value: `anyOf` under `system.anyOf: unknown`. */
24
+ /** The keywords the merge read as any value: `anyOf` under `parse.anyOf: unknown`. */
25
25
  unknown?: Set<string>;
26
- /** The refs that stay refs (`system.intersections`). Left out: every ref is followed. */
26
+ /** The refs that stay refs (`parse.intersections`). Left out: every ref is followed. */
27
27
  keptRefs?: KeptRefs;
28
28
  };
29
29
  export type OneOfObject = {
@@ -7,7 +7,7 @@ export const toRefV31 = ({ ref, refType, stackTrail, context, nullable, readOnly
7
7
  }
8
8
  const oasRef = context.withStackTrail(stackTrail, () => new OasRef({ ...siblings, refType, $ref, nullable, readOnly, writeOnly }, context));
9
9
  // The parse context checks each ref once the document is parsed, and
10
- // removes what holds a ref that names nothing (`system.danglingRefs`).
10
+ // removes what holds a ref that names nothing (`parse.danglingRefs`).
11
11
  context.registerOasRef(stackTrail.clone(), oasRef);
12
12
  return oasRef;
13
13
  };
@@ -98,12 +98,12 @@ export const toSchemaV3 = ({ schema, stackTrail, context }) => {
98
98
  }
99
99
  // OpenAPI `not` has no faithful TypeScript representation: a generated type
100
100
  // that ignored it would *widen* the contract (accepting shapes the schema
101
- // forbids). Under `client.json` `system.not: strict` (the default) the schema
101
+ // forbids). Under `skmtc.config.json` `parse.not: strict` (the default) the schema
102
102
  // is refused rather than emit a type that lies. The throw is isolated by
103
103
  // `tryParseAt` into an `INVALID_SCHEMA` issue, and consumers of this schema
104
104
  // are pruned via `removeErroredItems` (INVALID_DEPENDENCY_REF).
105
105
  //
106
- // Under `system.not: unknown` the schema parses with its other keywords, and
106
+ // Under `parse.not: unknown` the schema parses with its other keywords, and
107
107
  // its `not` is kept as an `OasUnknown` that core does not read: a generator
108
108
  // can see that the document says "not something".
109
109
  if ('not' in schema) {
@@ -248,7 +248,7 @@ export const toSchemaV3 = ({ schema, stackTrail, context }) => {
248
248
  });
249
249
  }
250
250
  if ('anyOf' in schema && Array.isArray(schema.anyOf)) {
251
- // Under `system.anyOf: unknown`, as Cloudflare's `cf` reads it, an `anyOf`
251
+ // Under `parse.anyOf: unknown`, as Cloudflare's `cf` reads it, an `anyOf`
252
252
  // of two or more members is any value: the schema parses with its other
253
253
  // keywords, so the properties next to it stay, without the members.
254
254
  if (isUnknownAnyOf({ members: schema.anyOf, setting: context.system?.anyOf, getRef: toGetRef(context.documentObject) })) {
@@ -16,7 +16,7 @@ type MergeCrossProductArgs = {
16
16
  groupType: 'oneOf' | 'anyOf';
17
17
  };
18
18
  /**
19
- * The `system` a member's own `allOf` merges under: the `client.json`
19
+ * The `system` a member's own `allOf` merges under: the `skmtc.config.json`
20
20
  * setting, also in the first pass over a cross product's pairs.
21
21
  */
22
22
  export declare const toOwnSystem: (system: MergeSystem) => MergeSystem;
@@ -37,7 +37,7 @@ export const mergeUnion = ({ schema, getRef, normalize, system, groupType }) =>
37
37
  return output;
38
38
  };
39
39
  /**
40
- * The `system` a member's own `allOf` merges under: the `client.json`
40
+ * The `system` a member's own `allOf` merges under: the `skmtc.config.json`
41
41
  * setting, also in the first pass over a cross product's pairs.
42
42
  */
43
43
  export const toOwnSystem = (system) => ({
@@ -53,13 +53,13 @@ export const toOwnSystem = (system) => ({
53
53
  * collections say `result` is an object or a string, then an array.
54
54
  *
55
55
  * The first pass is strict between the two members of a pair only. A
56
- * member's own `allOf` merges under the `client.json` setting
56
+ * member's own `allOf` merges under the `skmtc.config.json` setting
57
57
  * ({@link toOwnSystem}). Inside an outer first pass under `latestWins`, a
58
58
  * cross product with no pair that merges fails its pair: the outer pass then
59
59
  * leaves the pair out, or lets the later member win.
60
60
  *
61
61
  * A `$ref` that names nothing is not a contradiction, so its pair is not left
62
- * out for it: the `DanglingRefError` is thrown on, and `system.danglingRefs`
62
+ * out for it: the `DanglingRefError` is thrown on, and `parse.danglingRefs`
63
63
  * decides (`allOfMember`).
64
64
  */
65
65
  const mergePairs = ({ pairs, merge, system }) => {
@@ -47,7 +47,7 @@ export const mergeSchemasOrRefs = ({ first: inputFirst, second: inputSecond, get
47
47
  if (isRef(second)) {
48
48
  throw new Error('Ref in second');
49
49
  }
50
- // Under `system.anyOf: unknown` an `anyOf` of two or more members is any
50
+ // Under `parse.anyOf: unknown` an `anyOf` of two or more members is any
51
51
  // value, so it adds nothing to the merge: its members are left out, and the
52
52
  // keywords next to it merge as usual.
53
53
  const firstKeywords = withoutUnknownAnyOf({ schema: first, setting: system.anyOf, getRef });
@@ -57,7 +57,7 @@ export const mergeSchemasOrRefs = ({ first: inputFirst, second: inputSecond, get
57
57
  return mergeSchemasOrRefs({ first: firstKeywords, second: secondKeywords, getRef, normalize, system });
58
58
  }
59
59
  if (containsAllOf(first) || containsAllOf(second)) {
60
- // Each member's own `allOf` merges under the `client.json` setting, also in
60
+ // Each member's own `allOf` merges under the `skmtc.config.json` setting, also in
61
61
  // the strict first pass over a cross product's pairs.
62
62
  const ownSystem = toOwnSystem(system);
63
63
  const mergedFirst = containsAllOf(first)
@@ -9,7 +9,7 @@ export type GetRefFn = (ref: OpenAPIV3.ReferenceObject) => OpenAPIV3.SchemaObjec
9
9
  */
10
10
  export type NormalizeFn = (schema: OpenAPIV3.SchemaObject) => OpenAPIV3.SchemaObject;
11
11
  /**
12
- * The `system` settings as the merge reads them (`client.json#settings.system`),
12
+ * The `system` settings as the merge reads them (`skmtc.config.json#settings.parse`),
13
13
  * and the keywords a later `allOf` member replaced under `latestWins`, so
14
14
  * the parser can name them in one warning for the schema.
15
15
  */
@@ -19,7 +19,7 @@ export type MergeSystem = {
19
19
  /** `unknown`: a member with `not` merges, its `not` carried as written. Left out: `strict`, which refuses it. */
20
20
  not?: 'strict' | 'unknown';
21
21
  /**
22
- * `client.json` `system.allOf`, kept while the first pass over a cross
22
+ * `skmtc.config.json` `parse.allOf`, kept while the first pass over a cross
23
23
  * product's pairs sets `allOf` to `strict`. A member's own `allOf` merges
24
24
  * under this setting in every pass. Left out: `allOf` is the setting.
25
25
  */
@@ -27,9 +27,9 @@ export type MergeSystem = {
27
27
  replaced: Set<string>;
28
28
  /** `unknown`: an `anyOf` of two or more members is any value, so it adds nothing to the merge. Left out: `union`. */
29
29
  anyOf?: 'union' | 'unknown';
30
- /** The keywords the merge read as any value: `anyOf` under `system.anyOf: unknown`. */
30
+ /** The keywords the merge read as any value: `anyOf` under `parse.anyOf: unknown`. */
31
31
  unknown?: Set<string>;
32
- /** The refs that stay refs (`system.intersections`). Left out: every ref is followed. */
32
+ /** The refs that stay refs (`parse.intersections`). Left out: every ref is followed. */
33
33
  keptRefs?: KeptRefs;
34
34
  };
35
35
  export type OneOfObject = {