-
Hi all (mainly @radcortez I guess)! Is there any way to map a config structure like: provider:
providerA:
connector:
client-endpoint-url: http://providerA
client-cert:
key-alias: providerA
key-password: ****
schedule:
foo: "bar"
providerB:
connector:
client-endpoint-url: http://providerB
client-cert:
key-alias: providerB
key-password: ****
schedule:
foo: "baz" to a @ConfigMapping(prefix = "provider")
public interface ProviderConfig {
Map<String, ConnectorConfig> connector();
interface ConnectorConfig {
KeystoreKeyReferenceProperties clientCert();
}
} but without switching off any global validation? The first naive approach resulted in:
I don't want to map the schedules because those are referenced separately via Please note that the list of "providers" should be as dynamic as possible, hence the Could I alternatively get Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Btw, I just realized that there is a mistake in my mapping (which I only realized after setting The correct mapping is: @ConfigMapping(prefix = "provider")
public interface ProvidersConfig {
@WithParentName
Map<String, ProviderConfig> providers();
interface ProviderConfig {
ConnectorConfig connector();
}
interface ConnectorConfig {
KeystoreKeyReferenceProperties clientCert();
}
} |
Beta Was this translation helpful? Give feedback.
-
If resorting to |
Beta Was this translation helpful? Give feedback.
-
At this time, there is no way to provide partial mappings. The mappings start from a provided namespace (or subnamespace - the prefix) and expect all properties found to be mapped or a validation exception occurs (you can disable it like you are doing with There is also no way at the moment to retrieve subtrees of the mapping. Is it a big issue to map |
Beta Was this translation helpful? Give feedback.
At this time, there is no way to provide partial mappings. The mappings start from a provided namespace (or subnamespace - the prefix) and expect all properties found to be mapped or a validation exception occurs (you can disable it like you are doing with
smallrye.config.mapping.validate-unknown
).There is also no way at the moment to retrieve subtrees of the mapping.
Is it a big issue to map
schedule
even if is not going to be used? The added benefit is that it will validate that the config is there, except if it is optional, and in that case you can useOptional
.