Templates: remove deprecated params from api (#15020)
This commit is contained in:
parent
972259f706
commit
5e608fb656
1 changed files with 14 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue