We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 68ea098 commit dfed494Copy full SHA for dfed494
1 file changed
packages/common/pipes/parse-uuid.pipe.ts
@@ -16,14 +16,16 @@ export class ParseUUIDPipe implements PipeTransform<string> {
16
constructor(@Optional() options?: ParseUUIDPipeOptions) {
17
options = options || {};
18
19
- this.version = options.version || '4';
+ this.version = options.version;
20
this.exceptionFactory =
21
options.exceptionFactory || (error => new BadRequestException(error));
22
}
23
async transform(value: string, metadata: ArgumentMetadata): Promise<string> {
24
if (!isUUID(value, this.version)) {
25
throw this.exceptionFactory(
26
- `Validation failed (uuid v${this.version} is expected)`,
+ `Validation failed (uuid ${
27
+ this.version ? 'v' + this.version : ''
28
+ } is expected)`,
29
);
30
31
return value;
0 commit comments