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

Fixes #2719: Implement support for @NotBlank #2720

Merged
merged 3 commits into from
Aug 3, 2019

Conversation

shartte
Copy link

@shartte shartte commented Oct 6, 2018

Added initial support for bean validation 2.0 @notblank annotation.
This currently doesn't go beyond the same handling that @NotNull has, but I still split it out into separate plugins because it MIGHT be possible to extend this going forward.
Possible extensions are somehow setting minLength=1 (for strings) / minItems=1 (for collections), but I didn't find an easy way to get this through to the Swagger JSON through Springfox's internal model.
I also copied the unit tests for NotNull and adapted them accordingly.

@shartte
Copy link
Author

shartte commented Oct 6, 2018

I fixed the bots complaint's. Hopefull.

@shartte
Copy link
Author

shartte commented Oct 6, 2018

One thing I've also noticed: Why have all the classes @component annotations when they are then declared in a module explicitly (and never picked up by a ComponentScan apparently)?

@codecov
Copy link

codecov bot commented Oct 6, 2018

Codecov Report

Merging #2720 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2720      +/-   ##
============================================
+ Coverage     94.77%   94.79%   +0.01%     
- Complexity     3161     3179      +18     
============================================
  Files           354      357       +3     
  Lines          8057     8083      +26     
  Branches        608      611       +3     
============================================
+ Hits           7636     7662      +26     
  Misses          271      271              
  Partials        150      150
Impacted Files Coverage Δ Complexity Δ
...ter/ExpandedParameterNotBlankAnnotationPlugin.java 100% <100%> (ø) 5 <5> (?)
...ators/plugins/schema/NotBlankAnnotationPlugin.java 100% <100%> (ø) 5 <5> (?)
...nfiguration/BeanValidatorPluginsConfiguration.java 100% <100%> (ø) 17 <3> (+3) ⬆️
...rs/plugins/parameter/NotBlankAnnotationPlugin.java 100% <100%> (ø) 5 <5> (?)

@springfox springfox deleted a comment Oct 6, 2018
@springfox springfox deleted a comment Oct 6, 2018
@springfox springfox deleted a comment Oct 6, 2018
@springfox springfox deleted a comment from shartte Oct 6, 2018
@dilipkrish dilipkrish added the PR label Nov 8, 2018
@dilipkrish
Copy link
Member

Thank you for your PR! one of many!

One thing I've also noticed: Why have all the classes @component annotations when they are then declared in a module explicitly (and never picked up by a ComponentScan apparently)?

I believe it started out as a component being scanned and it was better to be explicit. Do you have one in particular.

}

/**
* read NotNull annotation

Choose a reason for hiding this comment

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

[nits] NotNull -> NotBlank?

Copy link
Member

Choose a reason for hiding this comment

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

Thank you for catching that! @hokkun-dayo

@dilipkrish dilipkrish added this to the 3.0 milestone Aug 3, 2019
@dilipkrish dilipkrish merged commit a18fa69 into springfox:master Aug 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants