@skmtc/core 0.47.4 → 0.49.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.
- package/esm/context/CoreContext.d.ts +1 -1
- package/esm/context/CoreContext.js +6 -2
- package/esm/context/GenerateContext.d.ts +15 -4
- package/esm/context/GenerateContext.js +40 -34
- package/esm/context/ParseContext.d.ts +4 -4
- package/esm/context/ParseContext.js +6 -6
- package/esm/context/RenderContext.d.ts +3 -2
- package/esm/context/RenderContext.js +6 -5
- package/esm/context/generateTypes.d.ts +10 -6
- package/esm/context/tryParseAt.d.ts +1 -1
- package/esm/context/tryParseAt.js +1 -1
- package/esm/dsl/ContentSettings.d.ts +17 -12
- package/esm/dsl/ContentSettings.js +13 -9
- package/esm/dsl/Inserted.d.ts +4 -3
- package/esm/dsl/Inserted.js +2 -2
- package/esm/dsl/PendingDefinition.d.ts +3 -2
- package/esm/dsl/driverFiles.d.ts +46 -0
- package/esm/dsl/driverFiles.js +31 -0
- package/esm/dsl/model/ModelDriver.d.ts +5 -7
- package/esm/dsl/model/ModelDriver.js +12 -29
- package/esm/dsl/operation/gql/GqlOperationDriver.d.ts +1 -1
- package/esm/dsl/operation/gql/GqlOperationDriver.js +15 -12
- package/esm/dsl/operation/oas/OasOperationDriver.d.ts +1 -1
- package/esm/dsl/operation/oas/OasOperationDriver.js +11 -14
- package/esm/dsl/webhook/WebhookDriver.d.ts +1 -1
- package/esm/dsl/webhook/WebhookDriver.js +15 -12
- package/esm/enrichments/EnrichmentAudit.d.ts +1 -1
- package/esm/enrichments/EnrichmentWarning.d.ts +1 -1
- package/esm/enrichments/findUnknownKeys.d.ts +1 -1
- package/esm/enrichments/findUnknownKeys.js +1 -1
- package/esm/enrichments/parseEnrichmentUmbrella.d.ts +1 -1
- package/esm/enrichments/parseEnrichmentUmbrella.js +1 -1
- package/esm/enrichments/parseEnrichmentValue.d.ts +2 -2
- package/esm/enrichments/parseEnrichmentValue.js +2 -2
- package/esm/enrichments/readEnrichments.d.ts +4 -4
- package/esm/enrichments/readEnrichments.js +4 -4
- package/esm/enrichments/validateConfig.d.ts +1 -1
- package/esm/helpers/applyGeneratedSuffix.d.ts +1 -1
- package/esm/helpers/applyGeneratedSuffix.js +1 -1
- package/esm/helpers/getByWorkspacePath.d.ts +9 -0
- package/esm/helpers/getByWorkspacePath.js +10 -0
- package/esm/helpers/normalizeWorkspacePath.d.ts +26 -3
- package/esm/helpers/normalizeWorkspacePath.js +17 -2
- package/esm/oas/array/Array.d.ts +2 -2
- package/esm/oas/array/Array.js +2 -2
- package/esm/oas/boolean/Boolean.d.ts +2 -2
- package/esm/oas/boolean/Boolean.js +2 -2
- package/esm/oas/integer/Integer.d.ts +2 -2
- package/esm/oas/integer/Integer.js +2 -2
- package/esm/oas/intersection/Intersection.d.ts +3 -3
- package/esm/oas/intersection/Intersection.js +3 -3
- package/esm/oas/number/Number.d.ts +2 -2
- package/esm/oas/number/Number.js +2 -2
- package/esm/oas/object/Object.d.ts +2 -2
- package/esm/oas/object/Object.js +2 -2
- package/esm/oas/operation/Operation.d.ts +1 -1
- package/esm/oas/operation/Operation.js +1 -1
- package/esm/oas/operation/toEffectiveParameters.d.ts +2 -2
- package/esm/oas/operation/toEffectiveParameters.js +2 -2
- package/esm/oas/ref/DanglingRefError.d.ts +1 -1
- package/esm/oas/ref/DanglingRefError.js +1 -1
- package/esm/oas/ref/Ref.d.ts +2 -2
- package/esm/oas/ref/Ref.js +2 -2
- package/esm/oas/string/String.d.ts +2 -2
- package/esm/oas/string/String.js +2 -2
- package/esm/oas/union/Union.d.ts +3 -3
- package/esm/oas/union/Union.js +3 -3
- package/esm/oas/unknown/Unknown.d.ts +2 -2
- package/esm/oas/unknown/Unknown.js +2 -2
- package/esm/parse/allOfSystem.d.ts +4 -4
- package/esm/parse/allOfSystem.js +2 -2
- package/esm/parse/anyOfSystem.d.ts +5 -5
- package/esm/parse/anyOfSystem.js +4 -4
- package/esm/parse/keptRefs.d.ts +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-union.d.ts +1 -1
- package/esm/parse/v3-0/_merge-all-of/merge-union.js +3 -3
- package/esm/parse/v3-0/_merge-all-of/merge.js +2 -2
- package/esm/parse/v3-0/_merge-all-of/types.d.ts +4 -4
- package/esm/parse/v3-0/ref/toRefV31.js +1 -1
- package/esm/parse/v3-0/schema/toSchemasV3.js +3 -3
- package/esm/parse/v3-1/_merge-all-of/merge-union.d.ts +1 -1
- package/esm/parse/v3-1/_merge-all-of/merge-union.js +3 -3
- package/esm/parse/v3-1/_merge-all-of/merge.js +2 -2
- package/esm/parse/v3-1/_merge-all-of/types.d.ts +4 -4
- package/esm/parse/v3-1/ref/toRefV31.js +1 -1
- package/esm/parse/v3-1/schema/toSchemasV3.js +3 -3
- package/esm/parse/v3-2/_merge-all-of/merge-union.d.ts +1 -1
- package/esm/parse/v3-2/_merge-all-of/merge-union.js +3 -3
- package/esm/parse/v3-2/_merge-all-of/merge.js +2 -2
- package/esm/parse/v3-2/_merge-all-of/types.d.ts +4 -4
- package/esm/parse/v3-2/ref/toRefV31.js +1 -1
- package/esm/parse/v3-2/schema/toSchemasV3.js +3 -3
- package/esm/run/toEnrichmentDefaults.d.ts +1 -1
- package/esm/run/toEnrichmentDefaults.js +1 -1
- package/esm/types/EnrichmentDefaults.d.ts +1 -1
- package/esm/types/EnrichmentDefaults.js +1 -1
- package/esm/types/Enrichments.d.ts +1 -1
- package/esm/types/Manifest.d.ts +1 -1
- package/esm/types/ModuleSelect.d.ts +1 -1
- package/esm/types/Settings.d.ts +29 -11
- package/esm/types/Settings.js +13 -6
- package/esm/types/Variant.d.ts +3 -3
- package/esm/types/Variant.js +3 -3
- package/package.json +1 -1
- package/script/context/CoreContext.d.ts +1 -1
- package/script/context/CoreContext.js +6 -2
- package/script/context/GenerateContext.d.ts +15 -4
- package/script/context/GenerateContext.js +38 -32
- package/script/context/ParseContext.d.ts +4 -4
- package/script/context/ParseContext.js +6 -6
- package/script/context/RenderContext.d.ts +3 -2
- package/script/context/RenderContext.js +6 -5
- package/script/context/generateTypes.d.ts +10 -6
- package/script/context/tryParseAt.d.ts +1 -1
- package/script/context/tryParseAt.js +1 -1
- package/script/dsl/ContentSettings.d.ts +17 -12
- package/script/dsl/ContentSettings.js +13 -9
- package/script/dsl/Inserted.d.ts +4 -3
- package/script/dsl/Inserted.js +2 -2
- package/script/dsl/PendingDefinition.d.ts +3 -2
- package/script/dsl/driverFiles.d.ts +46 -0
- package/script/dsl/driverFiles.js +38 -0
- package/script/dsl/model/ModelDriver.d.ts +5 -7
- package/script/dsl/model/ModelDriver.js +12 -29
- package/script/dsl/operation/gql/GqlOperationDriver.d.ts +1 -1
- package/script/dsl/operation/gql/GqlOperationDriver.js +15 -12
- package/script/dsl/operation/oas/OasOperationDriver.d.ts +1 -1
- package/script/dsl/operation/oas/OasOperationDriver.js +11 -14
- package/script/dsl/webhook/WebhookDriver.d.ts +1 -1
- package/script/dsl/webhook/WebhookDriver.js +15 -12
- package/script/enrichments/EnrichmentAudit.d.ts +1 -1
- package/script/enrichments/EnrichmentWarning.d.ts +1 -1
- package/script/enrichments/findUnknownKeys.d.ts +1 -1
- package/script/enrichments/findUnknownKeys.js +1 -1
- package/script/enrichments/parseEnrichmentUmbrella.d.ts +1 -1
- package/script/enrichments/parseEnrichmentUmbrella.js +1 -1
- package/script/enrichments/parseEnrichmentValue.d.ts +2 -2
- package/script/enrichments/parseEnrichmentValue.js +2 -2
- package/script/enrichments/readEnrichments.d.ts +4 -4
- package/script/enrichments/readEnrichments.js +4 -4
- package/script/enrichments/validateConfig.d.ts +1 -1
- package/script/helpers/applyGeneratedSuffix.d.ts +1 -1
- package/script/helpers/applyGeneratedSuffix.js +1 -1
- package/script/helpers/getByWorkspacePath.d.ts +9 -0
- package/script/helpers/getByWorkspacePath.js +14 -0
- package/script/helpers/normalizeWorkspacePath.d.ts +26 -3
- package/script/helpers/normalizeWorkspacePath.js +19 -3
- package/script/oas/array/Array.d.ts +2 -2
- package/script/oas/array/Array.js +2 -2
- package/script/oas/boolean/Boolean.d.ts +2 -2
- package/script/oas/boolean/Boolean.js +2 -2
- package/script/oas/integer/Integer.d.ts +2 -2
- package/script/oas/integer/Integer.js +2 -2
- package/script/oas/intersection/Intersection.d.ts +3 -3
- package/script/oas/intersection/Intersection.js +3 -3
- package/script/oas/number/Number.d.ts +2 -2
- package/script/oas/number/Number.js +2 -2
- package/script/oas/object/Object.d.ts +2 -2
- package/script/oas/object/Object.js +2 -2
- package/script/oas/operation/Operation.d.ts +1 -1
- package/script/oas/operation/Operation.js +1 -1
- package/script/oas/operation/toEffectiveParameters.d.ts +2 -2
- package/script/oas/operation/toEffectiveParameters.js +2 -2
- package/script/oas/ref/DanglingRefError.d.ts +1 -1
- package/script/oas/ref/DanglingRefError.js +1 -1
- package/script/oas/ref/Ref.d.ts +2 -2
- package/script/oas/ref/Ref.js +2 -2
- package/script/oas/string/String.d.ts +2 -2
- package/script/oas/string/String.js +2 -2
- package/script/oas/union/Union.d.ts +3 -3
- package/script/oas/union/Union.js +3 -3
- package/script/oas/unknown/Unknown.d.ts +2 -2
- package/script/oas/unknown/Unknown.js +2 -2
- package/script/parse/allOfSystem.d.ts +4 -4
- package/script/parse/allOfSystem.js +2 -2
- package/script/parse/anyOfSystem.d.ts +5 -5
- package/script/parse/anyOfSystem.js +4 -4
- package/script/parse/keptRefs.d.ts +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-union.d.ts +1 -1
- package/script/parse/v3-0/_merge-all-of/merge-union.js +3 -3
- package/script/parse/v3-0/_merge-all-of/merge.js +2 -2
- package/script/parse/v3-0/_merge-all-of/types.d.ts +4 -4
- package/script/parse/v3-0/ref/toRefV31.js +1 -1
- package/script/parse/v3-0/schema/toSchemasV3.js +3 -3
- package/script/parse/v3-1/_merge-all-of/merge-union.d.ts +1 -1
- package/script/parse/v3-1/_merge-all-of/merge-union.js +3 -3
- package/script/parse/v3-1/_merge-all-of/merge.js +2 -2
- package/script/parse/v3-1/_merge-all-of/types.d.ts +4 -4
- package/script/parse/v3-1/ref/toRefV31.js +1 -1
- package/script/parse/v3-1/schema/toSchemasV3.js +3 -3
- package/script/parse/v3-2/_merge-all-of/merge-union.d.ts +1 -1
- package/script/parse/v3-2/_merge-all-of/merge-union.js +3 -3
- package/script/parse/v3-2/_merge-all-of/merge.js +2 -2
- package/script/parse/v3-2/_merge-all-of/types.d.ts +4 -4
- package/script/parse/v3-2/ref/toRefV31.js +1 -1
- package/script/parse/v3-2/schema/toSchemasV3.js +3 -3
- package/script/run/toEnrichmentDefaults.d.ts +1 -1
- package/script/run/toEnrichmentDefaults.js +1 -1
- package/script/types/EnrichmentDefaults.d.ts +1 -1
- package/script/types/EnrichmentDefaults.js +1 -1
- package/script/types/Enrichments.d.ts +1 -1
- package/script/types/Manifest.d.ts +1 -1
- package/script/types/ModuleSelect.d.ts +1 -1
- package/script/types/Settings.d.ts +29 -11
- package/script/types/Settings.js +14 -7
- package/script/types/Variant.d.ts +3 -3
- package/script/types/Variant.js +3 -3
|
@@ -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 `
|
|
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
|
*
|
|
@@ -229,7 +229,7 @@ class OasOperation extends OasBase_js_1.OasBase {
|
|
|
229
229
|
* The path item's come first.
|
|
230
230
|
*
|
|
231
231
|
* References stay references, so a caller can resolve each one on its own.
|
|
232
|
-
* A reference that names nothing (kept when `
|
|
232
|
+
* A reference that names nothing (kept when `parse.danglingRefs` lists
|
|
233
233
|
* `parameter`) keeps its place, and resolving it throws `DanglingRefError`.
|
|
234
234
|
* {@link OasOperation.toParams} resolves them all.
|
|
235
235
|
*
|
|
@@ -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 `
|
|
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 `
|
|
22
|
+
* parser keeps when `parse.danglingRefs` lists `parameter`.
|
|
23
23
|
*/
|
|
24
24
|
export declare const namesNothing: (parameter: Parameter) => boolean;
|
|
25
25
|
export {};
|
|
@@ -7,7 +7,7 @@ const DanglingRefError_js_1 = require("../ref/DanglingRefError.js");
|
|
|
7
7
|
* them: the path item's first, then its own. An own parameter with the same
|
|
8
8
|
* name and location replaces the path item's. References stay references.
|
|
9
9
|
*
|
|
10
|
-
* A reference that names nothing (kept when `
|
|
10
|
+
* A reference that names nothing (kept when `parse.danglingRefs` lists
|
|
11
11
|
* `parameter`) has no name or location. It keeps its place, and only the
|
|
12
12
|
* same `$ref` replaces it.
|
|
13
13
|
*/
|
|
@@ -18,7 +18,7 @@ const toEffectiveParameters = ({ own = [], shared = [] }) => {
|
|
|
18
18
|
exports.toEffectiveParameters = toEffectiveParameters;
|
|
19
19
|
/**
|
|
20
20
|
* True for a parameter `$ref` that names nothing in the document, which the
|
|
21
|
-
* parser keeps when `
|
|
21
|
+
* parser keeps when `parse.danglingRefs` lists `parameter`.
|
|
22
22
|
*/
|
|
23
23
|
const namesNothing = (parameter) => {
|
|
24
24
|
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 `
|
|
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`.
|
|
@@ -10,7 +10,7 @@ require("../../_dnt.polyfills.js");
|
|
|
10
10
|
* component.
|
|
11
11
|
*
|
|
12
12
|
* By default the parser removes what holds such a reference, so a generator
|
|
13
|
-
* never meets one. When `
|
|
13
|
+
* never meets one. When `skmtc.config.json` `parse.danglingRefs` lists the
|
|
14
14
|
* reference's kind, it stays, and a generator that resolves it can catch
|
|
15
15
|
* this error and render something else in its place. Test for it with
|
|
16
16
|
* {@link DanglingRefError.is}, not `instanceof`.
|
package/script/oas/ref/Ref.d.ts
CHANGED
|
@@ -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 `
|
|
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 `
|
|
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/…`
|
package/script/oas/ref/Ref.js
CHANGED
|
@@ -441,7 +441,7 @@ class OasRef extends OasBase_js_1.OasBase {
|
|
|
441
441
|
* @returns The resolved component
|
|
442
442
|
* @throws {DanglingRefError} when a reference on the chain names nothing,
|
|
443
443
|
* or the chain loops ({@link toLoop}), so it never reaches a component.
|
|
444
|
-
* The parser keeps either one only when `
|
|
444
|
+
* The parser keeps either one only when `parse.danglingRefs` lists its kind.
|
|
445
445
|
* @throws Error when a reference on the chain names a component of another
|
|
446
446
|
* kind (see {@link resolveOnce})
|
|
447
447
|
*/
|
|
@@ -468,7 +468,7 @@ class OasRef extends OasBase_js_1.OasBase {
|
|
|
468
468
|
*
|
|
469
469
|
* @returns Either the resolved component or another reference in the chain
|
|
470
470
|
* @throws {DanglingRefError} when the reference names nothing in the
|
|
471
|
-
* document (kept when `
|
|
471
|
+
* document (kept when `skmtc.config.json` `parse.danglingRefs` lists its kind),
|
|
472
472
|
* including a `$ref` with no name, such as `#/components/schemas/`
|
|
473
473
|
* @throws Error when it names a component of another kind, such as a
|
|
474
474
|
* `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 `
|
|
108
|
-
* `
|
|
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;
|
|
@@ -150,8 +150,8 @@ class OasString extends OasBase_js_1.OasBase {
|
|
|
150
150
|
value: void 0
|
|
151
151
|
});
|
|
152
152
|
/**
|
|
153
|
-
* The schema's `not`, kept as an `OasUnknown` under `
|
|
154
|
-
* `
|
|
153
|
+
* The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
|
|
154
|
+
* `parse.not: unknown`: the document says "not something", and core does
|
|
155
155
|
* not read what. `undefined` otherwise.
|
|
156
156
|
*/
|
|
157
157
|
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 `
|
|
192
|
-
* `
|
|
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 `
|
|
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.
|
|
@@ -219,8 +219,8 @@ class OasUnion extends OasBase_js_1.OasBase {
|
|
|
219
219
|
value: void 0
|
|
220
220
|
});
|
|
221
221
|
/**
|
|
222
|
-
* The schema's `not`, kept as an `OasUnknown` under `
|
|
223
|
-
* `
|
|
222
|
+
* The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
|
|
223
|
+
* `parse.not: unknown`: the document says "not something", and core does
|
|
224
224
|
* not read what. `undefined` otherwise.
|
|
225
225
|
*/
|
|
226
226
|
Object.defineProperty(this, "not", {
|
|
@@ -288,7 +288,7 @@ class OasUnion extends OasBase_js_1.OasBase {
|
|
|
288
288
|
* property, and that allows only string literals for it. No value may
|
|
289
289
|
* belong to two members. A member that is a union, or anything other than
|
|
290
290
|
* an object, makes it `false`, as does a reference on the way that names
|
|
291
|
-
* nothing in the document (kept when `
|
|
291
|
+
* nothing in the document (kept when `parse.danglingRefs` lists `schema`).
|
|
292
292
|
*
|
|
293
293
|
* It reads the schemas only. A generator may refuse more: one that leaves
|
|
294
294
|
* 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 `
|
|
48
|
-
* `
|
|
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;
|
|
@@ -74,8 +74,8 @@ class OasUnknown extends OasBase_js_1.OasBase {
|
|
|
74
74
|
value: void 0
|
|
75
75
|
});
|
|
76
76
|
/**
|
|
77
|
-
* The schema's `not`, kept as an `OasUnknown` under `
|
|
78
|
-
* `
|
|
77
|
+
* The schema's `not`, kept as an `OasUnknown` under `skmtc.config.json`
|
|
78
|
+
* `parse.not: unknown`: the document says "not something", and core does
|
|
79
79
|
* not read what. `undefined` otherwise.
|
|
80
80
|
*/
|
|
81
81
|
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 `
|
|
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 `
|
|
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 (`
|
|
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 (`
|
|
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;
|
|
@@ -18,7 +18,7 @@ const toAllOfSystem = (context) => ({
|
|
|
18
18
|
exports.toAllOfSystem = toAllOfSystem;
|
|
19
19
|
/**
|
|
20
20
|
* One warning for a schema whose `allOf` members contradicted, naming the
|
|
21
|
-
* keywords the later member kept (`
|
|
21
|
+
* keywords the later member kept (`parse.allOf: latestWins`). Nothing when
|
|
22
22
|
* no keyword was replaced.
|
|
23
23
|
*/
|
|
24
24
|
const logAllOfContradictions = ({ system, stackTrail, parent, context }) => {
|
|
@@ -27,7 +27,7 @@ const logAllOfContradictions = ({ system, stackTrail, parent, context }) => {
|
|
|
27
27
|
}
|
|
28
28
|
context.logIssueNoKey({
|
|
29
29
|
level: 'warning',
|
|
30
|
-
message: `The allOf members contradict on ${[...system.replaced].join(', ')}; the later member's values are kept (
|
|
30
|
+
message: `The allOf members contradict on ${[...system.replaced].join(', ')}; the later member's values are kept (parse.allOf is latestWins).`,
|
|
31
31
|
parent,
|
|
32
32
|
stackTrail,
|
|
33
33
|
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
|
-
/** `
|
|
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 `
|
|
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
|
-
/** `
|
|
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
|
-
* `
|
|
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 (`
|
|
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 {};
|
|
@@ -40,7 +40,7 @@ const isScalarMember = (member) => {
|
|
|
40
40
|
*/
|
|
41
41
|
const toMemberSchema = (member, getRef) => ('$ref' in member ? getRef(member) : member);
|
|
42
42
|
/**
|
|
43
|
-
* Whether `
|
|
43
|
+
* Whether `parse.anyOf: unknown` reads an `anyOf` as any value, as
|
|
44
44
|
* Cloudflare's `cf` reads it: when it has two or more members, not counting a
|
|
45
45
|
* `null` one, and one of them is not a single value.
|
|
46
46
|
*
|
|
@@ -59,7 +59,7 @@ const isUnknownAnyOf = ({ members, setting, getRef }) => {
|
|
|
59
59
|
exports.isUnknownAnyOf = isUnknownAnyOf;
|
|
60
60
|
/**
|
|
61
61
|
* `schema` with its other keywords and without an `anyOf` that
|
|
62
|
-
* `
|
|
62
|
+
* `parse.anyOf: unknown` reads as any value ({@link isUnknownAnyOf}), so the
|
|
63
63
|
* properties next to the `anyOf` stay. A `null` member makes it nullable. Any
|
|
64
64
|
* other schema is returned as it is.
|
|
65
65
|
*/
|
|
@@ -101,11 +101,11 @@ const logMergedUnknownAnyOf = ({ system, stackTrail, parent, context }) => {
|
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
103
|
exports.logMergedUnknownAnyOf = logMergedUnknownAnyOf;
|
|
104
|
-
/** One warning for a schema whose `anyOf` was read as any value (`
|
|
104
|
+
/** One warning for a schema whose `anyOf` was read as any value (`parse.anyOf: unknown`). */
|
|
105
105
|
const logUnknownAnyOf = ({ stackTrail, parent, context }) => {
|
|
106
106
|
context.logIssueNoKey({
|
|
107
107
|
level: 'warning',
|
|
108
|
-
message: 'The anyOf is read as any value (
|
|
108
|
+
message: 'The anyOf is read as any value (parse.anyOf is unknown): the schema keeps its other keywords, without the anyOf members.',
|
|
109
109
|
parent,
|
|
110
110
|
stackTrail,
|
|
111
111
|
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 `
|
|
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
|
-
/** `
|
|
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`. */
|
|
@@ -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 `
|
|
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;
|
|
@@ -34,7 +34,7 @@ const mergeUnion = ({ schema, getRef, system, groupType }) => {
|
|
|
34
34
|
};
|
|
35
35
|
exports.mergeUnion = mergeUnion;
|
|
36
36
|
/**
|
|
37
|
-
* The `system` a member's own `allOf` merges under: the `
|
|
37
|
+
* The `system` a member's own `allOf` merges under: the `skmtc.config.json`
|
|
38
38
|
* setting, also in the first pass over a cross product's pairs.
|
|
39
39
|
*/
|
|
40
40
|
const toOwnSystem = (system) => ({
|
|
@@ -51,13 +51,13 @@ exports.toOwnSystem = toOwnSystem;
|
|
|
51
51
|
* collections say `result` is an object or a string, then an array.
|
|
52
52
|
*
|
|
53
53
|
* The first pass is strict between the two members of a pair only. A
|
|
54
|
-
* member's own `allOf` merges under the `
|
|
54
|
+
* member's own `allOf` merges under the `skmtc.config.json` setting
|
|
55
55
|
* ({@link toOwnSystem}). Inside an outer first pass under `latestWins`, a
|
|
56
56
|
* cross product with no pair that merges fails its pair: the outer pass then
|
|
57
57
|
* leaves the pair out, or lets the later member win.
|
|
58
58
|
*
|
|
59
59
|
* A `$ref` that names nothing is not a contradiction, so its pair is not left
|
|
60
|
-
* out for it: the `DanglingRefError` is thrown on, and `
|
|
60
|
+
* out for it: the `DanglingRefError` is thrown on, and `parse.danglingRefs`
|
|
61
61
|
* decides (`allOfMember`).
|
|
62
62
|
*/
|
|
63
63
|
const mergePairs = ({ pairs, merge, system }) => {
|
|
@@ -44,7 +44,7 @@ const mergeSchemasOrRefs = ({ first, second, getRef, system }) => {
|
|
|
44
44
|
if ((0, refFns_js_1.isRef)(second)) {
|
|
45
45
|
throw new Error('Ref in second');
|
|
46
46
|
}
|
|
47
|
-
// Under `
|
|
47
|
+
// Under `parse.anyOf: unknown` an `anyOf` of two or more members is any
|
|
48
48
|
// value, so it adds nothing to the merge: its members are left out, and the
|
|
49
49
|
// keywords next to it merge as usual.
|
|
50
50
|
const firstKeywords = (0, anyOfSystem_js_1.withoutUnknownAnyOf)({ schema: first, setting: system.anyOf, getRef });
|
|
@@ -54,7 +54,7 @@ const mergeSchemasOrRefs = ({ first, second, getRef, system }) => {
|
|
|
54
54
|
return (0, exports.mergeSchemasOrRefs)({ first: firstKeywords, second: secondKeywords, getRef, system });
|
|
55
55
|
}
|
|
56
56
|
if (containsAllOf(first) || containsAllOf(second)) {
|
|
57
|
-
// Each member's own `allOf` merges under the `
|
|
57
|
+
// Each member's own `allOf` merges under the `skmtc.config.json` setting, also in
|
|
58
58
|
// the strict first pass over a cross product's pairs.
|
|
59
59
|
const ownSystem = (0, merge_union_js_1.toOwnSystem)(system);
|
|
60
60
|
const mergedFirst = containsAllOf(first) ? (0, merge_intersection_js_1.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 (`
|
|
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
|
-
* `
|
|
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 `
|
|
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 (`
|
|
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 = {
|
|
@@ -10,7 +10,7 @@ const toRefV31 = ({ ref, refType, stackTrail, context, nullable, readOnly, write
|
|
|
10
10
|
}
|
|
11
11
|
const oasRef = context.withStackTrail(stackTrail, () => new Ref_js_1.OasRef({ ...siblings, refType, $ref, nullable, readOnly, writeOnly }, context));
|
|
12
12
|
// The parse context checks each ref once the document is parsed, and
|
|
13
|
-
// removes what holds a ref that names nothing (`
|
|
13
|
+
// removes what holds a ref that names nothing (`parse.danglingRefs`).
|
|
14
14
|
context.registerOasRef(stackTrail.clone(), oasRef);
|
|
15
15
|
return oasRef;
|
|
16
16
|
};
|
|
@@ -103,12 +103,12 @@ const toSchemaV3 = ({ schema, stackTrail, context }) => {
|
|
|
103
103
|
}
|
|
104
104
|
// OpenAPI `not` has no faithful TypeScript representation: a generated type
|
|
105
105
|
// that ignored it would *widen* the contract (accepting shapes the schema
|
|
106
|
-
// forbids). Under `
|
|
106
|
+
// forbids). Under `skmtc.config.json` `parse.not: strict` (the default) the schema
|
|
107
107
|
// is refused rather than emit a type that lies. The throw is isolated by
|
|
108
108
|
// `tryParseAt` into an `INVALID_SCHEMA` issue, and consumers of this schema
|
|
109
109
|
// are pruned via `removeErroredItems` (INVALID_DEPENDENCY_REF).
|
|
110
110
|
//
|
|
111
|
-
// Under `
|
|
111
|
+
// Under `parse.not: unknown` the schema parses with its other keywords, and
|
|
112
112
|
// its `not` is kept as an `OasUnknown` that core does not read: a generator
|
|
113
113
|
// can see that the document says "not something".
|
|
114
114
|
if ('not' in schema) {
|
|
@@ -253,7 +253,7 @@ const toSchemaV3 = ({ schema, stackTrail, context }) => {
|
|
|
253
253
|
});
|
|
254
254
|
}
|
|
255
255
|
if ('anyOf' in schema && Array.isArray(schema.anyOf)) {
|
|
256
|
-
// Under `
|
|
256
|
+
// Under `parse.anyOf: unknown`, as Cloudflare's `cf` reads it, an `anyOf`
|
|
257
257
|
// of two or more members is any value: the schema parses with its other
|
|
258
258
|
// keywords, so the properties next to it stay, without the members.
|
|
259
259
|
if ((0, anyOfSystem_js_1.isUnknownAnyOf)({ members: schema.anyOf, setting: context.system?.anyOf, getRef: (0, refFns_js_2.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 `
|
|
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;
|
|
@@ -41,7 +41,7 @@ const mergeUnion = ({ schema, getRef, normalize, system, groupType }) => {
|
|
|
41
41
|
};
|
|
42
42
|
exports.mergeUnion = mergeUnion;
|
|
43
43
|
/**
|
|
44
|
-
* The `system` a member's own `allOf` merges under: the `
|
|
44
|
+
* The `system` a member's own `allOf` merges under: the `skmtc.config.json`
|
|
45
45
|
* setting, also in the first pass over a cross product's pairs.
|
|
46
46
|
*/
|
|
47
47
|
const toOwnSystem = (system) => ({
|
|
@@ -58,13 +58,13 @@ exports.toOwnSystem = toOwnSystem;
|
|
|
58
58
|
* collections say `result` is an object or a string, then an array.
|
|
59
59
|
*
|
|
60
60
|
* The first pass is strict between the two members of a pair only. A
|
|
61
|
-
* member's own `allOf` merges under the `
|
|
61
|
+
* member's own `allOf` merges under the `skmtc.config.json` setting
|
|
62
62
|
* ({@link toOwnSystem}). Inside an outer first pass under `latestWins`, a
|
|
63
63
|
* cross product with no pair that merges fails its pair: the outer pass then
|
|
64
64
|
* leaves the pair out, or lets the later member win.
|
|
65
65
|
*
|
|
66
66
|
* A `$ref` that names nothing is not a contradiction, so its pair is not left
|
|
67
|
-
* out for it: the `DanglingRefError` is thrown on, and `
|
|
67
|
+
* out for it: the `DanglingRefError` is thrown on, and `parse.danglingRefs`
|
|
68
68
|
* decides (`allOfMember`).
|
|
69
69
|
*/
|
|
70
70
|
const mergePairs = ({ pairs, merge, system }) => {
|
|
@@ -50,7 +50,7 @@ const mergeSchemasOrRefs = ({ first: inputFirst, second: inputSecond, getRef, no
|
|
|
50
50
|
if ((0, refFns_js_1.isRef)(second)) {
|
|
51
51
|
throw new Error('Ref in second');
|
|
52
52
|
}
|
|
53
|
-
// Under `
|
|
53
|
+
// Under `parse.anyOf: unknown` an `anyOf` of two or more members is any
|
|
54
54
|
// value, so it adds nothing to the merge: its members are left out, and the
|
|
55
55
|
// keywords next to it merge as usual.
|
|
56
56
|
const firstKeywords = (0, anyOfSystem_js_1.withoutUnknownAnyOf)({ schema: first, setting: system.anyOf, getRef });
|
|
@@ -60,7 +60,7 @@ const mergeSchemasOrRefs = ({ first: inputFirst, second: inputSecond, getRef, no
|
|
|
60
60
|
return (0, exports.mergeSchemasOrRefs)({ first: firstKeywords, second: secondKeywords, getRef, normalize, system });
|
|
61
61
|
}
|
|
62
62
|
if (containsAllOf(first) || containsAllOf(second)) {
|
|
63
|
-
// Each member's own `allOf` merges under the `
|
|
63
|
+
// Each member's own `allOf` merges under the `skmtc.config.json` setting, also in
|
|
64
64
|
// the strict first pass over a cross product's pairs.
|
|
65
65
|
const ownSystem = (0, merge_union_js_1.toOwnSystem)(system);
|
|
66
66
|
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 (`
|
|
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
|
-
* `
|
|
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 `
|
|
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 (`
|
|
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 = {
|
|
@@ -10,7 +10,7 @@ const toRefV31 = ({ ref, refType, stackTrail, context, nullable, readOnly, write
|
|
|
10
10
|
}
|
|
11
11
|
const oasRef = context.withStackTrail(stackTrail, () => new Ref_js_1.OasRef({ ...siblings, refType, $ref, nullable, readOnly, writeOnly }, context));
|
|
12
12
|
// The parse context checks each ref once the document is parsed, and
|
|
13
|
-
// removes what holds a ref that names nothing (`
|
|
13
|
+
// removes what holds a ref that names nothing (`parse.danglingRefs`).
|
|
14
14
|
context.registerOasRef(stackTrail.clone(), oasRef);
|
|
15
15
|
return oasRef;
|
|
16
16
|
};
|
|
@@ -146,12 +146,12 @@ const toSchemaV3 = ({ schema, stackTrail, context }) => {
|
|
|
146
146
|
}
|
|
147
147
|
// OpenAPI `not` has no faithful TypeScript representation: a generated type
|
|
148
148
|
// that ignored it would *widen* the contract (accepting shapes the schema
|
|
149
|
-
// forbids). Under `
|
|
149
|
+
// forbids). Under `skmtc.config.json` `parse.not: strict` (the default) the schema
|
|
150
150
|
// is refused rather than emit a type that lies. The throw is isolated by
|
|
151
151
|
// `tryParseAt` into an `INVALID_SCHEMA` issue, and consumers of this schema
|
|
152
152
|
// are pruned via `removeErroredItems` (INVALID_DEPENDENCY_REF).
|
|
153
153
|
//
|
|
154
|
-
// Under `
|
|
154
|
+
// Under `parse.not: unknown` the schema parses with its other keywords, and
|
|
155
155
|
// its `not` is kept as an `OasUnknown` that core does not read: a generator
|
|
156
156
|
// can see that the document says "not something".
|
|
157
157
|
if ('not' in schema) {
|
|
@@ -331,7 +331,7 @@ const toSchemaV3 = ({ schema, stackTrail, context }) => {
|
|
|
331
331
|
stackTrail,
|
|
332
332
|
context
|
|
333
333
|
});
|
|
334
|
-
// Under `
|
|
334
|
+
// Under `parse.anyOf: unknown`, as Cloudflare's `cf` reads it, an `anyOf`
|
|
335
335
|
// of two or more members is any value: the schema parses with its other
|
|
336
336
|
// keywords, so the properties next to it stay, without the members.
|
|
337
337
|
if ((0, anyOfSystem_js_1.isUnknownAnyOf)({ members: wrapper.anyOf ?? [], setting: context.system?.anyOf, getRef: (0, refFns_js_2.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 `
|
|
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;
|
|
@@ -41,7 +41,7 @@ const mergeUnion = ({ schema, getRef, normalize, system, groupType }) => {
|
|
|
41
41
|
};
|
|
42
42
|
exports.mergeUnion = mergeUnion;
|
|
43
43
|
/**
|
|
44
|
-
* The `system` a member's own `allOf` merges under: the `
|
|
44
|
+
* The `system` a member's own `allOf` merges under: the `skmtc.config.json`
|
|
45
45
|
* setting, also in the first pass over a cross product's pairs.
|
|
46
46
|
*/
|
|
47
47
|
const toOwnSystem = (system) => ({
|
|
@@ -58,13 +58,13 @@ exports.toOwnSystem = toOwnSystem;
|
|
|
58
58
|
* collections say `result` is an object or a string, then an array.
|
|
59
59
|
*
|
|
60
60
|
* The first pass is strict between the two members of a pair only. A
|
|
61
|
-
* member's own `allOf` merges under the `
|
|
61
|
+
* member's own `allOf` merges under the `skmtc.config.json` setting
|
|
62
62
|
* ({@link toOwnSystem}). Inside an outer first pass under `latestWins`, a
|
|
63
63
|
* cross product with no pair that merges fails its pair: the outer pass then
|
|
64
64
|
* leaves the pair out, or lets the later member win.
|
|
65
65
|
*
|
|
66
66
|
* A `$ref` that names nothing is not a contradiction, so its pair is not left
|
|
67
|
-
* out for it: the `DanglingRefError` is thrown on, and `
|
|
67
|
+
* out for it: the `DanglingRefError` is thrown on, and `parse.danglingRefs`
|
|
68
68
|
* decides (`allOfMember`).
|
|
69
69
|
*/
|
|
70
70
|
const mergePairs = ({ pairs, merge, system }) => {
|