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

Freeform Map<String,String> configuration properties always marked as required #42505

Closed
ppalaga opened this issue Aug 13, 2024 · 3 comments · Fixed by #42513
Closed

Freeform Map<String,String> configuration properties always marked as required #42505

ppalaga opened this issue Aug 13, 2024 · 3 comments · Fixed by #42513
Assignees
Labels
area/config kind/bug Something isn't working
Milestone

Comments

@ppalaga
Copy link
Contributor

ppalaga commented Aug 13, 2024

Describe the bug

We have a config property in Quarkus CXF defined as follows:

        @WssConfigurationConstant(key = "security.signature.properties", transformer = properties)
        @WithName("signature.properties")
        Map<String, String> signatureProperties();

Before the recent refactoring of quarkus-extension-processor, the metadata was produced with "optional": true in target/asciidoc/generated/config/all-configuration-roots-generated-doc/io.quarkiverse.cxf.ws.security.CxfWsSecurityConfig:

  {
    "configDocKey": {
      "type": "`Map<String,String>`",
      "key": "quarkus.cxf.client.\"client-name\".security.signature.properties",
      "additionalKeys": [],
      "configDoc": "The Crypto property configuration to use for signing, if `signature.crypto` is not set.\n\nExample\n\n[source,properties]\n----\n[prefix].signature.properties.\"org.apache.ws.security.crypto.provider\" =\norg.apache.ws.security.components.crypto.Merlin\n[prefix].signature.properties.\"org.apache.ws.security.crypto.merlin.keystore.password\" = password\n[prefix].signature.properties.\"org.apache.ws.security.crypto.merlin.file\" = certs/alice.jks\n----",
      "withinAMap": true,
      "defaultValue": "",
      "javaDocSiteLink": "",
      "docMapKey": "signature-properties",
      "configPhase": "RUN_TIME",
      "acceptedValues": null,
      "optional": true,
      "list": false,
      "passThroughMap": true,
      "withinAConfigGroup": true,
      "topLevelGrouping": "quarkus.cxf",
      "since": "2.5.0",
      "environmentVariable": "QUARKUS_CXF_CLIENT__CLIENT_NAME__SECURITY_SIGNATURE_PROPERTIES",
      "enum": false
    }
  },

After the refactoring, the target/quarkus-config-doc/quarkus-config-model.yaml file is produced without "optional": true:

  - !<io.quarkus.annotation.processor.documentation.config.model.ConfigProperty>
    sourceClass: "io.quarkiverse.cxf.ws.security.CxfWsSecurityConfig.ClientOrEndpointSecurityConfig"
    sourceName: "signatureProperties"
    path: "quarkus.cxf.client.\"client-name\".security.signature.properties.\"signature-properties\""
    type: "java.util.Map<java.lang.String,java.lang.String>"
    phase: "RUN_TIME"
    environmentVariable: "QUARKUS_CXF_CLIENT__CLIENT_NAME__SECURITY_SIGNATURE_PROPERTIES__SIGNATURE_PROPERTIES_"
    typeDescription: "Map<String,String>"
    map: true
    mapKey: "signature-properties"
    withinMap: true

Expected behavior

Freeform Map<String,String> configuration properties should be always considered optional - same like before the refactoring. Therefore "optional": true should be present in the metadata.

Actual behavior

"optional": true is missing in the metadata.

How to Reproduce?

Rebuild quarkus-agroal in Quarkus source tree and check quarkus.datasource.jdbc.additional-jdbc-properties in its target/quarkus-config-doc/quarkus-config-model.yaml.

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

No response

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

No response

Additional information

No response

@ppalaga ppalaga added the kind/bug Something isn't working label Aug 13, 2024
Copy link

quarkus-bot bot commented Aug 13, 2024

/cc @radcortez (config)

@ppalaga ppalaga self-assigned this Aug 13, 2024
@ppalaga
Copy link
Contributor Author

ppalaga commented Aug 13, 2024

I have an idea how to fix this

@ppalaga
Copy link
Contributor Author

ppalaga commented Aug 13, 2024

The same issue exists for quarkus.kafka.devservices.topic-partitions that is a Map<String,Integer>. Here is the old json:

{
    "configDocKey": {
      "type": "`Map<String,Integer>`",
      "key": ".topic-partitions",
      "additionalKeys": [],
      "configDoc": "The topic-partition pairs to create in the Dev Services Kafka broker. After the broker is started, given topics with partitions are created, skipping already existing topics. For example, `quarkus.kafka.devservices.topic-partitions.test=2` will create a topic named `test` with 2 partitions.\n\nThe topic creation will not try to re-partition existing topics with different number of partitions.",
      "withinAMap": true,
      "defaultValue": "",
      "javaDocSiteLink": "",
      "docMapKey": "topic-partitions",
      "configPhase": "BUILD_TIME",
      "acceptedValues": null,
      "optional": true,
      "list": false,
      "passThroughMap": true,
      "withinAConfigGroup": true,
      "topLevelGrouping": "",
      "since": null,
      "environmentVariable": "_TOPIC_PARTITIONS",
      "enum": false
    }
  },

So I am going to fix this for all maps whose value type is either String or some primitive type wrapper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/config kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant