@@ -17,7 +17,7 @@ import {
17
17
import { ApiExtraModels , ApiProperty , ApiPropertyOptional , getSchemaPath } from '@nestjs/swagger' ;
18
18
import { plainToClass , Transform , Type } from 'class-transformer' ;
19
19
import { IsNotSQLInjection , trim } from '@credebl/common/cast.helper' ;
20
- import { JSONSchemaType , SchemaTypeEnum , W3CSchemaDataType } from '@credebl/enum/enum' ;
20
+ import { IndySchemaDataType , JSONSchemaType , SchemaTypeEnum , W3CSchemaDataType } from '@credebl/enum/enum' ;
21
21
22
22
export class W3CAttributeValue {
23
23
@ApiProperty ( )
@@ -37,7 +37,9 @@ export class W3CAttributeValue {
37
37
enum : W3CSchemaDataType ,
38
38
example : W3CSchemaDataType . STRING
39
39
} )
40
- @IsEnum ( W3CSchemaDataType , { message : 'Schema data type must be a valid type' } )
40
+ @IsEnum ( W3CSchemaDataType , {
41
+ message : `Schema data type must be one of [${ Object . values ( W3CSchemaDataType ) . join ( ', ' ) } ]`
42
+ } )
41
43
schemaDataType : W3CSchemaDataType ;
42
44
43
45
@ApiProperty ( )
@@ -205,11 +207,17 @@ class AttributeValue {
205
207
@IsNotEmpty ( { message : 'attributeName is required' } )
206
208
attributeName : string ;
207
209
208
- @ApiProperty ( )
210
+ @ApiProperty ( {
211
+ description : 'The type of the schema' ,
212
+ enum : IndySchemaDataType ,
213
+ example : IndySchemaDataType . STRING
214
+ } )
209
215
@IsString ( )
210
216
@Transform ( ( { value } ) => trim ( value ) )
211
- @IsNotEmpty ( { message : 'schemaDataType is required' } )
212
- schemaDataType : string ;
217
+ @IsEnum ( IndySchemaDataType , {
218
+ message : `Schema data type must be one of [${ Object . values ( IndySchemaDataType ) . join ( ', ' ) } ]`
219
+ } )
220
+ schemaDataType : IndySchemaDataType ;
213
221
214
222
@ApiProperty ( )
215
223
@IsString ( )
0 commit comments