-
Notifications
You must be signed in to change notification settings - Fork 13
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
test using dev service with named configuration fails with application.yaml #735
Comments
@vsevel Thanks for the reporting! For a quick look, I think it might be an issue with Quarkus since the properties file is working. |
@zhfeng do you tackle this issue/forward it to https://github.com/quarkusio/quarkus? |
what do you think @radcortez ? |
Has this worked before? Or is it new? I can have a look. |
no idea |
@radcortez I did a quick test. It did not work with |
should this be transferred to quarkus? |
@radcortez ☝ ? |
Sorry, I had a look yesterday, and before adding something here, I had to focus on higher-priority stuff. The issue here is that the Dev Service configuration is being generated as Even if the quotes are present in the YAML file, they are removed by the parser, meaning that we have no idea if a segment should be quoted or not, and by default, single segments are left unquoted. When we populate a I'm not sure if there is something I can do from the Config side. The I believe the best option is to adjust BTW, if the name is a multi-segment path, like |
thanks for this analysis @radcortez . seems more complex than at first sight ;-)
should there be a syntax, which would not be removed by the parser, that would allow to handle this use case without ambiguity?
so that would be a change in the extension itself? |
Yes, you can use single quotes and then double quotes as
Yes, ideally, the extension should check the configuration name flavour and generate the properties with the same flavour. While it is possible to use the One recommendation is that when dynamic keys are known at build time, we can use |
I confirm this is working:
so not obvious. it sounds the |
It can surely be added there. On the other hand, I think users shouldn't have to worry about it. Most users are probably not going to look into that detail and are just going to set the configuration as you did :) Also, this will only work for the YAML source. Other sources may also provide the key without quotes, which would cause the same issue. I was thinking again if this could be fixed on the SmallRye Config side, but I don't see a good solution... the only way would be to query both the quoted and unquoted key. Considering that many of these mappings start with a
Because it is the extension that is adding additional keys, I believe the best option is the extension to adjust and to generate the key in the same format that the user has provided the other keys. This would not only solve the issue for the YAML source but for any other source. |
will you plan this improvement @zhfeng ? |
But when I am running with properties or yaml file, by both of them we alway get the same |
Hmm, I find a solution like for (ConfigSource source : ConfigProvider.getConfig().getConfigSources()) {
if (source.getName().contains("YamlConfigSource")) {
useQuote = false;
}
} @radcortez @vsevel WDYT? |
but you could use quotes, or not in yaml. this would force the user to use quotes, always. |
Hmm, I test it both with quotes or not in yaml, both of them work. But it does not work with properties file like |
No, it seems we can not detect if quotes is used or not in |
You would need to look for the raw property names in Another option is to just use |
Thanks @radcortez - I'm much clearer now. Let's try the first option to get raw property names. |
When running tests with devservice using a named configuration in an
application.yaml
, the url fails to be set.When instead using an
application.properties
it succeeds.Here is a reproducer: https://github.com/vsevel/reproducer_artemis_dev_service_config_yaml
cc @zhfeng
The text was updated successfully, but these errors were encountered: