-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Wrong generated metadata for properties with successive capital letters #5330
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
Comments
I don't think the title is accurate. The meta-data is correct (our canonical representation is lower case hyphen, we're not going to go upper case just because the key has several upper case letters in a row). |
We've come to realise that the relaxed binding is too relaxed. We plan to fix that in 2.0 (see #4910). With one eye on that goal, we should not change the relaxed binding so that Part of #4910 will be to formalise the rules for relaxed binding so that they're easy to describe and implement. One such rule will probably be that letters preceded by a separator are capitalised and the separator is removed. Given our supported separators, I think that we should address this issue by changing the metadata that's generated. The convention for the metadata is kebab-case so it should be |
I believe I tested it with |
I still believe that the title is correct, in the sense that given a property named |
Happy to change the property name to work around this, but that doesn't change the fact that the currently generated metadata is incorrect. |
@mbogoevici Stephane's already changed the title to accurately describe the problem with the metadata |
@garyrussell Thanks, you're right. When I checked, I did this: for (String name: new RelaxedNames("auto-bind-d-l-q")) {
System.out.println(name);
} It produces In short, this is another example of why we want to simplify this and harden up the rules. Hopefully we can fix the binding too in 1.3.4 without breaking anything else. |
I wouldn't want to see a suggestion with |
Me neither, but thought of raising an issue around the original problem we encountered. Thanks for the turnaround. |
Doesn't feel to me like this one was resolved. We dodged it by changing the property name in Spring Cloud Stream, but that can't last for ever (as evidenced by the eureka configuration issue). |
@dsyer The issue's still open. Aesthetics aside, I think the metadata needs to change: @snicoll tells me that fixing the metadata is trivial. I need to spend some more time looking at the other half of the problem to be more certain that we can fix it without breaking something else. In other words, there's a chance that we'll need to wait till 2.0 to really fix this. |
We need to devise some simple (to implement and to explain) rules for the binding. The simplest rule that I can think of is that any upper-case letter is prefixed with a separator and converted to lower-case. This works well for camel-cased properties, but is a little ugly when there are successive upper-case letters:
A slightly more complex rule would be that any upper-case letter is prefixed with a separator unless the following letter is also upper-case, all upper-case letters are converted to lower-case:
|
My vote is option 2 |
Either I was wrong above or another change has improved this. As far as I can tell, I believe that all that remains to be done (before we tackle #4910) is to fix the metadata: a property named @snicoll Over to you, I think. |
Related to spring-cloud/spring-cloud-stream#396
This could be either an issue for relaxed binding or metadata generation.
Given a property such as:
spring.cloud.stream.binder.rabbit.default.autoBindDLQ
the generated metadata will be:However,
spring.cloud.stream.binder.rabbit.default.auto-bind-dlq
does not map back tospring.cloud.stream.binder.rabbit.default.autoBindDLQ
(it maps tospring.cloud.stream.binder.rabbit.default.autoBindDlq
instead).The text was updated successfully, but these errors were encountered: