-
Notifications
You must be signed in to change notification settings - Fork 122
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
Bug: SmallRyeConfig#getValues: mapFactory is not used #1096
Comments
I agree that this is inconsistent. We should have a variation of As an aside, this way of doing map conversion is pretty weird: it first tries to convert a single key to a map and then tries to read multiple keys as a map. I don't like the double-duty because the user will already know what they want, and I doubt very much that the thing that they want for any given property is both behaviors. |
Before we added support to We ended up proving double-duty methods because when we are creating the |
I like inline collections and Maps. But my bug report is not about it, but about the created Map class. The first sentence in @dmlloyd comment is an exact match. |
I don't think there is any reason to get rid of inline maps, and definitely no reason to get rid of inline collections. But I don't think it makes a lot of sense to try one and fall back to the other. |
The intention was to make it convenient so you are only required to call one method regardless of the flavor you use to configure such properties. We could split the API methods, but we still need a way to know which one to use. Either we try one and fall back to the other one, or we need to make it a configuration to tell which format to use. Or do you have another idea? |
If you are referring to config mappings, as they exist today, then making it configurable is probably the choice which is most consistent with the original design philosophy of this project. In an ideal world, this would be config source dependent since some have a native representation for lists, and some do not. Being real, we're really just talking about properties and env vars, since they are the only formats without this support. If this were a green-field project, it would make the most sense for a config source to indicate the kind of value that exists at a node in the graph, and to develop a syntax for properties-style configuration that isn't dependent on the converter in use (it'd probably be a language that is similar to, but not exactly the same as, the properties file specification in order to support extended syntax). The syntax for system property overrides would probably be different since it is a different use case, and would be more optimized for command-line usage (this is because using the same logic for property files and system properties can be viewed as an implementation detail that leaked up to the specification). Note however that every step we take away from our ideal world digs us deeper into a hole from which we may never escape. |
Vert.x Config is an interesting step in this direction (and they have a lot of extensions to read configuration from everywhere). BTW, the main goal of this bug report is to fix the type of the Map: use factory |
io.smallrye.config.SmallRyeConfig#getValues(java.lang.String, org.eclipse.microprofile.config.spi.Converter<K>, org.eclipse.microprofile.config.spi.Converter<V>, java.util.function.IntFunction<java.util.Map<K,V>>)
The text was updated successfully, but these errors were encountered: