From 5e608fb6561bcd7b773c7fe7efe0b3257610f961 Mon Sep 17 00:00:00 2001 From: andig Date: Wed, 24 Jul 2024 16:24:46 +0200 Subject: [PATCH] Templates: remove deprecated params from api (#15020) --- server/http_config_metadata_handler.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/server/http_config_metadata_handler.go b/server/http_config_metadata_handler.go index b47c320b9..a58887001 100644 --- a/server/http_config_metadata_handler.go +++ b/server/http_config_metadata_handler.go @@ -33,7 +33,20 @@ func templatesHandler(w http.ResponseWriter, r *http.Request) { return } - jsonResult(w, templates.ByClass(class)) + // filter deprecated properties + res := make([]templates.Template, 0) + for _, t := range templates.ByClass(class) { + params := make([]templates.Param, 0, len(t.Params)) + for _, p := range t.Params { + if p.Deprecated == nil || !*p.Deprecated { + params = append(params, p) + } + } + t.Params = params + res = append(res, t) + } + + jsonResult(w, res) } // productsHandler returns the list of products by class