feat(common): add message property to file type validator#16060
Merged
kamilmysliwiec merged 8 commits intoDec 21, 2025
Conversation
Pull Request Test Coverage Report for Build 71f3c018-4d14-4733-9975-4a2037f6195eDetails
💛 - Coveralls |
1 task
micalevisk
approved these changes
Dec 13, 2025
Member
|
thanks! |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Previously, only MaxFileSizeValidator supported custom messages, while FileTypeValidator did not, which caused confusion and made it difficult to deliver service-appropriate messages.
Errors were also returned as simple strings, requiring unnecessary branching through the exceptionFactory.
Now, the usage of MaxFileSizeValidator and FileTypeValidator—specifically the way custom messages are delivered—has been standardized.
What is the new behavior?
By enabling the use of custom messages in FileTypeValidator—as was already possible in MaxFileSizeValidator—it is now possible to deliver service-appropriate messages and maintain consistency in how MaxFileSizeValidator and FileTypeValidator are used.
Without using exceptionFactory, simple strings can now be used in FileTypeValidator to provide messages for Bad Request responses.
In addition, the existing
messageoption has been deprecated in favor of a newerrorMessageoption for clearer semantics and consistency across validators.The deprecated
messageoption is still supported for backward compatibility,but
errorMessageis now the preferred way to provide custom error messages.Does this PR introduce a breaking change?
Other information