From 08ab561429472106aa04713e878063f4ae4149bd Mon Sep 17 00:00:00 2001 From: Marco Nenciarini Date: Wed, 4 Feb 2026 13:46:51 +0100 Subject: [PATCH] docs(apidoc): filter Optional markers from validation column (#723) The crd-ref-docs tool v0.3.0 started rendering `+optional` Go markers as `Optional: {}` in API documentation's validation column. This appeared as redundant empty JSON objects since the Required column already conveyed this information. The PR updates the documentation template to filter these markers while keeping meaningful validation rules like patterns and enums, and removes unnecessary customMarkers configuration. Closes #722 Signed-off-by: Marco Nenciarini --- Taskfile.yml | 2 +- hack/crd-gen-refs/config.yaml | 3 --- hack/crd-gen-refs/markdown/type.tpl | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index 3d19578..dff6c90 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -86,7 +86,7 @@ tasks: # renovate: datasource=git-refs depName=crd-gen-refs lookupName=https://github.com/cloudnative-pg/daggerverse currentValue=main DAGGER_CRDGENREF_SHA: ee59e34a99940e45f87a16177b1d640975b05b74 # renovate: datasource=go depName=github.com/elastic/crd-ref-docs - CRDREFDOCS_VERSION: v0.2.0 + CRDREFDOCS_VERSION: v0.3.0 cmds: - > GITHUB_REF= dagger -s call -m github.com/cloudnative-pg/daggerverse/crd-ref-docs@${DAGGER_CRDGENREF_SHA} diff --git a/hack/crd-gen-refs/config.yaml b/hack/crd-gen-refs/config.yaml index 74b2051..c633246 100644 --- a/hack/crd-gen-refs/config.yaml +++ b/hack/crd-gen-refs/config.yaml @@ -1,9 +1,6 @@ processor: ignoreGroupVersions: - "GVK" - customMarkers: - - name: "optional" - target: field ignoreFields: # - "status$" - "TypeMeta$" diff --git a/hack/crd-gen-refs/markdown/type.tpl b/hack/crd-gen-refs/markdown/type.tpl index 525f7c1..fc42594 100644 --- a/hack/crd-gen-refs/markdown/type.tpl +++ b/hack/crd-gen-refs/markdown/type.tpl @@ -31,7 +31,7 @@ _Appears in:_ {{ end -}} {{ range $type.Members -}} -| `{{ .Name }}` _{{ markdownRenderType .Type }}_ | {{ template "type_members" . }} | {{ if not .Markers.optional -}}True{{- end }} | {{ markdownRenderDefault .Default }} | {{ range .Validation -}} {{ markdownRenderFieldDoc . }}
{{ end }} | +| `{{ .Name }}` _{{ markdownRenderType .Type }}_ | {{ template "type_members" . }} | {{ if not .Markers.optional -}}True{{- end }} | {{ markdownRenderDefault .Default }} | {{ range .Validation -}}{{- $v := markdownRenderFieldDoc . }}{{- if and $v (ne $v "Optional: \\{\\}") -}} {{ $v }}
{{ end }}{{- end }} | {{ end -}} {{ end -}}