Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .mise-tasks/nauth/generate-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ crd-ref-docs \
--source-path="$MISE_PROJECT_ROOT/api" \
--config="$MISE_PROJECT_ROOT/api/config.yaml" \
--renderer=markdown \
--templates-dir="$MISE_PROJECT_ROOT/api/templates/markdown" \
--output-path="$crd_docs"

# Add the required frontmatter for Starlight
Expand Down
4 changes: 4 additions & 0 deletions api/config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
processor:
ignoreFields:
- "TypeMeta$"

render:
kubernetesVersion: 1.36
knownTypes:
Expand Down
19 changes: 19 additions & 0 deletions api/templates/markdown/gv_details.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- define "gvDetails" -}}
{{- $gv := . -}}

## {{ $gv.GroupVersionString }}

{{ $gv.Doc }}

{{- if $gv.Kinds }}
### Resource Types
{{- range $gv.SortedKinds }}
- {{ $gv.TypeForKind . | markdownRenderTypeLink }}
{{- end }}
{{ end }}

{{ range $gv.SortedTypes }}
{{ template "type" . }}
{{ end }}

{{- end -}}
15 changes: 15 additions & 0 deletions api/templates/markdown/gv_list.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- define "gvList" -}}
{{- $groupVersions := . -}}

# API Reference

## Packages
{{- range $groupVersions }}
- {{ markdownRenderGVLink . }}
{{- end }}

{{ range $groupVersions }}
{{ template "gvDetails" . }}
{{ end }}

{{- end -}}
60 changes: 60 additions & 0 deletions api/templates/markdown/type.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{{- define "type" -}}
{{- $type := . -}}
{{- if markdownShouldRenderType $type -}}

#### {{ $type.Name }}

{{ if $type.IsAlias }}_Underlying type:_ _{{ markdownRenderTypeLink $type.UnderlyingType }}_{{ end }}

{{ $type.Doc }}

{{ if $type.Validation -}}
_Validation:_
{{- range $type.Validation }}
- {{ . }}
{{- end }}
{{- end }}

{{ if $type.References -}}
_Appears in:_
{{- range $type.SortedReferences }}
- {{ markdownRenderTypeLink . }}
{{- end }}
{{- end }}

{{ if $type.Members -}}
| Field | Description | Default | Validation |
| --- | --- | --- | --- |
{{ if $type.GVK -}}
| `apiVersion` _string_ | `{{ $type.GVK.Group }}/{{ $type.GVK.Version }}` | | |
| `kind` _string_ | `{{ $type.GVK.Kind }}` | | |
{{ end -}}

{{ range $type.Members -}}
| `{{ .Name }}` _{{ markdownRenderType .Type }}_ | {{ template "type_members" . }} | {{ markdownRenderDefault .Default }} | {{ template "field_validation" . }} |
{{ end -}}

{{ end -}}

{{ if $type.EnumValues -}}
| Field | Description |
| --- | --- |
{{ range $type.EnumValues -}}
| `{{ .Name }}` | {{ markdownRenderFieldDoc .Doc }} |
{{ end -}}
{{ end -}}


{{- end -}}
{{- end -}}

{{- define "field_validation" -}}
{{- range (.Validation | uniq) -}}
{{- if eq . "Optional: {}" -}}
{{- else if eq . "Required: {}" -}}
Required <br />
{{- else -}}
{{ markdownRenderFieldDoc . }} <br />
{{- end -}}
{{- end -}}
{{- end -}}
8 changes: 8 additions & 0 deletions api/templates/markdown/type_members.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{{- define "type_members" -}}
{{- $field := . -}}
{{- if eq $field.Name "metadata" -}}
Refer to Kubernetes API documentation for fields of `metadata`.
{{- else -}}
{{ markdownRenderFieldDoc $field.Doc }}
{{- end -}}
{{- end -}}
412 changes: 260 additions & 152 deletions www/src/content/docs/crds.md

Large diffs are not rendered by default.

Loading