Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(common): Allow adding custom validators to ParseFilePipeBuilder #10515

Conversation

buddh4
Copy link
Contributor

@buddh4 buddh4 commented Nov 3, 2022

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Currently it is not possible to add custom file validators using the ParseFilePipeBuilder.

What is the new behavior?

This PR adds an addValidator(validator: FileValidator) function, which can be used to add additional validators.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

My use-case for this feature is adding a file-type based mime validator. This change would also allow extending the ParseFilePipeBuilder class with custom builder functions.

@coveralls
Copy link

Pull Request Test Coverage Report for Build cf05d90e-9a25-4cfc-8b1d-d781e20d5774

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 93.788%

Totals Coverage Status
Change from base Build 0e7c875e-a014-419b-8b47-f5f8dfb3a71e: 0.0%
Covered Lines: 6115
Relevant Lines: 6520

💛 - Coveralls

@kamilmysliwiec
Copy link
Member

cc @thiagomini 👀

Copy link
Contributor

@thiagomini thiagomini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! This is an addition I've been thinking about for a while, thanks for the contribution!

@kamilmysliwiec kamilmysliwiec merged commit 9ffdffd into nestjs:master Nov 7, 2022
@kamilmysliwiec
Copy link
Member

lgtm

@buddh4 buddh4 deleted the feat-custom-file-pipe-builder-validators branch December 14, 2022 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants