@aeriajs/validation 0.0.136 → 0.0.137
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/dist/validate.d.ts +1 -1
- package/dist/validate.js +3 -3
- package/dist/validate.mjs +3 -3
- package/package.json +1 -1
package/dist/validate.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export type ValidateOptions = {
|
|
|
9
9
|
};
|
|
10
10
|
export declare const makeValidationError: <TValidationError extends ValidationError>(error: TValidationError) => TValidationError;
|
|
11
11
|
export declare const validateProperty: <TWhat>(what: TWhat, property: Property | undefined, options?: ValidateOptions) => Result.Either<PropertyValidationError | ValidationError, unknown>;
|
|
12
|
-
export declare const validateRefs: <TWhat>(what: TWhat, property: Property | Description | undefined, descriptions?: Record<string, Description>) => Promise<Result.Either<PropertyValidationError | ValidationError, unknown>>;
|
|
12
|
+
export declare const validateRefs: <TWhat>(what: TWhat, property: Property | Description | undefined, options?: ValidateOptions, descriptions?: Record<string, Description>) => Promise<Result.Either<PropertyValidationError | ValidationError, unknown>>;
|
|
13
13
|
export declare const validateWholeness: (what: Record<string, unknown>, schema: Omit<JsonSchema, "$id">) => {
|
|
14
14
|
code: ValidationErrorCode.MissingProperties;
|
|
15
15
|
errors: {
|
package/dist/validate.js
CHANGED
|
@@ -189,7 +189,7 @@ const validateProperty = (what, property, options = {}) => {
|
|
|
189
189
|
return types_1.Result.result(what);
|
|
190
190
|
};
|
|
191
191
|
exports.validateProperty = validateProperty;
|
|
192
|
-
const validateRefs = async (what, property, descriptions) => {
|
|
192
|
+
const validateRefs = async (what, property, options, descriptions) => {
|
|
193
193
|
if (property) {
|
|
194
194
|
if ('$ref' in property) {
|
|
195
195
|
let description;
|
|
@@ -216,7 +216,7 @@ const validateRefs = async (what, property, descriptions) => {
|
|
|
216
216
|
throw new Error;
|
|
217
217
|
}
|
|
218
218
|
for (const elem of what) {
|
|
219
|
-
const { error } = await (0, exports.validateRefs)(elem, property.items, descriptions);
|
|
219
|
+
const { error } = await (0, exports.validateRefs)(elem, property.items, options, descriptions);
|
|
220
220
|
if (error) {
|
|
221
221
|
return types_1.Result.error(error);
|
|
222
222
|
}
|
|
@@ -225,7 +225,7 @@ const validateRefs = async (what, property, descriptions) => {
|
|
|
225
225
|
else if ('properties' in property) {
|
|
226
226
|
const errors = {};
|
|
227
227
|
for (const propName in what) {
|
|
228
|
-
const { error } = await (0, exports.validateRefs)(what[propName], property.properties[propName], descriptions);
|
|
228
|
+
const { error } = await (0, exports.validateRefs)(what[propName], property.properties[propName], options, descriptions);
|
|
229
229
|
if (error) {
|
|
230
230
|
errors[propName] = error;
|
|
231
231
|
}
|
package/dist/validate.mjs
CHANGED
|
@@ -177,7 +177,7 @@ export const validateProperty = (what, property, options = {}) => {
|
|
|
177
177
|
}
|
|
178
178
|
return Result.result(what);
|
|
179
179
|
};
|
|
180
|
-
export const validateRefs = async (what, property, descriptions) => {
|
|
180
|
+
export const validateRefs = async (what, property, options, descriptions) => {
|
|
181
181
|
if (property) {
|
|
182
182
|
if ("$ref" in property) {
|
|
183
183
|
let description;
|
|
@@ -202,7 +202,7 @@ export const validateRefs = async (what, property, descriptions) => {
|
|
|
202
202
|
throw new Error();
|
|
203
203
|
}
|
|
204
204
|
for (const elem of what) {
|
|
205
|
-
const { error } = await validateRefs(elem, property.items, descriptions);
|
|
205
|
+
const { error } = await validateRefs(elem, property.items, options, descriptions);
|
|
206
206
|
if (error) {
|
|
207
207
|
return Result.error(error);
|
|
208
208
|
}
|
|
@@ -210,7 +210,7 @@ export const validateRefs = async (what, property, descriptions) => {
|
|
|
210
210
|
} else if ("properties" in property) {
|
|
211
211
|
const errors = {};
|
|
212
212
|
for (const propName in what) {
|
|
213
|
-
const { error } = await validateRefs(what[propName], property.properties[propName], descriptions);
|
|
213
|
+
const { error } = await validateRefs(what[propName], property.properties[propName], options, descriptions);
|
|
214
214
|
if (error) {
|
|
215
215
|
errors[propName] = error;
|
|
216
216
|
}
|