spring-projects / spring-projects/spring-boot
@ConfigurationProperties - Grab javadoc from setter/getter if no field javadoc exists
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 81.5k
- Forks
- 42.7k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 65
Description
When using @ConfiguraitonProperties on custom configuration classes, then you may have documentation on the fields in the getter or setter methods. The latter is a common practice.
The APT that generates the JSon schema file grabs only the javadoc from the field itself, according to:
https://github.com/spring-projects/spring-boot/blob/master/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java#L262
At the Apache Camel project we also have an APT that generate some Camel stuff. We also grab javadoc as documentation but we look for the javadoc at
- field
- setter
- getter
- fluent builder style
In that order. You can find our APT code at:
https://github.com/apache/camel/blob/master/tooling/apt/src/main/java/org/apache/camel/tools/apt/AbstractAnnotationProcessor.java#L57
If this has interrest to the Spring Boot project, then we could enhance Spring so it can also look for the javadoc coumentation in some or all of the above. By looking for the javadoc in the setter/getter would help many users as a start.
I could also not find any code in spring boot that may sanitize the javadoc to removed invalid content when its being saved into the JSon file. We at Apache Camel has some code than clean the javadoc to make it JSon safe: https://github.com/apache/camel/blob/master/tooling/apt/src/main/java/org/apache/camel/tools/apt/helper/JsonSchemaHelper.java#L208
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/ConfigurationMetadataAnnotationProcessor.java at the referenced metadata-generation code, then compare Apache Camel's AbstractAnnotationProcessor.java lookup order. Done means generated JSON schema documentation falls back to setter or getter Javadoc when field Javadoc is absent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100