At the moment, the configuration properties annotation processor harvests property descriptions from a class's fields. This doesn't work well with records as they don't have fields. It'd be nice if we could devise some other way of harvesting property descriptions from the record's source. At the moment, you have to use additional metadata instead.

One possibility may be to read the @params from the record-level javadoc:

/**
 * @param someProperty An example property to be described in the metadata.
 */
@ConfigurationProperties(prefix = "record")
public record MyRecordProperties(String someProperty) { }

In this example, we already generate metadata for someProperty:

{
  "name": "record.some-property",
  "type": "java.lang.String",
  "sourceType": "com.example.recordconfigpropstest.MyRecordProperties"
}

What we're aiming for is having a description as well:

{
  "name": "record.some-property",
  "type": "java.lang.String",
  "description": "An example property to be described in the metadata.",
  "sourceType": "com.example.recordconfigpropstest.MyRecordProperties"
}

Comment From: theoathayde

Hi, can i try working on this one?

Comment From: wilkinsona

That'd be great. Thanks for the offer, @theoathayde. Please let us know if you have any questions.

Comment From: theoathayde

Hello, sorry for taking so long. I`ve been having some trouble advancing with this issue, can i still work in this? If so, can i have some help?

Comment From: wilkinsona

No problem, @theoathayde. How can we help?

Comment From: theoathayde

Awesome, thank you. Sorry if this is too basic, i successfully built the code but i'm having trouble actually running spring boot so i can test the metadata.

Comment From: wilkinsona

I don't think that's necessary. Instead, I would test the metadata by modifying the existing record-based tests. The tests currently check that the properties are recorded but that's it. Those tests could be updated to check that the expected descriptions are now found. You can use withDescription to do so as some of the earlier tests already do. See this one, for example.

Comment From: theoathayde

Hi, i've been working on this for a while but i still had no success. I've tried some things like creating a new method on Metadata to include a description and i updated the test but it failed. Do you have some tips or ideas on the changes i have to make?

Comment From: philwebb

@theoathayde I lot of the team is taking vacation over the holiday season. I'm afraid we probably won't be able to investigate other ideas until the new year. Sorry about that.

Comment From: theoathayde

Sure, happy holidays, we can discuss it more next year.

Comment From: wilkinsona

@theoathayde Can you share a branch on your fork that shows your changes thus far? That'll give us a basis on which to offer some suggestions.

Comment From: theoathayde

Hello, i'm having some health issues, i'm afraid i won't be able to work on this anymore. I'm deeply sorry.

Comment From: philwebb

Sorry to hear about your health issues @theoathayde. Best wishes for your recovery.

Comment From: An1s9n

Hi team! Please consider PR #29403 as a solution for this issue.

Comment From: snicoll

Closing in favor of PR #29403