fix: ignore unknown field in json gateway (#1619)

This commit is contained in:
Livio Amstutz 2021-04-19 17:20:18 +02:00 committed by GitHub
parent 6863aeac59
commit eb75ba87fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,6 +13,7 @@ import (
"github.com/caos/zitadel/internal/telemetry/tracing" "github.com/caos/zitadel/internal/telemetry/tracing"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/protobuf/encoding/protojson"
) )
const ( const (
@ -21,7 +22,11 @@ const (
) )
var ( var (
DefaultJSONMarshaler = &runtime.JSONPb{} DefaultJSONMarshaler = &runtime.JSONPb{
UnmarshalOptions: protojson.UnmarshalOptions{
DiscardUnknown: true,
},
}
DefaultServeMuxOptions = func(customHeaders ...string) []runtime.ServeMuxOption { DefaultServeMuxOptions = func(customHeaders ...string) []runtime.ServeMuxOption {
return []runtime.ServeMuxOption{ return []runtime.ServeMuxOption{