From 1735a3824aa3a52f6c07c47124ea57952a3b3e66 Mon Sep 17 00:00:00 2001 From: Alexander Cerutti Date: Wed, 20 Oct 2021 00:08:38 +0200 Subject: [PATCH] Changed logic for formatVersion parsing and defaulting --- src/schemas/index.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/schemas/index.ts b/src/schemas/index.ts index 6d9be8b..569d68f 100644 --- a/src/schemas/index.ts +++ b/src/schemas/index.ts @@ -28,6 +28,7 @@ export interface FileBuffers { } export interface PassProps { + formatVersion?: 1; serialNumber?: string; description?: string; organizationName?: string; @@ -119,6 +120,7 @@ export const PassType = Joi.string().regex( ); export const OverridablePassProps = Joi.object({ + formatVersion: Joi.number().default(1), semantics: Semantics, voided: Joi.boolean(), logoText: Joi.string(), @@ -145,12 +147,8 @@ export const OverridablePassProps = Joi.object({ }).with("webServiceURL", "authenticationToken"); export const PassProps = Joi.object< - OverridablePassProps & - PassKindsProps & - PassPropsFromMethods & { formatVersion: 1 } ->({ - formatVersion: Joi.number(), -}) + OverridablePassProps & PassKindsProps & PassPropsFromMethods +>() .concat(OverridablePassProps) .concat(PassKindsProps) .concat(PassPropsFromMethods);