Configuration properties of type duration should include the unit when rendering the default value
See original GitHub issueDescription
Configuration properties such as acquisition-timeout
on io.quarkus.agroal.runtime.DataSourceJdbcRuntimeConfig
are declared with a default value of “5”.
@ConfigItem(defaultValue = "5")
public Optional<Duration> acquisitionTimeout = Optional.of(Duration.ofSeconds(5));
This gets rendered on documentation as type “Duration” and default value “5” but the docs don’t clarify that this is to be interpreted as seconds:
Implementation ideas Should be possible to patch the configuration documentation generation to explicitly document as seconds, when there’s a default and it’s numeric only.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Spring boot 2 Converting Duration java 8 application.properties
Any property which is of type duration can be injected via .properties or .yml files. All you need to do is use a...
Read more >Core Features - Spring
This section dives into the details of Spring Boot. Here you can learn about the key features that you may want to use...
Read more >Worker Configuration Properties | Confluent Documentation
Type : int; Default: 32768; Importance: medium. request.timeout.ms. The configuration controls the maximum amount of time the client will wait for the ...
Read more >Configuration - Spark 3.3.1 Documentation - Apache Spark
Viewing Spark Properties conf , SparkConf , or the command line will appear. For all other configuration properties, you can assume the default...
Read more >Set parameter default value - Palantir
Default values for action type parameters are used to prefill parameters in the action form. Default values are configured at the parameter level...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We have the same issue with the documentation for our own Quarkus extensions, so I looked into this one. I hope you hadn’t already put work into this, @viveksahu26.
Context
Quarkus is able to automatically generate configuration values from code source by doing annotation scanning. The generated docs are then further processed to ouput a html file which we display in our website. For example this page https://quarkus.io/guides/all-config contains the varous configuration values for extensions in the Quarkus repo.
Issue
The issue here is that, when a configuration know is of type
Duration
, it can have several forms one of it being just a number in which case, we’ll consider the units to be seconds. E.g https://github.com/quarkusio/quarkus/blob/master/extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/DataSourceJdbcRuntimeConfig.java#L51.The underlying default value will be
Duration.ofSeconds(5)
but the generated html will https://quarkus.io/guides/all-config#quarkus-agroal_quarkus.datasource.jdbc.acquisition-timeout will miss this information because it says thedefault value is 5
thus missing the unit. What’s desirable here is to check if the type isDuration
and default value is a number, in which case we should add the unit to the final displayed value.