-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb2ef1a
commit b059f50
Showing
4 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
/** | ||
* Interface describing FileValidators, which can be added to a {@link ParseFilePipe}. | ||
*/ | ||
export abstract class FileValidator<TValidationOptions = Record<string, any>> { | ||
constructor(protected readonly validationOptions: TValidationOptions) {} | ||
|
||
/** | ||
* Indicates if this file should be considered valid, according to the options passed in the constructor. | ||
* @param file the file from the request object | ||
*/ | ||
abstract isValid(file?: any): boolean; | ||
|
||
/** | ||
* Builds an error message in case the validation fails. | ||
* @param file the file from the request object | ||
*/ | ||
abstract buildErrorMessage(file: any): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters