From 0c56ab2d5cd8f28dcd5225a9bdd95942b4ed99d7 Mon Sep 17 00:00:00 2001 From: Jared Watts Date: Fri, 28 Mar 2025 18:06:21 -0700 Subject: [PATCH] show (deprecated) for deprecated APIs on API reference Signed-off-by: Jared Watts --- .../layouts/partials/apiBuilder/getVersionAndSchema.html | 6 +++++- .../layouts/partials/apiBuilder/printGKVExpander.html | 3 ++- themes/geekboot/layouts/partials/crds.html | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/themes/geekboot/layouts/partials/apiBuilder/getVersionAndSchema.html b/themes/geekboot/layouts/partials/apiBuilder/getVersionAndSchema.html index 19068a05..d84dc6e8 100644 --- a/themes/geekboot/layouts/partials/apiBuilder/getVersionAndSchema.html +++ b/themes/geekboot/layouts/partials/apiBuilder/getVersionAndSchema.html @@ -1,19 +1,23 @@ {{/* Pass a schema and find the currently active version and return a dict of (version: , schema: ) */}} {{ $version := "" }} {{ $schema := dict }} +{{ $deprecated := false }} {{ range .versions }} {{ if index . "storage" }} {{ $version = .name }} {{ $schema = .schema }} + {{ $deprecated = .deprecated }} {{ else if (and (index . "served") (not $version)) }} {{ $version = .name }} {{ $schema = .schema }} + {{ $deprecated = .deprecated }} {{ end }} {{ end }} {{ return (dict "version" $version - "schema" $schema) + "schema" $schema + "deprecated" $deprecated) }} diff --git a/themes/geekboot/layouts/partials/apiBuilder/printGKVExpander.html b/themes/geekboot/layouts/partials/apiBuilder/printGKVExpander.html index df8850ac..7e3c5833 100644 --- a/themes/geekboot/layouts/partials/apiBuilder/printGKVExpander.html +++ b/themes/geekboot/layouts/partials/apiBuilder/printGKVExpander.html @@ -2,6 +2,7 @@ {{ $group := .group }} {{ $kind := .kind }} {{ $version := .version }} +{{ $deprecated := .deprecated }} {{ $bigName := partial "apiBuilder/checkBigName" $kind }} {{/* Collapse/Expand Button and Kind name */}} @@ -11,7 +12,7 @@ {{/* CRD name text */}} diff --git a/themes/geekboot/layouts/partials/crds.html b/themes/geekboot/layouts/partials/crds.html index cb2ddc3a..ac06aca8 100644 --- a/themes/geekboot/layouts/partials/crds.html +++ b/themes/geekboot/layouts/partials/crds.html @@ -27,13 +27,14 @@ {{ $versionAndSchema := partial "apiBuilder/getVersionAndSchema" $crdContent.spec }} {{ $schema := $versionAndSchema.schema.openAPIV3Schema }} {{ $version := $versionAndSchema.version }} + {{ $deprecated := $versionAndSchema.deprecated }} {{ $description := $schema.description }} {{/* The div containing the entire CRD information including the Expand All/Collapse All row */}}
{{/* generate the GKV line to expand/collapse the CRD data */}} - {{ partial "apiBuilder/printGKVExpander" (dict "group" $group "version" $version "kind" $kind) }} + {{ partial "apiBuilder/printGKVExpander" (dict "group" $group "version" $version "kind" $kind "deprecated" $deprecated) }} {{/* The container to show/hide with information related to the CRD */}}