-
Notifications
You must be signed in to change notification settings - Fork 116
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
Clarification of ConfigSource.getProperties and getPropertyNames #333
Comments
+1 for updating the docs. Removal could break backwards compatibility however I would also be in favour of removal. |
The javadoc should say that both methods reflect the current state and results may change during runtime. |
@Emily-Jiang explained that there's a usecase to find out whether a value exists in a config source or not and the only way to find out now is to call getPropertyNames(). The usecase is motly valid when checking that a config value is present at deploy time. It can even be a default method like this to avoid breaking existing config sources:
However, I would remove both To avoid breaking existing code, we can make them deprecated and return empty set/map by default, so that config sources don't have to implement them. |
I ran into a related problem with smallrye/smallrye-config#70 - essentially, custom |
For the record and posterity: please do not remove |
related #431 |
Signed-off-by: Emily Jiang <emijiang6@googlemail.com>
Signed-off-by: Emily Jiang <emijiang6@googlemail.com>
#333 javadoc clarification on ConfigSource
Not so long ago there was an issue opened in the javaee-samples repo because the Liberty config impl did not work as expected with an "EchoConfigSource".
javaee-samples/microprofile1.2-samples#3
https://github.com/javaee-samples/microprofile1.2-samples/blob/master/config/config-source/src/main/java/org/eclipse/microprofile12/config/configsource/EchoConfigSource.java
The EchoConfigSource has been implemented to simply echo back anything that is requested via
ConfigSource.getValue
. That means that the returns fromgetProperties
andgetPropertyNames
are incomplete compared with whatgetValue
will respond to.If
ConfigSource.getPropertyNames
is not guaranteed to return a complete set thenConfig.getPropertyNames
can not be guaranteed to be complete either. Without that guarantee then the method isn't of much use beyond perhaps some non-critical tracing.Either the javadoc for both
ConfigSource
andConfig
should be updated to make if clear what can be relied upon and what can not... or the methods should just be removed?!The text was updated successfully, but these errors were encountered: