Skip to content

Commit 08ab561

Browse files
authored
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 <marco.nenciarini@enterprisedb.com>
1 parent 5001fe7 commit 08ab561

File tree

3 files changed

+2
-5
lines changed

3 files changed

+2
-5
lines changed

Taskfile.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ tasks:
8686
# renovate: datasource=git-refs depName=crd-gen-refs lookupName=https://github.com/cloudnative-pg/daggerverse currentValue=main
8787
DAGGER_CRDGENREF_SHA: ee59e34a99940e45f87a16177b1d640975b05b74
8888
# renovate: datasource=go depName=github.com/elastic/crd-ref-docs
89-
CRDREFDOCS_VERSION: v0.2.0
89+
CRDREFDOCS_VERSION: v0.3.0
9090
cmds:
9191
- >
9292
GITHUB_REF= dagger -s call -m github.com/cloudnative-pg/daggerverse/crd-ref-docs@${DAGGER_CRDGENREF_SHA}

hack/crd-gen-refs/config.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
processor:
22
ignoreGroupVersions:
33
- "GVK"
4-
customMarkers:
5-
- name: "optional"
6-
target: field
74
ignoreFields:
85
# - "status$"
96
- "TypeMeta$"

hack/crd-gen-refs/markdown/type.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ _Appears in:_
3131
{{ end -}}
3232

3333
{{ range $type.Members -}}
34-
| `{{ .Name }}` _{{ markdownRenderType .Type }}_ | {{ template "type_members" . }} | {{ if not .Markers.optional -}}True{{- end }} | {{ markdownRenderDefault .Default }} | {{ range .Validation -}} {{ markdownRenderFieldDoc . }} <br />{{ end }} |
34+
| `{{ .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 }} <br />{{ end }}{{- end }} |
3535
{{ end -}}
3636

3737
{{ end -}}

0 commit comments

Comments
 (0)