You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just added NullAway 0.10.10 to the build process of a collection of microservices that use Spring Boot and Feign to communicate. The interfaces that the microservices use are annotated to indicate whether the function parameters are put in the URL path , as query parameters, or as a request body. Most query parameters are optional and should be treated as nullable if they have the required = false argument to the @RequestParam annotation. Unfortunately, required = true is the default and there are many other arguments that the annotation takes.
In my case, it seems like treating the @RequestParam annotation as equivalent to @Nullable makes some sense because we use required = false 99% of the time, but I can imagine other times where the extra accuracy would be helpful.
The text was updated successfully, but these errors were encountered:
Hi there, if I understand correctly, you would like to treat @RequestParam(required = false) as equivalent to @Nullable? We do have support for custom nullability annotations but that just matches on name, not on the parameters passed. So I'm not too sure we have an out-of-the-box solution that will work for your use case. If you use required = false 99% of the time, maybe it would be best to @RequestParam as equivalent to @Nullable using the aformentioned option, and then deal with the remaining false positives using an initialization suppression?
Thanks. I'm requesting the feature that allows for matching on parameters. I have used the custom nullability annotations that you mentioned, which is probably good enough for my personal use case but I can imagine it not being sufficient for others. I definitely understand that matching on parameters will be difficult and this is very low priority for me personally. This issue exists mostly to document that the need may be out there.
Thanks! Matching on parameters may not be difficult but it would have to be done with care to ensure no negative impact on NullAway performance when it is not required. If someone really needs this we are open to discussion / evaluating a PR.
I just added NullAway 0.10.10 to the build process of a collection of microservices that use Spring Boot and Feign to communicate. The interfaces that the microservices use are annotated to indicate whether the function parameters are put in the URL path , as query parameters, or as a request body. Most query parameters are optional and should be treated as nullable if they have the
required = false
argument to the@RequestParam
annotation. Unfortunately,required = true
is the default and there are many other arguments that the annotation takes.In my case, it seems like treating the
@RequestParam
annotation as equivalent to@Nullable
makes some sense because we userequired = false
99% of the time, but I can imagine other times where the extra accuracy would be helpful.The text was updated successfully, but these errors were encountered: