From 5bb6d78c42acea5cf52ff145de1f88534d96da13 Mon Sep 17 00:00:00 2001 From: Nityananda Gohain Date: Fri, 29 Aug 2025 11:16:16 +0530 Subject: [PATCH] fix: remove isRoot and Entrypoint from selectfields (#8893) * fix: remove isRoot and Entrypoint from selectfields * fix: add comment * fix: add comment * fix: move logic to validation * fix: remove requestType trace * fix: update comment * fix: update error message --- .../querybuildertypesv5/validation.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pkg/types/querybuildertypes/querybuildertypesv5/validation.go b/pkg/types/querybuildertypes/querybuildertypesv5/validation.go index cc90b6ae2095..5e5b3eea2add 100644 --- a/pkg/types/querybuildertypes/querybuildertypesv5/validation.go +++ b/pkg/types/querybuildertypes/querybuildertypesv5/validation.go @@ -145,6 +145,25 @@ func (q *QueryBuilderQuery[T]) Validate(requestType RequestType) error { } } + if requestType == RequestTypeRaw { + if err := q.validateSelectFields(); err != nil { + return err + } + } + + return nil +} + +func (q *QueryBuilderQuery[T]) validateSelectFields() error { + // isRoot and isEntryPoint are returned by the Metadata API, so if someone sends them, we have to reject the request. + for _, v := range q.SelectFields { + if v.Name == "isRoot" || v.Name == "isEntryPoint" { + return errors.NewInvalidInputf( + errors.CodeInvalidInput, + "isRoot and isEntryPoint fields are not supported in selectFields", + ) + } + } return nil }