class-validator#isArray TypeScript Examples
The following examples show how to use
class-validator#isArray.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: shared.dto.ts From affinidi-core-sdk with Apache License 2.0 | 6 votes |
@IsArray()
@IsIn(['rsa', 'bbs', 'ecdsa'], { each: true })
keyTypes: KeyAlgorithmType[]
Example #2
Source File: classes.ts From epicgames-freegames-node with MIT License | 6 votes |
/**
* A list of Discord user IDs to ping when posting the message. The IDs must be strings wrapped in quotes.
* How to get a user ID: https://support.discord.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID-
* @example ["914360712086843432", "914360712086843433"]
* @env DISCORD_MENTIONED_USERS (comma separated)
*/
@IsOptional()
@IsArray()
@IsString({ each: true })
mentionedUsers: string[];
Example #3
Source File: data_source.ts From Deep-Lynx with MIT License | 6 votes |
// advanced configuration, while we allow the user to set these it's generally
// assumed that only those with technical knowledge or experience would be modifying
// these
// when parsing data from this data source, these are nodes which should be removed
// and ignored when creating the shape_hash
@IsOptional()
@IsArray()
stop_nodes?: string[];
Example #4
Source File: write-telemetry-points.dto.ts From ironfish-api with Mozilla Public License 2.0 | 6 votes |
@IsArray()
@ArrayMaxSize(3000)
@ValidateNested({ each: true })
@Type(() => BaseFieldDto, {
keepDiscriminatorProperty: true,
discriminator: {
property: 'type',
subTypes: [
{ name: 'boolean', value: BooleanFieldDto },
{ name: 'float', value: FloatFieldDto },
{ name: 'integer', value: IntegerFieldDto },
{ name: 'string', value: StringFieldDto },
],
},
})
readonly fields!: FieldDto[];
Example #5
Source File: query-builder.ts From typeorm-query-builder-wrapper with MIT License | 6 votes |
/**
* Select one or multiple fields with each Alias field
*
* @param args Array of Array of field with alias, e.g: ['t1.id', 'id'], ...
*/
public selectRaw(...args: Array<string | string[]>) {
const expressionArgs = args.filter(
arg => isString(arg) || (isArray(arg) && arg.length <= 2),
);
if (!expressionArgs.length) {
throw new Error(`String expression is required for the selectRaw method`);
}
for (const arg of args) {
if (args.indexOf(arg) === 0) {
if (arg[1]) {
this.qb.select(arg[0], arg[1]);
} else {
this.qb.select(arg[0]);
}
} else {
if (arg[1]) {
this.qb.addSelect(arg[0], arg[1]);
} else {
this.qb.addSelect(arg[0]);
}
}
}
return this;
}
Example #6
Source File: custom-validators.ts From relate with GNU General Public License v3.0 | 6 votes |
export function IsPluginConfig(validationOptions?: ValidationOptions) {
return (object: any, propertyName: string) => {
registerDecorator({
name: 'isPluginConfig',
target: object.constructor,
propertyName: propertyName,
options: validationOptions,
validator: {
validate(value: any, _args: ValidationArguments) {
if (isObjectLike(value)) {
return Object.entries(value).every(([_, v]) => {
if (isArray(v)) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
return Array.from(v).every(isString);
}
return isString(v) || isBoolean(v);
});
}
return false;
},
defaultMessage(args?: ValidationArguments) {
const expectedMsg = 'Expected "{ [key: string]: string | string[] | boolean }"';
if (!args) {
return expectedMsg;
}
const strValue = JSON.stringify(args.value);
return `${expectedMsg} on "${args.property}" but found "${strValue}" instead`;
},
},
});
};
}
Example #7
Source File: create-application.dto.ts From uniauth-backend with MIT License | 5 votes |
@ApiProperty({
description: 'list of origins that are allowed to invoke the client',
example: ['localhost:5000', 'http://localhost:5000', 'https://localhost:5000/login'],
})
@IsArray()
@IsNotEmpty()
authorizedOrigin: Array<string>;
Example #8
Source File: shared.dto.ts From affinidi-core-sdk with Apache License 2.0 | 5 votes |
@IsDefined()
@IsArray()
context: unknown[]
Example #9
Source File: organizations.ts From crossfeed with Creative Commons Zero v1.0 Universal | 5 votes |
@IsArray()
rootDomains: string[];
Example #10
Source File: classes.ts From epicgames-freegames-node with MIT License | 5 votes |
/**
* A list of accounts to work with
*/
@IsArray()
@ValidateNested({ each: true })
@ArrayNotEmpty()
@Type(() => AccountConfig)
accounts: AccountConfig[];
Example #11
Source File: user.dto.ts From codeclannigeria-backend with MIT License | 5 votes |
@Expose()
@IsArray()
@Length(1, columnSize.length32, { each: true })
@ApiProperty({ isArray: true, type: String })
@IsOptional()
technologies?: string[];
Example #12
Source File: course-update.dto.ts From edu-server with MIT License | 5 votes |
/**
* The Tag associated with the course
* @example WEB_DEV
*/
@IsNotEmpty()
@IsArray()
@IsEnum(TagType, { each: true })
tags: TagType[];
Example #13
Source File: is-files.validator.ts From nestjs-form-data with MIT License | 5 votes |
export function IsFiles(validationOptions?: ValidationOptions): PropertyDecorator {
return applyDecorators(
IsArray(validationOptions),
IsFile(Object.assign(validationOptions || {}, { each: true })),
);
}
Example #14
Source File: rsa.ts From Deep-Lynx with MIT License | 5 votes |
@IsArray()
@ValidateNested()
@Type(() => CollectedInput)
collectedInputs?: CollectedInput[];
Example #15
Source File: diary.dto.ts From life-helper-backend with MIT License | 5 votes |
/** ็
ง็ๅ่กจ */
@IsArray()
@IsOptional()
images: string[]
Example #16
Source File: upsert-blocks.dto.ts From ironfish-api with Mozilla Public License 2.0 | 5 votes |
@IsArray()
@ArrayMinSize(1)
@ValidateNested({ each: true })
@Type(() => TransactionDto)
readonly transactions!: TransactionDto[];
Example #17
Source File: createSubmission.dto.ts From coronatest with GNU Affero General Public License v3.0 | 5 votes |
@IsArray()
symptoms: object;
Example #18
Source File: create-diagnosis-keys.dto.ts From mamori-i-japan-api with BSD 2-Clause "Simplified" License | 5 votes |
@ApiProperty({ type: TempIDDto, isArray: true })
@IsArray()
@ValidateNested({ each: true })
@Type(() => TempIDDto)
tempIDs: TempIDDto[]
Example #19
Source File: user-create-input.dto.ts From nestjs-starter-rest-api with MIT License | 5 votes |
@ApiProperty()
@IsArray()
@ArrayNotEmpty()
@IsEnum(ROLE, { each: true })
roles: ROLE[];
Example #20
Source File: manifest.model.ts From relate with GNU General Public License v3.0 | 5 votes |
@IsOptional()
@IsString({each: true})
@IsArray()
public tags: string[] = [];
Example #21
Source File: PublicUser.ts From tezos-academy with MIT License | 5 votes |
@IsArray()
progress?: string[]
Example #22
Source File: create-message.dto.ts From bank-server with MIT License | 5 votes |
@IsArray()
@IsNotEmpty()
@ApiProperty({
type: () => CreateMessageTemplateDto,
isArray: true,
})
readonly templates: CreateMessageTemplateDto[];
Example #23
Source File: create-user.dto.ts From nestjs-starter with MIT License | 5 votes |
@ApiProperty({ description: 'Additional user metadata or custom fields', type: CreateUserMetadataDto, isArray: true })
@IsArray()
@ValidateNested({ each: true })
@Type(() => CreateUserMetadataDto)
@IsOptional()
metadata: CreateUserMetadataDto[];
Example #24
Source File: index.ts From office-hours with GNU General Public License v3.0 | 5 votes |
// List of CRN's in the section group
@IsArray()
crns!: number[];