From ba1e4522a1fc045078bf0740233f3d12ad338c4e Mon Sep 17 00:00:00 2001 From: John Howard Date: Thu, 4 Jun 2026 12:42:48 -0700 Subject: [PATCH] Add config explorer for standalone Signed-off-by: John Howard --- .../configuration/latest/config-schema.html | 6659 +++++++++++++++++ .../configuration/main/config-schema.html | 6659 +++++++++++++++++ content/docs/standalone/_content.gotmpl | 59 +- layouts/docs/api-ref.html | 48 + layouts/docs/kubernetes/api-ref.html | 3 +- scripts/kubespec-render/render.go | 23 + 6 files changed, 13404 insertions(+), 47 deletions(-) create mode 100644 assets/agw-docs/pages/reference/configuration/latest/config-schema.html create mode 100644 assets/agw-docs/pages/reference/configuration/main/config-schema.html create mode 100644 layouts/docs/api-ref.html diff --git a/assets/agw-docs/pages/reference/configuration/latest/config-schema.html b/assets/agw-docs/pages/reference/configuration/latest/config-schema.html new file mode 100644 index 000000000..1e7de5c47 --- /dev/null +++ b/assets/agw-docs/pages/reference/configuration/latest/config-schema.html @@ -0,0 +1,6659 @@ + +
+ + + diff --git a/assets/agw-docs/pages/reference/configuration/main/config-schema.html b/assets/agw-docs/pages/reference/configuration/main/config-schema.html new file mode 100644 index 000000000..1e7de5c47 --- /dev/null +++ b/assets/agw-docs/pages/reference/configuration/main/config-schema.html @@ -0,0 +1,6659 @@ + +
+ + + diff --git a/content/docs/standalone/_content.gotmpl b/content/docs/standalone/_content.gotmpl index 15baf6730..d5daca828 100644 --- a/content/docs/standalone/_content.gotmpl +++ b/content/docs/standalone/_content.gotmpl @@ -90,59 +90,26 @@ {{/* --- Generate pages for each target --- */}} {{ range $prefix := $targets }} - {{/* --- Config schema: full single page --- + {{/* --- Config schema explorer --- Lives at reference/configuration/schema, alongside the manually authored validation guide at reference/configuration/validation. */}} - {{ $fullMd := "Generated from the [agentgateway JSON schema](https://github.com/agentgateway/agentgateway/blob/main/schema/config.json).\n" }} - {{ range $configPages }} - {{ $typeDef := index $defs .defName }} - {{ $fullMd = printf "%s\n---\n\n## %s\n" $fullMd .title }} - {{ with .desc }}{{ $fullMd = printf "%s\n%s\n" $fullMd . }}{{ end }} - {{ $fullMd = printf "%s\nSchema type: `%s`\n" $fullMd .defName }} - {{ $scp := index site.Data "schema_config_paths" | default dict }} - {{ $pathsByDef := index $scp "pathsByDef" | default dict }} - {{ $cfgPaths := index $pathsByDef .defName | default slice }} - {{ if gt (len $cfgPaths) 0 }} - {{ $fullMd = printf "%s\n%s can be configured in the following sections:\n\n```text\n%s\n```\n\n" $fullMd .title (delimit $cfgPaths "\n") }} - {{ end }} - {{ with $typeDef }} - {{ with .description }} - {{ $fullMd = printf "%s\n> %s\n" $fullMd (replace . "\n" " ") }} - {{ end }} - {{ with .properties }} - {{ $fullMd = printf "%s\nYou can configure the following fields:\n\n" $fullMd }} - {{ $fullMd = printf "%s\n| Field | Type | Description |\n|-------|------|-------------|\n" $fullMd }} - {{ range $fname, $fprop := . }} - {{ $ftype := "" }} - {{ with $fprop.type }} - {{ if reflect.IsSlice . }} - {{ $filtered := slice }} - {{ range . }}{{ if ne . "null" }}{{ $filtered = $filtered | append . }}{{ end }}{{ end }} - {{ $ftype = delimit $filtered ", " }} - {{ else }}{{ $ftype = . }}{{ end }} - {{ end }} - {{ if isset $fprop "_ref" }}{{ $ftype = printf "`%s`" (path.Base (index $fprop "_ref")) }}{{ end }} - {{ with $fprop.items }}{{ if isset . "_ref" }}{{ $ftype = printf "array of `%s`" (path.Base (index . "_ref")) }}{{ end }}{{ end }} - {{ with $fprop.anyOf }}{{ range . }}{{ if isset . "_ref" }}{{ $ftype = printf "`%s`" (path.Base (index . "_ref")) }}{{ end }}{{ end }}{{ end }} - {{ if not $ftype }}{{ $ftype = "object" }}{{ end }} - {{ $fdesc := $fprop.description | default "" }} - {{ $fdesc = replace $fdesc "|" "\\|" }} - {{ $fdesc = replace $fdesc "\n" " " }} - {{ if gt (len $fdesc) 200 }}{{ $fdesc = printf "%s..." (substr $fdesc 0 200) }}{{ end }} - {{ $fdefault := "" }} - {{ if isset $fprop "default" }}{{ with $fprop.default }}{{ $fdefault = printf " Default: `%v`." . }}{{ end }}{{ end }} - {{ $fullMd = printf "%s| `%s` | %s | %s%s |\n" $fullMd $fname $ftype $fdesc $fdefault }} - {{ end }} - {{ end }} - {{ end }} + {{ $configVersion := index (split $prefix "/") 0 }} + {{ $configWidgetHtml := "" }} + {{ $configHtmlPath := printf "assets/agw-docs/pages/reference/configuration/%s/config-schema.html" $configVersion }} + {{ if os.FileExists $configHtmlPath }} + {{ $configWidgetHtml = readFile $configHtmlPath }} + {{ else }} + {{ warnf "Configuration schema widget HTML not found: %s (skipping explorer widget for %s)" $configHtmlPath $prefix }} {{ end }} + {{ $fullMd := "Generated from the [agentgateway JSON schema](https://github.com/agentgateway/agentgateway/blob/main/schema/config.json).\n\n

" }} {{ $.AddPage (dict "content" (dict "mediaType" "text/markdown" "value" $fullMd) "kind" "page" - "params" (dict "generated" true) + "layout" "api-ref" + "params" (dict "generated" true "widgetHtml" $configWidgetHtml) "path" (printf "%s/configuration/schema" $prefix) - "title" "Configuration schema" - "description" "Configuration reference for agentgateway configuration schema." + "title" "Configuration schema explorer" + "description" "Explore the agentgateway standalone configuration schema interactively, including nested fields and validation details." "weight" 2 ) }} diff --git a/layouts/docs/api-ref.html b/layouts/docs/api-ref.html new file mode 100644 index 000000000..d19f9ab9a --- /dev/null +++ b/layouts/docs/api-ref.html @@ -0,0 +1,48 @@ +{{ define "main" }} + + {{ partial "nav.html" . }} +
+ {{ partial "announcement.html" .}} +
+
+ {{ partial "sidebar.html" (dict "context" .) }} + {{ partial "toc.html" . }} +
+
+ {{ partial "breadcrumb.html" . }} +
+ {{ partial "docs-llms-directive.html" . }} + {{ partial "copy-markdown.html" . }} + {{ if .Title }}

{{ .Title }}

{{ end }} + {{ partial "test-status-badge.html" . }} + {{- with .Description }}

{{ . | markdownify }}

{{ end }} + {{- /* + Split .Content on the widget slot sentinel so the kubespec HTML can + be injected without passing through Goldmark (which corrupts