-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Allow specifying optional config section with YAML configuration #14847
Comments
@geoand thanks for looking into this issue, any chance this gets fixed in 1.11.x? if I use JSON, would that work? |
Most likely yes, but I can't make any guarantee on which micro it will be in. |
I took a look at this and actually I am not sure I want to go through with it. The reason is because the semantics of having the config section be Optional are a little hazy. |
@geoand Take a look at this example:
I would expect this:
What else is a developer to do without optional sections? How would you deal with the case where you want to make MSSQL section optional, so you can have ORACLE and PostGress as alternatives ? |
I explained why I think it's confusing, I don't think there is much point in reiterating it. You mention the default value for the subsections, but what would happen if there is no default value? The best I can do is give it some thought and get back to you, but I'll be honest, I don't think I'll implement this. |
Another complication is that in MP Config which is used at the lowest level for configuration, there is no support for multi level configuration - as one uses in YAML - so that means that all configuration options are mapped to a flat property structure. |
After taking another look at this, I stand by my initial assement. Once we have a redesign of MP Config based on what I mention above, we can have another look at this |
i tried several hacks this weekend, but nothing worked.. Dumping MPConfig, will have to create my own parser. Feel free to close this issue. |
I won't close it as it's a valid feature request. I will gladly implement it once MP Config has the appropriate architecture in place that will allow me to do so. |
thanks. i appreciate it. |
You bet! |
@hrstoyanov please check this: smallrye/smallrye-config@b6f6fba. Is this what you are looking for? I believe that PR will provide the missing pieces to support YAML mapping properly. Please, provide me your most complicated mapping and I'll add it as a test case :) |
Would check it this weekend! And TOML (I have not forgotten!) ... You guys rock! |
This is now supported with SmallRye Config Moving forward, we may replace or use as a backend implementation the SR @hrstoyanov if you disagree, please reopen. |
Here is some documentation as well: |
Please re-open based on this onversation: |
Reopened due to some additional issues found in the implementation. |
What are the additional implementation issues? |
This is in SR ConfigMapping. We have an issue where when we have defaults set with the annotation at the same level for collection types, the defaults are not being applied properly. |
Understood, thanks |
@hrstoyanov this will be fixed with smallrye/smallrye-config#550. |
Thanks @radcortez , will test as soon as itis available in the maven repo! |
Describe the bug
See here
Expected behavior
Optional configuration sections should be allowed with Quarkus YAML config.
Actual behavior
I know of no way of specifying optional section with YAML config.
To Reproduce
Unpack this project
issue_optional_config.zip
and follow the instruction here
The text was updated successfully, but these errors were encountered: