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

3.10.1: ConfigMapping w/ Map: does not map to any root #40727

Closed
bitsofinfo opened this issue May 20, 2024 · 10 comments
Closed

3.10.1: ConfigMapping w/ Map: does not map to any root #40727

bitsofinfo opened this issue May 20, 2024 · 10 comments
Labels
area/config area/kotlin kind/bug Something isn't working triage/needs-reproducer We are waiting for a reproducer.

Comments

@bitsofinfo
Copy link

Describe the bug

Quarkus 3.10.1

application.yaml

my-service:
  senders:
    test:
      prop1: 123
      prop2: 456
      prop3: 150 

SendersConfig.java

@ConfigMapping(prefix="my-service.senders")
public interface SendersConfig {
    @WithParentName
    Map<String, SenderConfig> sendersMap();
}

SenderConfig.java

public interface SenderConfig {
    int prop1();
    int prop2();
    int prop3();
}

Quarkus startup error:

Caused by: io.smallrye.config.ConfigValidationException: Configuration validation failed:
	SRCFG00050: my-service.test.prop1 in YamlConfigSource[source=file:/my-service/build/resources/main/application.yml] does not map to any root
	SRCFG00050: my-service.test.prop2 in YamlConfigSource[source=file:/my-service/build/resources/main/application.yml] does not map to any root
	SRCFG00050: my-service.test.prop3 in YamlConfigSource[source=file:/my-service/build/resources/main/application.yml] does not map to any root

Expected behavior

My config loads and maps to SendersConfig properly

Actual behavior

see error above

How to Reproduce?

see above

Output of uname -a or ver

Darwin Kernel Version 23.4.0: Wed Feb 21 21:44:54 PST 2024; root:xnu-10063.101.15~2/RELEASE_ARM64_T6031 arm64

Output of java -version

openjdk 21.0.1 2023-10-17 LTS

Quarkus version or git rev

3.10.1

Build tool (ie. output of mvnw --version or gradlew --version)

------------------------------------------------------------ Gradle 8.7 ------------------------------------------------------------ Build time: 2024-03-22 15:52:46 UTC Revision: 650af14d7653aa949fce5e886e685efc9cf97c10 Kotlin: 1.9.22 Groovy: 3.0.17 Ant: Apache Ant(TM) version 1.10.13 compiled on January 4 2023 JVM: 21.0.1 (Amazon.com Inc. 21.0.1+12-LTS) OS: Mac OS X 14.4 aarch64

Additional information

n/a

@bitsofinfo bitsofinfo added the kind/bug Something isn't working label May 20, 2024
@quarkus-bot
Copy link

quarkus-bot bot commented May 20, 2024

/cc @geoand (kotlin), @radcortez (config)

@gsmet
Copy link
Member

gsmet commented May 21, 2024

@radcortez can you have a look at this one? We probably need to fix it for 3.10.2 if it's a regression.

@radcortez
Copy link
Member

I'll have a look. I am not totally convinced that it is a regression.

@radcortez
Copy link
Member

@bitsofinfo
Copy link
Author

interesting, thanks for the try. I have zero clue then. Hmm, the only other difference I can think of is my application.yaml has a quarkus: block that is a sibling to my-service:

@radcortez
Copy link
Member

Are you able to provide the full application.yaml file? Maybe something in the file is interfering.

@bitsofinfo
Copy link
Author

here it is, the item in question is @ sam-tester-service.senders

sam-tester-service:
  appVersion: ${ABC_APP_VERSION:"unknown"}
  appEnvironment: ${ABC_APP_ENVIRONMENT:"unknown"}
  appContext: ${ABC_APP_CONTEXT:"unknown"}

  api:
    client:
      subscriptionKey: ${ABC_SAM_TESTER_API_SUBSCRIPTION_KEY}

  newOrdersCollector:
    trigger:
      enabled: ${ABC_NEW_ORDERS_COLLECTOR_ENABLED:true}
      everyExpression: ${ABC_NEW_ORDERS_COLLECTOR_SCHEDULE_EVERY_N_SECONDS:60s} 

  senders:
    orange:
      tCompanyId: 123 
      zCompanyId: 456 
      fanStatusCode: 150 

