Skip to content

Commit d8cd9ad

Browse files
authored
fix(credential.dto): disallow empty type array (#54)
Needed for w3c-ccg test with empty array https://github.com/w3c-ccg/vc-api-issuer-test-suite/blob/cc7e18cd6a5e0ebcb2e73eaec79755422c8970c6/tests/10-issuer.js#L110 Signed-off-by: jrhender <[email protected]>
1 parent 54a7ff1 commit d8cd9ad

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

apps/vc-api/src/vc-api/credentials/dtos/credential.dto.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
import { IsArray, IsDateString, IsObject, IsOptional, IsString } from 'class-validator';
6+
import {
7+
ArrayNotEmpty,
8+
IsArray,
9+
IsDateString,
10+
IsNotEmpty,
11+
IsObject,
12+
IsOptional,
13+
IsString
14+
} from 'class-validator';
715
import { ApiExtraModels, ApiProperty, ApiPropertyOptional, getSchemaPath } from '@nestjs/swagger';
816
import { IsIssuer } from '../../exchanges/dtos/custom-validators';
917
import { IssuerDto } from './issuer.dto';
@@ -30,6 +38,7 @@ export class CredentialDto {
3038
id?: string;
3139

3240
@IsArray()
41+
@ArrayNotEmpty()
3342
@IsString({ each: true })
3443
@ApiProperty({ description: 'The JSON-LD type of the credential.' })
3544
type: string[];

0 commit comments

Comments
 (0)