mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 18:25:24 +00:00
Fixed Joi update new Api integration
This commit is contained in:
@@ -376,7 +376,7 @@ export interface Beacon {
|
|||||||
|
|
||||||
const beaconsDict = Joi.object().keys({
|
const beaconsDict = Joi.object().keys({
|
||||||
major: Joi.number().integer().positive().max(65535).greater(Joi.ref("minor")),
|
major: Joi.number().integer().positive().max(65535).greater(Joi.ref("minor")),
|
||||||
minor: Joi.number().integer().min(0).max(65535).less(Joi.ref("major")),
|
minor: Joi.number().integer().min(0).max(65535),
|
||||||
proximityUUID: Joi.string().required(),
|
proximityUUID: Joi.string().required(),
|
||||||
relevantText: Joi.string()
|
relevantText: Joi.string()
|
||||||
});
|
});
|
||||||
@@ -484,7 +484,7 @@ export function isValid(opts: any, schemaName: Schema): boolean {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const validation = Joi.validate(opts, resolvedSchema);
|
const validation = resolvedSchema.validate(opts);
|
||||||
|
|
||||||
if (validation.error) {
|
if (validation.error) {
|
||||||
schemaDebug(`validation failed due to error: ${validation.error.message}`);
|
schemaDebug(`validation failed due to error: ${validation.error.message}`);
|
||||||
@@ -501,8 +501,8 @@ export function isValid(opts: any, schemaName: Schema): boolean {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export function getValidated<T extends Object>(opts: any, schemaName: Schema): T {
|
export function getValidated<T extends Object>(opts: any, schemaName: Schema): T {
|
||||||
let resolvedSchema = resolveSchemaName(schemaName);
|
const resolvedSchema = resolveSchemaName(schemaName);
|
||||||
let validation = Joi.validate(opts, resolvedSchema, { stripUnknown: true });
|
const validation = resolvedSchema.validate(opts, { stripUnknown: true });
|
||||||
|
|
||||||
if (validation.error) {
|
if (validation.error) {
|
||||||
schemaDebug(`Validation failed in getValidated due to error: ${validation.error.message}`);
|
schemaDebug(`Validation failed in getValidated due to error: ${validation.error.message}`);
|
||||||
|
|||||||
Reference in New Issue
Block a user