@naturalcycles/nodejs-lib 15.39.0 → 15.40.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.
|
@@ -47,6 +47,11 @@ export declare class JsonSchemaAnyBuilder<IN, OUT, Opt> {
|
|
|
47
47
|
*/
|
|
48
48
|
build(): JsonSchema<IN, OUT>;
|
|
49
49
|
clone(): JsonSchemaAnyBuilder<IN, OUT, Opt>;
|
|
50
|
+
/**
|
|
51
|
+
* @deprecated
|
|
52
|
+
* The usage of this function is discouraged as it defeats the purpose of having type-safe validation.
|
|
53
|
+
*/
|
|
54
|
+
castAs<T>(): JsonSchemaAnyBuilder<T, T, Opt>;
|
|
50
55
|
/**
|
|
51
56
|
* @experimental
|
|
52
57
|
*/
|
|
@@ -124,6 +129,10 @@ export declare class JsonSchemaObjectBuilder<PROPS extends Record<string, JsonSc
|
|
|
124
129
|
}>, Opt> {
|
|
125
130
|
constructor(props?: PROPS);
|
|
126
131
|
addProperties(props: PROPS): this;
|
|
132
|
+
/**
|
|
133
|
+
* When set, the validation will not strip away properties that are not specified explicitly in the schema.
|
|
134
|
+
*/
|
|
135
|
+
allowAdditionalProperties(): this;
|
|
127
136
|
extend<NEW_PROPS extends Record<string, JsonSchemaAnyBuilder<any, any, any>>>(props: NEW_PROPS): JsonSchemaObjectBuilder<{
|
|
128
137
|
[K in keyof PROPS | keyof NEW_PROPS]: K extends keyof NEW_PROPS ? NEW_PROPS[K] : K extends keyof PROPS ? PROPS[K] : never;
|
|
129
138
|
}, Opt>;
|
|
@@ -150,6 +150,13 @@ export class JsonSchemaAnyBuilder {
|
|
|
150
150
|
clone() {
|
|
151
151
|
return new JsonSchemaAnyBuilder(_deepCopy(this.schema));
|
|
152
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* @deprecated
|
|
155
|
+
* The usage of this function is discouraged as it defeats the purpose of having type-safe validation.
|
|
156
|
+
*/
|
|
157
|
+
castAs() {
|
|
158
|
+
return this;
|
|
159
|
+
}
|
|
153
160
|
/**
|
|
154
161
|
* @experimental
|
|
155
162
|
*/
|
|
@@ -384,6 +391,13 @@ export class JsonSchemaObjectBuilder extends JsonSchemaAnyBuilder {
|
|
|
384
391
|
this.schema.required = _uniq(required).sort();
|
|
385
392
|
return this;
|
|
386
393
|
}
|
|
394
|
+
/**
|
|
395
|
+
* When set, the validation will not strip away properties that are not specified explicitly in the schema.
|
|
396
|
+
*/
|
|
397
|
+
allowAdditionalProperties() {
|
|
398
|
+
Object.assign(this.schema, { additionalProperties: true });
|
|
399
|
+
return this;
|
|
400
|
+
}
|
|
387
401
|
extend(props) {
|
|
388
402
|
const newBuilder = new JsonSchemaObjectBuilder();
|
|
389
403
|
Object.assign(newBuilder.schema, _deepCopy(this.schema));
|
package/package.json
CHANGED
|
@@ -213,6 +213,14 @@ export class JsonSchemaAnyBuilder<IN, OUT, Opt> {
|
|
|
213
213
|
return new JsonSchemaAnyBuilder<IN, OUT, Opt>(_deepCopy(this.schema))
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
+
/**
|
|
217
|
+
* @deprecated
|
|
218
|
+
* The usage of this function is discouraged as it defeats the purpose of having type-safe validation.
|
|
219
|
+
*/
|
|
220
|
+
castAs<T>(): JsonSchemaAnyBuilder<T, T, Opt> {
|
|
221
|
+
return this as unknown as JsonSchemaAnyBuilder<T, T, Opt>
|
|
222
|
+
}
|
|
223
|
+
|
|
216
224
|
/**
|
|
217
225
|
* @experimental
|
|
218
226
|
*/
|
|
@@ -555,6 +563,14 @@ export class JsonSchemaObjectBuilder<
|
|
|
555
563
|
return this
|
|
556
564
|
}
|
|
557
565
|
|
|
566
|
+
/**
|
|
567
|
+
* When set, the validation will not strip away properties that are not specified explicitly in the schema.
|
|
568
|
+
*/
|
|
569
|
+
allowAdditionalProperties(): this {
|
|
570
|
+
Object.assign(this.schema, { additionalProperties: true })
|
|
571
|
+
return this
|
|
572
|
+
}
|
|
573
|
+
|
|
558
574
|
extend<NEW_PROPS extends Record<string, JsonSchemaAnyBuilder<any, any, any>>>(
|
|
559
575
|
props: NEW_PROPS,
|
|
560
576
|
): JsonSchemaObjectBuilder<
|