Skip to content

Commit

Permalink
fix(credential.dto): disallow empty type array (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrhender authored Feb 18, 2025
1 parent 54a7ff1 commit d8cd9ad
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion apps/vc-api/src/vc-api/credentials/dtos/credential.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { IsArray, IsDateString, IsObject, IsOptional, IsString } from 'class-validator';
import {
ArrayNotEmpty,
IsArray,
IsDateString,
IsNotEmpty,
IsObject,
IsOptional,
IsString
} from 'class-validator';
import { ApiExtraModels, ApiProperty, ApiPropertyOptional, getSchemaPath } from '@nestjs/swagger';
import { IsIssuer } from '../../exchanges/dtos/custom-validators';
import { IssuerDto } from './issuer.dto';
Expand All @@ -30,6 +38,7 @@ export class CredentialDto {
id?: string;

@IsArray()
@ArrayNotEmpty()
@IsString({ each: true })
@ApiProperty({ description: 'The JSON-LD type of the credential.' })
type: string[];
Expand Down

0 comments on commit d8cd9ad

Please sign in to comment.