diff --git a/packages/fxa-settings/src/models/integrations/client-info.ts b/packages/fxa-settings/src/models/integrations/client-info.ts index 69808f77b4..7b2eb4333c 100644 --- a/packages/fxa-settings/src/models/integrations/client-info.ts +++ b/packages/fxa-settings/src/models/integrations/client-info.ts @@ -3,10 +3,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import { - IsBoolean, IsHexadecimal, IsOptional, IsString, + IsBoolean, } from 'class-validator'; import { bind, diff --git a/packages/fxa-settings/src/models/integrations/oauth-integration.ts b/packages/fxa-settings/src/models/integrations/oauth-integration.ts index 0b1ddece06..a069fadb53 100644 --- a/packages/fxa-settings/src/models/integrations/oauth-integration.ts +++ b/packages/fxa-settings/src/models/integrations/oauth-integration.ts @@ -16,12 +16,12 @@ import { IntegrationFlags } from '../../lib/integrations'; import { BaseIntegrationData } from './web-integration'; import { IsBoolean, + IsBooleanString, IsEmail, IsHexadecimal, IsIn, IsNotEmpty, IsOptional, - IsPositive, IsString, MaxLength, MinLength, @@ -109,10 +109,11 @@ export class OAuthIntegrationData extends BaseIntegrationData { @bind(T.snakeCase) idTokenHint: string | undefined; - @IsPositive() + // TODO: Validation - this should be converted to a number and then checked if it's >= 0 @IsOptional() + @IsString() @bind(T.snakeCase) - maxAge: number | undefined; + maxAge: string | undefined; @IsOptional() @IsString() @@ -143,10 +144,10 @@ export class OAuthIntegrationData extends BaseIntegrationData { @bind(T.snakeCase) redirectUri: string | undefined; - @IsBoolean() + @IsBooleanString() @IsOptional() @bind(T.snakeCase) - returnOnError: boolean | undefined; + returnOnError: 'true' | 'false' | undefined; // TODO - Validation - Should scope be required? @IsOptional() diff --git a/packages/fxa-settings/src/models/integrations/signin-signup-info.ts b/packages/fxa-settings/src/models/integrations/signin-signup-info.ts index b3ac238d85..d646b23a74 100644 --- a/packages/fxa-settings/src/models/integrations/signin-signup-info.ts +++ b/packages/fxa-settings/src/models/integrations/signin-signup-info.ts @@ -4,14 +4,12 @@ import { IsBase64, - IsBoolean, + IsBooleanString, IsEmail, IsHexadecimal, IsIn, - IsInt, IsNotEmpty, IsOptional, - IsPositive, IsString, } from 'class-validator'; import { @@ -71,11 +69,11 @@ export class SignInSignUpInfo extends ModelDataProvider { @bind(T.snakeCase) loginHint: string | undefined; + // TODO: Validation - this should be converted to a number and then checked if it's >= 0 @IsOptional() - @IsInt() - @IsPositive() + @IsString() @bind(T.snakeCase) - maxAge: number | undefined; + maxAge: string | undefined; @IsOptional() @IsIn(['consent', 'none', 'login']) @@ -95,9 +93,9 @@ export class SignInSignUpInfo extends ModelDataProvider { redirectTo: string | undefined; @IsOptional() - @IsBoolean() + @IsBooleanString() @bind(T.snakeCase) - returnOnError: boolean | undefined; + returnOnError: 'true' | 'false' | undefined; @IsOptional() @IsString() diff --git a/packages/fxa-settings/src/models/integrations/web-integration.ts b/packages/fxa-settings/src/models/integrations/web-integration.ts index 708304d781..9d4a3cb9bc 100644 --- a/packages/fxa-settings/src/models/integrations/web-integration.ts +++ b/packages/fxa-settings/src/models/integrations/web-integration.ts @@ -26,7 +26,10 @@ export class BaseIntegrationData extends ModelDataProvider { context: string | undefined; @IsOptional() - @IsEmail() + // TODO - Validation - change this to 'IsEmail'. Requiring this to be an email + // causes this to throw when we have a separate model, like a query param or + // link model for a page, where we validate this instead. + @IsString() @bind() email: string | undefined;