From 58d44264e9d3ebb39592364c64eb7de04afc1ba8 Mon Sep 17 00:00:00 2001 From: Marat Burnaev Date: Wed, 22 Oct 2025 22:32:43 +0700 Subject: [PATCH] fix: replace any with json.RawMessage in MarshalJSON of types.Query to prevent unexpected chat conversions and precision loss --- typedapi/types/query.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/typedapi/types/query.go b/typedapi/types/query.go index 7194c31caa..78d06ae0a0 100644 --- a/typedapi/types/query.go +++ b/typedapi/types/query.go @@ -617,7 +617,7 @@ func (s *Query) UnmarshalJSON(data []byte) error { func (s Query) MarshalJSON() ([]byte, error) { type opt Query // We transform the struct to a map without the embedded additional properties map - tmp := make(map[string]any, 0) + tmp := make(map[string]json.RawMessage, 0) data, err := json.Marshal(opt(s)) if err != nil { @@ -630,7 +630,7 @@ func (s Query) MarshalJSON() ([]byte, error) { // We inline the additional fields from the underlying map for key, value := range s.AdditionalQueryProperty { - tmp[fmt.Sprintf("%s", key)] = value + tmp[key] = value } delete(tmp, "AdditionalQueryProperty")