quarkus:

  application:
    name: me-sam-tester-service
  banner:
      enabled: false

  container-image:
    group: me
    name: sam-tester-service

  rest-client:
    logging:
      body-limit: 1000
      scope: request-response

    sam-tester-service:
      connect-timeout: 5
      read-timeout: 30
      api:
        url: ${ABC_SAM_TESTER_API_BASE_URL:https://stage.antenna2.io}

  datasource:
    db-kind: postgresql
    jdbc:
      telemetry: true

  liquibase:
    enabled: true
    change-log: db/SAMTESTER/changelog.yml
    migrate-at-start: true

  jib:
    base-jvm-image: public.ecr.aws/amazoncorretto/amazoncorretto:21-al2023
    jvm-arguments:
      - -Dcom.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.objectStoreType=com.arjuna.ats.internal.arjuna.objectstore.TwoPhaseVolatileStore
    platforms: linux/arm64/v8
    ports: 8080
    user: nobody

  hibernate-orm:
    packages:
      - com.me.SAMTESTER.client.audit.db
    physical-naming-strategy: org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy
    database:
      generation: none
    log:
        sql: ${ABC_HIBERNATE_LOG_SQL:false}
    second-level-caching-enabled: false

  log:
    category:
      org.jboss.resteasy.reactive.client.logging:
        level: ${ABC_LOG_LEVEL_RESTEASY_CLIENT:DEBUG}
      com.me:
        level: ${ABC_LOG_LEVEL_me:DEBUG}
    level: ${ABC_LOG_LEVEL_DEFAULT:INFO}
    console:
      json: true

  smallrye-openapi:
    path: /doc/openapi
    security-scheme: oauth2
    security-scheme-name: oauth2

  swagger-ui:
    path: /doc/swagger
    always-include: true
    oauth-scopes: SAMTESTER:webhook SAMTESTER:audit
    theme: original
    title: me-sam-tester-service
    urls-primary-name: me-sam-tester-service

  oidc:
    application-type: service
    roles:
      role-claim-path: scope

  otel:
    exporter:
      otlp:
        traces:
          endpoint: ${ABC_OPEN_TELEMETRY_URL:http://localhost:4317}
    propagators: tracecontext,baggage,xray
    traces:
      exporter: cdi


  transaction-manager:
    default-transaction-timeout: ${ABC_TRANSACTION_TIMEOUT_SECONDS:60}

@radcortez
Copy link
Member

Can you also share your full mapping class? Maybe a single member doesn't cause the issue, but having all members declared is causing it. Thanks!

@radcortez
Copy link
Member

The mapping class for that YAML should be the following:

@ConfigMapping(prefix = "sam-tester-service", namingStrategy = ConfigMapping.NamingStrategy.VERBATIM)
public interface SamTesterService {
    String appVersion();

    String appEnvironment();

    String appContext();

    Api api();

    OrdersCollector newOrdersCollector();

    Senders senders();

    interface Api {
        Client client();

        interface Client {
            String subscriptionKey();
        }
    }

    interface OrdersCollector {
        Trigger trigger();

        interface Trigger {
            boolean enabled();

            String everyExpression();
        }
    }

    interface Senders {
        Orange orange();

        interface Orange {
            Integer tCompanyId();

            Integer zCompanyId();

            Integer fanStatusCode();
        }
    }
}

It works for me. Can you send me your version?

@radcortez radcortez added the triage/needs-reproducer We are waiting for a reproducer. label Jun 7, 2024
@geoand
Copy link
Contributor

geoand commented Jun 27, 2024

Closing for the lack of feedback

@geoand geoand closed this as not planned Won't fix, can't repro, duplicate, stale Jun 27, 2024
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/config area/kotlin kind/bug Something isn't working triage/needs-reproducer We are waiting for a reproducer.
Projects
None yet
Development

No branches or pull requests

4 participants