From eb75ba87fbb0fca0a0898613dcf027717910d5ae Mon Sep 17 00:00:00 2001 From: Livio Amstutz Date: Mon, 19 Apr 2021 17:20:18 +0200 Subject: [PATCH] fix: ignore unknown field in json gateway (#1619) --- internal/api/grpc/server/gateway.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/api/grpc/server/gateway.go b/internal/api/grpc/server/gateway.go index e5c88a652f..40b3b52e8b 100644 --- a/internal/api/grpc/server/gateway.go +++ b/internal/api/grpc/server/gateway.go @@ -13,6 +13,7 @@ import ( "github.com/caos/zitadel/internal/telemetry/tracing" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "google.golang.org/grpc" + "google.golang.org/protobuf/encoding/protojson" ) const ( @@ -21,7 +22,11 @@ const ( ) var ( - DefaultJSONMarshaler = &runtime.JSONPb{} + DefaultJSONMarshaler = &runtime.JSONPb{ + UnmarshalOptions: protojson.UnmarshalOptions{ + DiscardUnknown: true, + }, + } DefaultServeMuxOptions = func(customHeaders ...string) []runtime.ServeMuxOption { return []runtime.ServeMuxOption{