Skip to content

Generate configuration parameters overview - #5932

Merged
mpkorstanje merged 112 commits into
mainfrom
feature/generate-configuration-parameters-overview
Sep 17, 2026
Merged

mpkorstanje merged 112 commits into
mainfrom
feature/generate-configuration-parameters-overview

Conversation

@mpkorstanje

@mpkorstanje mpkorstanje commented Jul 30, 2026

Copy link
Copy Markdown
Member

Generate META-INF/junit-platform-configuration-metadata.json in the format of Spring Boots Configuration Metadata.

Minimal example

The minimal usage:

/**
 * A brief multi-line description of
 * this property: {@value}.
 *
 * <p>Followed by an additional paragraph.
 */
@ConfigurationParameter
public static final String EXAMPLE_PROPERTY_NAME = "org.example.property";

Produces:

{
  "properties": [
	{
	  "name": "org.example.property",
      "description": "A brief multi-line description of this property.",
	  "sourceType": "com.example.app.Constants"
	}
  ]
}

This takes all the information from the obvious places. Of note is that the first paragraph from the doc string is used and the : {@value}. that we conventionally use is replaced with a ..

Deprecation

@Deprecated
@ConfigurationParameter
public static final String EXAMPLE_PROPERTY_NAME = "org.example.property";

Produces:

{
  "properties": [
	{
	  "name": "org.example.property",
      "description": "A brief multi-line description of this property.",
	  "sourceType": "com.example.app.Constants",
      "deprecated": { }
	}
  ]
}

The empty deprecated object is sufficient to mark a field as deprecated. To fill out the fields in the deprecated object the @Deprecation annotation can be used:

@Deprecated
@ConfigurationParameter(deprecation = @Deprecation(reason = "A an example reason", replacement = "com.example.app.Constants#EXAMPLE_PROPERTY_NAME_V2", since = "2.0.0"))
public static final String EXAMPLE_PROPERTY_NAME_V1 = "org.example.property";

Type and default

The type of the parameter can be provided using the type property of the annotation.

@ConfigurationParameter(type = String.class)
public static final String EXAMPLE_PROPERTY_NAME = "org.example.property";

Though in practice this will be rarely needed. If the type is not provided, we can take the type of the default value.

@ConfigurationParameter(defaultValue = @Value(stringValue = "default"))
public static final String EXAMPLE_PROPERTY_NAME = "org.example.property";

When using Enums it is useful to use both type and default value, because arbitrary enums can't be used in an annotation.

@ConfigurationParameter(defaultValue = @Value(intValue = 42))
public static final String INTS_PROPERTY_NAME = "org.example.ints";

Limitations

  • Metadata.groups, Metadata.hints, Metadata.ignored are not yet implemented. See: Add configuration parameter hints #6059
  • While Property.default supports lists of values, the implementation is intentionally limited to a single value.

Closes: #4330


I hereby agree to the terms of the JUnit Contributor License Agreement.


Definition of Done

@mpkorstanje
mpkorstanje force-pushed the feature/generate-configuration-parameters-overview branch from c73e0df to 14ffed5 Compare July 30, 2026 21:38
@mpkorstanje
mpkorstanje force-pushed the feature/generate-configuration-parameters-overview branch from f02ff2f to 3295a99 Compare July 30, 2026 22:58
Comment thread junit-platform-configuration-api/junit-platform-configuration-api.gradle.kts Outdated
Comment thread junit-jupiter-api/junit-jupiter-api.gradle.kts
Comment thread junit-jupiter-migrationsupport/junit-jupiter-migrationsupport.gradle.kts Outdated
@mpkorstanje
mpkorstanje force-pushed the feature/generate-configuration-parameters-overview branch 2 times, most recently from 6c063a1 to e6ab635 Compare July 31, 2026 08:52
@mpkorstanje
mpkorstanje force-pushed the feature/generate-configuration-parameters-overview branch from e6ab635 to 314e8fd Compare July 31, 2026 09:57
Comment thread documentation/modules/ROOT/nav.adoc Outdated
Comment thread junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/Execution.java Outdated
Comment thread junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/Execution.java Outdated
Comment thread junit-jupiter-api/src/main/java/org/junit/jupiter/api/Timeout.java Outdated
@testlens-app

This comment has been minimized.

@marcphilipp

Copy link
Copy Markdown
Member

Excellent work! 👍

@mpkorstanje
mpkorstanje merged commit f8b3293 into main Sep 17, 2026
16 checks passed
@mpkorstanje
mpkorstanje deleted the feature/generate-configuration-parameters-overview branch September 17, 2026 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configuration Parameters Overview

2 participants