Skip to content
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

Config - HOCON mapped Map has keys detached with extra parent key #8732

Open
danielkec opened this issue May 7, 2024 · 0 comments
Open

Config - HOCON mapped Map has keys detached with extra parent key #8732

danielkec opened this issue May 7, 2024 · 0 comments
Assignees
Labels
4.x Version 4.x bug Something isn't working config P2
Projects

Comments

@danielkec
Copy link
Contributor

danielkec commented May 7, 2024

Environment Details

  • Helidon Version: 2,3,4
  • Helidon SE

Problem Description

When mapping HOCON to object with Map field, map keys contains extra parent field name.

Steps to reproduce

@Data
public static class MetricsProducerConfig {
    private int sendTimeoutMillis;
    private Map<String, Object> properties;
}
...
var hocon =
          """
            sendTimeoutMillis: 4000
            properties: {
              "retries": 1
              "request.timeout.ms": 10000
              "delivery.timeout.ms": 30000
              "buffer.memory": 335544320
              "max.block.ms": 500
              "max.request.size": 10485760
            }
            """;
Config config = Config.builder(ConfigSources.create(hocon, MediaTypes.create("application/hocon")))
        .disableEnvironmentVariablesSource()
        .disableSystemPropertiesSource()
        .build();
MetricsProducerConfig mCfg = config
        .as(MetricsProducerConfig.class)
        .get();
System.out.println(String.join("\n", mCfg.getProperties().keySet()));

Yields:

properties.delivery.timeout.ms
properties.max.block.ms
properties.retries
properties.max.request.size
properties.request.timeout.ms
properties.buffer.memory
@github-actions github-actions bot added this to Triage in Backlog May 7, 2024
@m0mus m0mus added bug Something isn't working config P2 4.x Version 4.x labels May 23, 2024
@m0mus m0mus moved this from Triage to High priority in Backlog May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x Version 4.x bug Something isn't working config P2
Projects
Backlog
  
High priority
Development

No branches or pull requests

2 participants