micronaut-data icon indicating copy to clipboard operation
micronaut-data copied to clipboard

Refactor documentation for Java Records and Kotlin Data Classes

Open wetted opened this issue 9 months ago • 1 comments

closes #2896

@timyates @sdelamo see what you think about this. It is in draft and can use some cleanup, but I'd like feedback on this approach:

This is meant to solve two problems:

  1. The Java Records documentation uses code snippets; however, there was only code in docs-examples for Java. If a user selects a Kotlin or Groovy tab for snippets in the documentation, then nothing at all shows for the examples in the Java Records section (as reported in the issue linked from this PR).
  2. The Kotlin Data Classes section uses an asciidoc embedded code example. We want to avoid using those because we don't really know if they compile, and they have no tests to confirm they actually work.

I have taken an approach to unify the documentation for using Java Records and Kotlin Data Classes (and use POGOs for Groovy). This has the benefit – I think – that users can see inline the differences using Java records, Kotlin data classes, and Groovy POGOs.

The original Java Records example has a lot more code examples, but they are not used as snippets in the documentation. I left them as is, but did not create Kotlin and Groovy versions. I can do that if we want to be completely consistent across the docs-examples for all three languages.

wetted avatar May 03 '24 16:05 wetted