-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix usage of @Header(name="..")
#11060
Conversation
@dstepanov Does this bug only with |
Actually I’m not sure that’s a bug, the Javadoc clearly says the name peopert is not supposed to be used inn this case |
That’s why the tests fail |
Sorry I do not understand. In my opinion, name is an auxiliary property, just for convenience and is an alias for value . Those. name is convenient to use to understand that you are specifying the name of a header or variable in the path. When you write value = - it's not so obvious. So I don't understand why I can't write @Header(name = "my header") . Actually, I don’t understand why my values change to some crooked strings |
It’s changed because the logic is to use the parameter name if the value is not specified. Please read the Javadoc, it explicitly says that the name is only used when applied on the class |
What can I say, in my opinion this is an extremely bad solution, because it is very confusing for the user. In the case of PathVariable, these two values have the same meaning, but in the case of Header, it turns out that magic happens and is not obvious at all. By the way, it is not written anywhere that the value in the name field will be distorted |
Well, the decision to put different values in these fields depending on the situation, in my opinion, is very ugly. This annotation is very popular. I can imagine the faces of newcomers to Micronaut when they stumble upon this error, I think they’ll just go back to the good old spring |
I will see what can be done |
Quality Gate passedIssues Measures |
Fixes #11053