controller-tools icon indicating copy to clipboard operation
controller-tools copied to clipboard

Add Example Usage in Marker Code Documentation for Programmatic Docs Generation

Open camilamacedo86 opened this issue 1 year ago • 6 comments

It would be great if controller-tools begins adding examples directly into the code documentation for the markers, so that the Kuebuilder documentation can be programmatically generated with examples included and make its usage much more simplified.

Context

Currently, Kubebuilder generates its documentation programmatically using the machinery outlined here and the process described here. However, marker documentation is often difficult to understand without practical examples of how to use each marker in context. Including examples in the code documentation would significantly improve the quality of the generated documentation.

Thank you for considering this enhancement! IHMO It will greatly improve the user experience for developers working with markers in controller-tools.

camilamacedo86 avatar Sep 15 '24 17:09 camilamacedo86

@camilamacedo86 Can you maybe open a PR to add an example to one of the markers. Just to show how this would be done?

I think from then on it would be easy for others to contribute for other markers

sbueringer avatar Sep 16 '24 06:09 sbueringer

Hi @sbueringer

Basically, the idea here would be to add examples of the usage within the description. For example, for: https://book.kubebuilder.io/reference/markers/crd-validation

Screenshot 2024-11-25 at 19 51 42

came from: https://github.com/kubernetes-sigs/controller-tools/blob/425b7d770a963e4b4cdcd389b85c8501287a97f3/pkg/crd/markers/validation.go#L233-L244

Could we ensure that we have in those comments/golang docs the options along with the description example of usage?

camilamacedo86 avatar Nov 25 '24 19:11 camilamacedo86

Feel free to open PRs to improve this

sbueringer avatar Dec 20 '24 06:12 sbueringer

I will try asap I have a some time, but if anyone from community want to work on it please feel free It would be a great help.

camilamacedo86 avatar Dec 20 '24 10:12 camilamacedo86

Sure, no rush :)

/help

sbueringer avatar Dec 27 '24 12:12 sbueringer

@sbueringer: This request has been marked as needing help from a contributor.

Guidelines

Please ensure that the issue body includes answers to the following questions:

  • Why are we solving this issue?
  • To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points?
  • Does this issue have zero to low barrier of entry?
  • How can the assignee reach out to you for help?

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-help command.

In response to this:

/help

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

k8s-ci-robot avatar Dec 27 '24 12:12 k8s-ci-robot