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

Document that any @Valid* annotation triggers validation in the reference manual #27050

Closed
lanicc opened this issue Jun 11, 2021 · 5 comments
Closed
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: documentation A documentation task
Milestone

Comments

@lanicc
Copy link

lanicc commented Jun 11, 2021

Affects: Spring Framework 4.1.5

AbstractMessageConverterMethodArgumentResolver#validateIfApplicable

I'm trying to custom an annotation whose name is "Valid", but this method makes my custom annotation can not work as I expected.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jun 11, 2021
@beiranc
Copy link

beiranc commented Jun 11, 2021

The annotaion which is name "Valid" was already definated, you can check for javax.validation.Valid.
If you want to create a customize validate annotaion, you can Google "How to customize parameter validate annotaion in spring".

@lanicc
Copy link
Author

lanicc commented Jun 11, 2021

In my opinion, "valid" is just a name. I can use this annotation to validate parameters and do other things. Spring should not use a name to determine its logic. Is there anything special about this name in some rules?

@sbrannen sbrannen changed the title AbstractMessageConverterMethodArgumentResolver#validateIfApplicable do more than expected AbstractMessageConverterMethodArgumentResolver#validateIfApplicable does more than expected Jun 11, 2021
@sbrannen sbrannen added the in: web Issues in web modules (web, webmvc, webflux, websocket) label Jun 11, 2021
@sbrannen
Copy link
Member

Spring should not use a name to determine its logic. Is there anything special about this name in some rules?

Yes, this convention has been in place for a long time. See #17256 (comment) for an explanation of why the convention will remain in place.

In light of the above, I am repurposing this issue to improve the documentation in the reference manual which currently only highlights support for @javax.validation.Valid or Spring's @Validated annotations for triggering validation.

@sbrannen sbrannen added type: documentation A documentation task and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jun 11, 2021
@sbrannen sbrannen changed the title AbstractMessageConverterMethodArgumentResolver#validateIfApplicable does more than expected Document that any @Valid* annotation triggers validation in the reference manual Jun 11, 2021
@sbrannen sbrannen added this to the 5.3.9 milestone Jun 11, 2021
@lanicc
Copy link
Author

lanicc commented Jun 12, 2021

Yes, this convention has been in place for a long time. See #17256 (comment) for an explanation of why the convention will remain in place.

Will you consider removing this later?

@lanicc
Copy link
Author

lanicc commented Jun 17, 2021

Thanks for yoyr answer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: documentation A documentation task
Projects
None yet
Development

No branches or pull requests

4 participants