Files
docker-docs/layouts/api-reference.markdown.md
David Karlsson 553c69e1b7 sbx: restructure governance docs and add API reference (#25162)
## Summary

Restructures the Docker AI Governance documentation under
\`/ai/sandboxes/governance/\` and adds the supporting API reference.

Preview links:

-
https://deploy-preview-25162--docsdocker.netlify.app/ai/sandboxes/governance/
-
https://deploy-preview-25162--docsdocker.netlify.app/reference/api/ai-governance/

### Information architecture

The existing \`security/governance\` and \`security/policy\` pages are
merged into a new top-level \`governance\` section so local-policy and
org-policy sit side by side instead of being split across unrelated
parents:

- \`/ai/sandboxes/governance/\` — section landing; explains local + org
as layered enforcement
- \`/ai/sandboxes/governance/concepts/\` — resource model, rule syntax,
evaluation, precedence
- \`/ai/sandboxes/governance/local/\` — \`sbx policy\` CLI for
individual machines
- \`/ai/sandboxes/governance/org/\` — Admin Console flow (was
\`security/governance.md\`)
- \`/ai/sandboxes/governance/monitoring/\` — \`sbx policy ls\` / \`sbx
policy log\`

### API reference

\`/reference/api/ai-governance/\` renders the Governance OpenAPI spec
vendored at \`content/reference/api/ai-governance/api.yaml\` from
\`docker/governor-services\`. Operations, schemas, examples, and status
codes are fully driven by the spec — future updates land via re-vendor,
not in-repo edits. Anything wrong in the rendered reference should be
fixed upstream and re-vendored here.

The spec has been re-vendored to the latest upstream version, which
updated the server URL to \`hub.docker.com/v2\` and added the
\`/governance/\` prefix to all API paths.

### Review focus

1. The \`/ai/sandboxes/governance/\` landing — does the local + org
framing match how the product is positioned?
2. \`/reference/api/ai-governance/\` — does the rendered spec match the
source of truth, and is anything important missing?

Generated by Claude Code

---------

Co-authored-by: Louis-Arnaud <la.catoire@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 10:05:05 +02:00

5.6 KiB

{{- /* Markdown rendering of an OpenAPI reference page.

Mirrors the HTML api-reference layout: unmarshals the colocated YAML Page Resource into a plain Hugo map and walks the spec to produce a flat markdown document. Used by the "View Markdown" / "Copy Markdown" actions and the .md alternate link. / -}} {{- $specRes := .Resources.GetMatch ".yaml" -}} {{- $api := $specRes | transform.Unmarshal -}} {{- $methods := slice "get" "post" "put" "patch" "delete" -}} {{- $paths := $api.paths -}}

{{ .Title }}

{{ with .Description }}{{ . }}{{ end }}

{{ with $api.info }} {{- with .version }}- Version: {{ . }} {{ end -}} {{ end -}} {{- range $api.servers }}- Base URL: {{ .url }} {{ end }}

  • OpenAPI specification: [{{ path.Base $specRes.RelPermalink }}]({{ $specRes.Permalink }})

{{ with $api.info }}{{ with .description }}{{ . }}{{ end }}{{ end }}

{{ with $api.components }}{{ with .securitySchemes }}

Authentication

{{ range $name, $scheme := . }} {{ $name }}{{ with $scheme.type }} — type: {{ . }}{{ end }}{{ with $scheme.scheme }}, scheme: {{ . }}{{ end }}{{ with $scheme.bearerFormat }}, bearer format: {{ . }}{{ end }}

{{ with $scheme.description }}{{ . }}{{ end }} {{ end -}} {{ end }}{{ end }}

{{- range $api.tags }}

{{ .name | title }}

{{ with .description }}{{ . }}{{ end }}

{{- $tagName := .name -}} {{- range $path, $item := $paths -}} {{- $sharedParams := slice -}} {{- with index $item "parameters" -}} {{- range . -}} {{- $p := partial "api-ref/resolve.html" (dict "api" $api "node" .) -}} {{- $sharedParams = $sharedParams | append $p -}} {{- end -}} {{- end -}} {{- range $methods -}} {{- $method := . -}} {{- with index $item $method -}} {{- $op := . -}} {{- if in $op.tags $tagName }}

{{ upper $method }} {{ $path }}

{{ with $op.summary }}{{ . }}{{ end }}

{{ with $op.description }}{{ . }}{{ end }}

{{- $params := $sharedParams -}} {{- with index $op "parameters" -}} {{- range . -}} {{- $p := partial "api-ref/resolve.html" (dict "api" $api "node" .) -}} {{- $params = $params | append $p -}} {{- end -}} {{- end -}} {{ if $params }} Parameters

{{ range $params -}}

  • {{ .name }} ({{ .in }}{{ with .schema }}{{ with .type }}, {{ . }}{{ end }}{{ end }}{{ if .required }}, required{{ end }}){{ with .description }} — {{ . | strings.TrimSpace }}{{ end }} {{ end }} {{- end }}

{{- with $op.requestBody -}} {{- $body := partial "api-ref/resolve.html" (dict "api" $api "node" .) }} Request body{{ with $body.description }} — {{ . | strings.TrimSpace }}{{ end }}

{{- $ct := "" -}} {{- $media := dict -}} {{- range $n, $m := $body.content -}} {{- if not $ct -}}{{- $ct = $n -}}{{- $media = $m -}}{{- end -}} {{- end -}} {{ if $ct }} Content type: {{ $ct }}

{{ template "api-ref-md-schema-link" (dict "schema" $media.schema) }} {{ range $exName, $ex := $media.examples }}{{ with $ex.value }}

{{ . | jsonify (dict "indent" "  ") }}

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

{{- with $op.responses }} Responses

{{ range $code, $resp := . -}} {{- $r := partial "api-ref/resolve.html" (dict "api" $api "node" $resp) }} {{ $code }} — {{ with $r.description }}{{ . | strings.TrimSpace }}{{ end }} {{- $ct := "" -}} {{- $media := dict -}} {{- range $n, $m := $r.content -}} {{- if not $ct -}}{{- $ct = $n -}}{{- $media = $m -}}{{- end -}} {{- end }} {{ if $ct }} {{ template "api-ref-md-schema-link" (dict "schema" $media.schema) }} {{ range $exName, $ex := $media.examples }}{{ with $ex.value }}

{{ . | jsonify (dict "indent" "  ") }}

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

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

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

{{- with $api.components }}{{ with .schemas }}

Schemas

{{ range $name, $schema := . }}

{{ $name }}

{{ with $schema.description }}{{ . | strings.TrimSpace }}{{ end }}

{{ with $schema.enum -}} Enum: {{ range $i, $v := . }}{{ if $i }}, {{ end }}{{ $v }}{{ end }} {{ end }}

{{- with $schema.properties }} {{- $required := $schema.required | default slice }}

Property Type Required Description
{{ range $propName, $prop := . -}}
{{ $propName }} {{ template "api-ref-md-type" $prop }} {{ if in $required $propName }}yes{{ else }}no{{ end }} {{ with $prop.description }}{{ .
{{ end }}
{{ end -}}

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

{{- /* ── Helpers ───────────────────────────────────────────────────────── */ -}}

{{- define "api-ref-md-type" -}} {{- $s := . -}} {{- if reflect.IsMap $s -}} {{- with index $s "$ref" -}} {{- $parts := split . "/" -}} {{- $name := index $parts (sub (len $parts) 1) -}} {{ $name }} {{- else -}} {{- with $s.type -}} {{- if eq . "array" -}} array<{{ template "api-ref-md-type" $s.items }}> {{- else -}} {{ . }} {{- end -}} {{- else -}} {{- if $s.allOf -}}object {{- else if or $s.anyOf $s.oneOf -}}any {{- else -}}—{{- end -}} {{- end -}} {{- end -}} {{- else -}}—{{- end -}} {{- end -}}

{{- define "api-ref-md-schema-link" -}} {{- $schema := .schema -}} {{- $indent := .indent | default "" -}} {{- if reflect.IsMap $schema -}} {{- with index $schema "$ref" -}} {{- $parts := split . "/" -}} {{- $name := index $parts (sub (len $parts) 1) -}} {{ $indent }}Schema: {{ $name }} {{- end -}} {{- end -}} {{- end -}}