-
Notifications
You must be signed in to change notification settings - Fork 117
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
Converter for interface type is ignored #931
Comments
This seems like a legitimate bug to me. I should have added a check to see if there was a converter for the given type before assuming it was a group. |
Correct. Unfortunately, it is not that easy because the mapping introspection and generation (which assumes that the interface is a group), is independent of SmallRyeConfig (no access to the current runtime discovered / registered Converters), to determine if the interface is a group or if there is a converter registered for it. Adding a I'm unsure if we should expose the runtime converters to the mapping generation. For instance, in Quarkus, all mappings are generated at build time. If the generation is dependent of the runtime configuration, that would mean that we cannot generate the mappings anymore (at least for runtime config). While unlikely, a converter could be registered for runtime config and it could shade an element of the mapping (a group in static config and a converted element in runtime config). I can't think of a good way to properly choose between a group or a converter (without access to the runtime list, or metadata). Another related issue is the config processor to generate the docs. At first glance, I believe there is no way for us to reliably find which converters are going to be available at each phase, but I need to put more thought in this. Any thoughts @dmlloyd? |
I think you are right: unless you know ahead of time which interfaces have a converter, you would need the explicit annotation. Hypothetically you could replicate the discovery process of SmallRye Config, if we have defined it rigidly enough. For I guess an explicit annotation for this case is needed. Maybe though we want to make the |
Yes, I thought about this, but we also allow access to the config builder, meaning that Converter could be registered programmatically. Converter's discovery would always be very unreliable.
Sounds reasonable. |
I have library interface and two implementations which are useful for configuring my application e.g.:
I want to use
Interface
type as config property, e.g.:However, I am getting an error:
Looks like smallrye-config doesn't check if there is a registered converter for an interface and always consider interfaces as nested config mapping.
If I use a particular implementation of interfaces in config and converter, it's working:
Documentation of microprofile-config doesn't mention that it's prohibited to use converters for interfaces and probably this functionality can be implemented.
The text was updated successfully, but these errors were encountered: