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
This commit is contained in:
Nityananda Gohain 2025-08-29 11:16:16 +05:30 committed by GitHub
parent 369f77977d
commit 5bb6d78c42
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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
}