From 810b6983ef54077e094cc30aca14108b57097643 Mon Sep 17 00:00:00 2001 From: Sebastian Choren Date: Thu, 8 Feb 2024 15:57:01 -0300 Subject: [PATCH] feat(server): minimize run list response size (#3612) --- server/http/controller.go | 2 +- server/http/mappings/tests.go | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/server/http/controller.go b/server/http/controller.go index 80debbedb1..30f26bd1bf 100644 --- a/server/http/controller.go +++ b/server/http/controller.go @@ -251,7 +251,7 @@ func (c *controller) GetTestRuns(ctx context.Context, testID string, take, skip } return openapi.Response(200, paginated[openapi.TestRun]{ - items: c.mappers.Out.Runs(runs), + items: c.mappers.Out.RunsSimplified(runs), count: count, }), nil } diff --git a/server/http/mappings/tests.go b/server/http/mappings/tests.go index 6926fcb131..7c9a350047 100644 --- a/server/http/mappings/tests.go +++ b/server/http/mappings/tests.go @@ -338,6 +338,17 @@ func (m OpenAPI) Runs(in []test.Run) []openapi.TestRun { return runs } +func (m OpenAPI) RunsSimplified(in []test.Run) []openapi.TestRun { + runs := make([]openapi.TestRun, len(in)) + for i, t := range in { + // remove non requried fields + t.Trace = nil + runs[i] = m.Run(&t) + } + + return runs +} + // in type Model struct { comparators comparator.Registry