@skmtc/core 0.40.0 → 0.42.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/GenerateContext.d.ts +1 -1
- package/esm/context/GenerateContext.js +4 -3
- package/esm/context/ParseContext.d.ts +26 -0
- package/esm/context/ParseContext.js +112 -2
- package/esm/context/generateTypes.d.ts +16 -2
- package/esm/context/generateTypes.js +2 -0
- package/esm/context/tryParseAt.d.ts +4 -1
- package/esm/context/tryParseAt.js +10 -3
- package/esm/helpers/collateExamples.js +15 -5
- package/esm/helpers/refFns.d.ts +9 -3
- package/esm/helpers/refFns.js +29 -9
- package/esm/mod.d.ts +1 -0
- package/esm/mod.js +1 -0
- package/esm/oas/ref/DanglingRefError.d.ts +22 -0
- package/esm/oas/ref/DanglingRefError.js +33 -0
- package/esm/oas/ref/Ref.d.ts +5 -0
- package/esm/oas/ref/Ref.js +28 -2
- package/esm/oas/schema/siblings.js +12 -2
- package/esm/oas/union/Union.d.ts +2 -1
- package/esm/oas/union/Union.js +23 -12
- package/esm/parse/securityRequirements.d.ts +6 -0
- package/esm/parse/securityRequirements.js +8 -0
- package/esm/parse/v3-0/_merge-all-of/merge-union.js +9 -1
- package/esm/parse/v3-0/mediaType/toMediaTypeItemV3.js +4 -3
- package/esm/parse/v3-0/parameter/toParameterV3.js +4 -3
- package/esm/parse/v3-0/ref/toRefV31.js +5 -2
- package/esm/parse/v3-0/schema/toSchemasV3.js +6 -3
- package/esm/parse/v3-1/_merge-all-of/merge-union.js +16 -4
- package/esm/parse/v3-1/mediaType/toMediaTypeItemV3.js +4 -3
- package/esm/parse/v3-1/parameter/toParameterV3.js +4 -3
- package/esm/parse/v3-1/ref/toRefV31.js +5 -2
- package/esm/parse/v3-1/schema/toSchemasV3.js +6 -3
- package/esm/parse/v3-2/_merge-all-of/merge-union.js +16 -4
- package/esm/parse/v3-2/mediaType/toMediaTypeItemV3.js +4 -3
- package/esm/parse/v3-2/parameter/toParameterV3.js +4 -3
- package/esm/parse/v3-2/ref/toRefV31.js +5 -2
- package/esm/parse/v3-2/schema/toSchemasV3.js +6 -3
- package/esm/types/Settings.d.ts +21 -0
- package/esm/types/Settings.js +19 -1
- package/package.json +5 -1
- package/script/context/GenerateContext.d.ts +1 -1
- package/script/context/GenerateContext.js +4 -3
- package/script/context/ParseContext.d.ts +26 -0
- package/script/context/ParseContext.js +112 -2
- package/script/context/generateTypes.d.ts +16 -2
- package/script/context/generateTypes.js +2 -0
- package/script/context/tryParseAt.d.ts +4 -1
- package/script/context/tryParseAt.js +10 -3
- package/script/helpers/collateExamples.js +15 -5
- package/script/helpers/refFns.d.ts +9 -3
- package/script/helpers/refFns.js +29 -9
- package/script/mod.d.ts +1 -0
- package/script/mod.js +1 -0
- package/script/oas/ref/DanglingRefError.d.ts +22 -0
- package/script/oas/ref/DanglingRefError.js +37 -0
- package/script/oas/ref/Ref.d.ts +5 -0
- package/script/oas/ref/Ref.js +28 -2
- package/script/oas/schema/siblings.js +12 -2
- package/script/oas/union/Union.d.ts +2 -1
- package/script/oas/union/Union.js +23 -12
- package/script/parse/securityRequirements.d.ts +6 -0
- package/script/parse/securityRequirements.js +8 -0
- package/script/parse/v3-0/_merge-all-of/merge-union.js +9 -1
- package/script/parse/v3-0/mediaType/toMediaTypeItemV3.js +4 -3
- package/script/parse/v3-0/parameter/toParameterV3.js +4 -3
- package/script/parse/v3-0/ref/toRefV31.js +5 -2
- package/script/parse/v3-0/schema/toSchemasV3.js +6 -3
- package/script/parse/v3-1/_merge-all-of/merge-union.js +16 -4
- package/script/parse/v3-1/mediaType/toMediaTypeItemV3.js +4 -3
- package/script/parse/v3-1/parameter/toParameterV3.js +4 -3
- package/script/parse/v3-1/ref/toRefV31.js +5 -2
- package/script/parse/v3-1/schema/toSchemasV3.js +6 -3
- package/script/parse/v3-2/_merge-all-of/merge-union.js +16 -4
- package/script/parse/v3-2/mediaType/toMediaTypeItemV3.js +4 -3
- package/script/parse/v3-2/parameter/toParameterV3.js +4 -3
- package/script/parse/v3-2/ref/toRefV31.js +5 -2
- package/script/parse/v3-2/schema/toSchemasV3.js +6 -3
- package/script/types/Settings.d.ts +21 -0
- package/script/types/Settings.js +20 -2
|
@@ -162,6 +162,15 @@ export declare const includeModels: v.GenericSchema<IncludeModels>;
|
|
|
162
162
|
* {@link AnchorsSettings} for the consumer-facing fields.
|
|
163
163
|
*/
|
|
164
164
|
export declare const anchorsSettings: v.GenericSchema<AnchorsSettings>;
|
|
165
|
+
/**
|
|
166
|
+
* What `client.json#settings.system.danglingRefs` can list: each kind of
|
|
167
|
+
* `$ref`, and `allOfMember`, a `$ref` that core merges at parse: a member of
|
|
168
|
+
* an `allOf`, also one inside a `oneOf` or `anyOf` member, or a `oneOf` or
|
|
169
|
+
* `anyOf` member merged with the keywords beside the union.
|
|
170
|
+
*/
|
|
171
|
+
export declare const danglingRefKinds: readonly ["schema", "parameter", "requestBody", "response", "header", "securityScheme", "example", "link", "allOfMember"];
|
|
172
|
+
/** A kind of `$ref` that `system.danglingRefs` can let name nothing. */
|
|
173
|
+
export type DanglingRefKind = (typeof danglingRefKinds)[number];
|
|
165
174
|
/** Valibot schema for {@link SystemSettings}: `client.json#settings.system`. */
|
|
166
175
|
export declare const systemSettings: v.GenericSchema<SystemSettings>;
|
|
167
176
|
export declare const clientSettings: v.GenericSchema<ClientSettings>;
|
|
@@ -449,6 +458,18 @@ export type SystemSettings = {
|
|
|
449
458
|
* keywords and without the `anyOf`, with one warning for each schema.
|
|
450
459
|
*/
|
|
451
460
|
anyOf?: 'union' | 'unknown';
|
|
461
|
+
/**
|
|
462
|
+
* The kinds of `$ref` that may name nothing in the document. A dangling
|
|
463
|
+
* `$ref` of a listed kind stays, with a warning, and resolving it throws
|
|
464
|
+
* `DanglingRefError` for the generator to handle. A dangling `$ref` of any
|
|
465
|
+
* other kind is a parse error, and what holds it is removed, with what uses
|
|
466
|
+
* that. `allOfMember` is core's own choice, made at parse: a `$ref` that
|
|
467
|
+
* core merges (a member of an `allOf`, also inside a `oneOf` or `anyOf`
|
|
468
|
+
* member, or a union member merged with the keywords beside the union) is
|
|
469
|
+
* left out of the merge, so its properties are not in the model. The
|
|
470
|
+
* default, `[]`, lists none.
|
|
471
|
+
*/
|
|
472
|
+
danglingRefs?: DanglingRefKind[];
|
|
452
473
|
};
|
|
453
474
|
export type ClientSettings = {
|
|
454
475
|
/** Base output path for generated files */
|
package/script/types/Settings.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.skmtcClientConfig = exports.clientSettings = exports.systemSettings = exports.anchorsSettings = exports.includeModels = exports.includeModelRefs = exports.includeOperations = exports.includePaths = exports.skipModels = exports.skipModelRefs = exports.skipOperations = exports.skipPaths = exports.modulePackages = exports.modulePackage = void 0;
|
|
36
|
+
exports.skmtcClientConfig = exports.clientSettings = exports.systemSettings = exports.danglingRefKinds = exports.anchorsSettings = exports.includeModels = exports.includeModelRefs = exports.includeOperations = exports.includePaths = exports.skipModels = exports.skipModelRefs = exports.skipOperations = exports.skipPaths = exports.modulePackages = exports.modulePackage = void 0;
|
|
37
37
|
/**
|
|
38
38
|
* @fileoverview SKMTC Core Settings and Configuration
|
|
39
39
|
*
|
|
@@ -205,12 +205,30 @@ exports.anchorsSettings = v.object({
|
|
|
205
205
|
enabled: v.boolean(),
|
|
206
206
|
out: v.optional(v.string())
|
|
207
207
|
});
|
|
208
|
+
/**
|
|
209
|
+
* What `client.json#settings.system.danglingRefs` can list: each kind of
|
|
210
|
+
* `$ref`, and `allOfMember`, a `$ref` that core merges at parse: a member of
|
|
211
|
+
* an `allOf`, also one inside a `oneOf` or `anyOf` member, or a `oneOf` or
|
|
212
|
+
* `anyOf` member merged with the keywords beside the union.
|
|
213
|
+
*/
|
|
214
|
+
exports.danglingRefKinds = [
|
|
215
|
+
'schema',
|
|
216
|
+
'parameter',
|
|
217
|
+
'requestBody',
|
|
218
|
+
'response',
|
|
219
|
+
'header',
|
|
220
|
+
'securityScheme',
|
|
221
|
+
'example',
|
|
222
|
+
'link',
|
|
223
|
+
'allOfMember'
|
|
224
|
+
];
|
|
208
225
|
/** Valibot schema for {@link SystemSettings}: `client.json#settings.system`. */
|
|
209
226
|
exports.systemSettings = v.object({
|
|
210
227
|
allOf: v.optional(v.picklist(['strict', 'latestWins'])),
|
|
211
228
|
responseContradictions: v.optional(v.picklist(['strict', 'unknown'])),
|
|
212
229
|
not: v.optional(v.picklist(['strict', 'unknown'])),
|
|
213
|
-
anyOf: v.optional(v.picklist(['union', 'unknown']))
|
|
230
|
+
anyOf: v.optional(v.picklist(['union', 'unknown'])),
|
|
231
|
+
danglingRefs: v.optional(v.array(v.picklist(exports.danglingRefKinds)))
|
|
214
232
|
});
|
|
215
233
|
exports.clientSettings = v.object({
|
|
216
234
|
basePath: v.optional(v.pipe(v.string(), v.check(basePath => !(0, normalizeWorkspacePath_js_1.isAbsolutePath)(basePath), 'basePath must be relative to the SKMTC root (the directory containing .skmtc/); ' +
|