Skip to content

Commit 34cecb0

Browse files
committed
fix(docs): filter Optional markers from validation column
The crd-ref-docs tool v0.3.0 introduced a change that started rendering `+optional` Go code markers as `Optional: {}` in the validation column of API documentation. This appeared as an empty JSON object and was redundant since the Required column already displayed this information. This updates the documentation template to filter out these Optional markers while preserving meaningful validation rules like patterns and enums. It also removes redundant customMarkers configuration. Closes #722 Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
1 parent 5001fe7 commit 34cecb0

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)