API: ensure empty build cache is represented as empty JSON array
Ensure empty `BuildCache` field is represented as empty JSON array(`[]`) instead of `null` to be consistent with `Images`, `Containers` etc. Signed-off-by: Roman Volosatovs <roman.volosatovs@docker.com>
This commit is contained in:
parent
5e4da6cc82
commit
f2225933bb
2 changed files with 6 additions and 0 deletions
|
@ -120,6 +120,11 @@ func (s *systemRouter) getDiskUsage(ctx context.Context, w http.ResponseWriter,
|
|||
|
||||
du.BuilderSize = builderSize
|
||||
du.BuildCache = buildCache
|
||||
if buildCache == nil {
|
||||
// Ensure empty `BuildCache` field is represented as empty JSON array(`[]`)
|
||||
// instead of `null` to be consistent with `Images`, `Containers` etc.
|
||||
du.BuildCache = []*types.BuildCache{}
|
||||
}
|
||||
|
||||
return httputils.WriteJSON(w, http.StatusOK, du)
|
||||
}
|
||||
|
|
|
@ -8339,6 +8339,7 @@ paths:
|
|||
UsageData:
|
||||
Size: 10920104
|
||||
RefCount: 2
|
||||
BuildCache: []
|
||||
500:
|
||||
description: "server error"
|
||||
schema:
|
||||
|
|
Loading…
Reference in a new issue