micronaut validation doesn't seem to working, is it my setup or a bug? #10449
Replies: 1 comment
-
Micronaut doesn't modify the byte code of you classes, if you want validation you have to activate it a method argument in the logic place where the type is validated, for example In a controller method:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
Regex and not-blank annotations fail to... fail?
I've a POJO called 'place' which has two constructors, each with a unique regex pattern validation and
@not-blank
annotation. I've written tests to validate bad input triggers validation exceptions, but it seems any string I pass is accepted in the constructor.I imagine I'm doing something wrong, but I dont know where I've gone wrong. Can anyone shed some light on this for me?
background
ultimately this is to support a new endpoint I'm querying in my Threshr project. the regex mocks the validation from the third party api.
I've run into this same sort of thing when I added a validator for my
tcin
class in this same repo, but instead of pushing to figure out what's wrong I added a home-grown validation in the constructor.Setup
I found this when creating an httpclient but have created a repo dedicated to showing this issue.
quick setup
● gh cli
● plain ol' git
in
src/main/java/com/jonathan_zollinger/Place.java
:its spock tests supply invalid args one way or another but dont trigger any errors. I've ran the tests in gh-actions to share the error messages, but they're all very similar to the one below
Beta Was this translation helpful? Give feedback.
All reactions