diff --git a/api/server/router/system/system_routes.go b/api/server/router/system/system_routes.go index 27063fc0ff664ebd0b19e5c3bbf669c55408b41b..246cc67415c968ba9d56ef9c11a491c5503326da 100644 --- a/api/server/router/system/system_routes.go +++ b/api/server/router/system/system_routes.go @@ -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) } diff --git a/api/swagger.yaml b/api/swagger.yaml index 40beae7a32a4dedf04ece09ecc27c977bf63117a..ddb8544bccdff2d56f6bb7addf754a090858ebd6 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -8339,6 +8339,7 @@ paths: UsageData: Size: 10920104 RefCount: 2 + BuildCache: [] 500: description: "server error" schema: