Grpc-gateway-map-null - gRPC Gateway test using nullable values in map

Demonstrate gRPC gateway behavior with nullable values in maps

Using grpc-gateway v2.7.2.

This is a simple service just echoing a map<string, google.protobuf.StringValue>.

Generated Go code is a map[string]*wrapperspb.StringValue, so the value could be nil.

In grpc-gateway version 2.0.0 or greater, passing null value in a JSON fails and does not set *wrapperspb.StringValue to nil :

In grpc-gateway version 1.16.0, passing null value in a JSON set *wrapperspb.StringValue to empty string "".

Reproduce issue

Checkout the right branch associated with the version of grpc-gateway (git checkout) :

  • master (v2.7.2)
  • v2.0.1
  • v1.16.0

Run server and run gateway :

make server
make gateway

Send a HTTP request with body :

{
  "aMap": {
    "someString": "test",
    "emptyString": "",
    "nullableString": null
  }
}

On version 2.7.2 and 2.0.1 :

$ make echo
{"code":3, "message":"proto: (line 1:70): invalid value for string type: null", "details":[]}

On version 1.16.0 :

$ make echo
{"aMap": {"someString": "test", "emptyString": "", "nullableString": ""}}
Similar Resources

Simple installation script for grpc-gateway

Grpc-Gateway-installation Grpc-gateway is a plugin of Google protocol buffer compiler, it reads the definitions from .proto file and generates a rever

Dec 16, 2021

gRPC LRU-cache server and client with load test

gRPC k-v storage with LRU-cache server & client + load test. Specify LRU-cache capacity: server/cmd/app.go - StorageCapacity go build ./server/cmd/*

Dec 26, 2021

This service is intented to collect data using grpc using Go lang backend and cassandra DB as storage

Go Data Collection This service is intented to collect data using grpc using Go lang backend and cassandra DB as storage. Dev Setup make test_env make

Apr 13, 2022

Log4Shell is a middleware plugin for Traefik which blocks JNDI attacks based on HTTP header values.

Log4Shell Mitigation Log4Shell is a middleware plugin for Traefik which blocks JNDI attacks based on HTTP header values. Related to the Log4J CVE: htt

Dec 20, 2022

Compute and print message digest hash values from stdin.

Compute and print message digest hash values from stdin.

Jan 31, 2022

A suite of gRPC debugging tools. Like Fiddler/Charles but for gRPC.

grpc-tools A suite of tools for gRPC debugging and development. Like Fiddler/Charles but for gRPC! The main tool is grpc-dump which transparently inte

Dec 22, 2022

grpc-http1: A gRPC via HTTP/1 Enabling Library for Go

grpc-http1: A gRPC via HTTP/1 Enabling Library for Go This library enables using all the functionality of a gRPC server even if it is exposed behind a

Dec 17, 2022

Server and client implementation of the grpc go libraries to perform unary, client streaming, server streaming and full duplex RPCs from gRPC go introduction

Description This is an implementation of a gRPC client and server that provides route guidance from gRPC Basics: Go tutorial. It demonstrates how to u

Nov 24, 2021

Simple grpc web and grpc transcoding with Envoy

Simple grpc web and grpc transcoding with Envoy

gRPC Web and gRPC Transcoding with Envoy This is a simple stand-alone set of con

Dec 25, 2021
Optional-go - Library for conveniently and safely dealing with optional (nullable) values

Optional Go Library for conveniently and safely dealing with optional (nullable)

Oct 24, 2022
null

chrome-webrtc-packet-log-parser Project status At this point the project is primerly intended to be used by checking it out and modifying main.go, how

Dec 19, 2022
Go based grpc - grpc gateway micro service example

go-grpc-gateway-server This repository provides an example for go based microservice. Go micro services developed based on gRPC protobuf's and also us

Dec 8, 2021
The Durudex gateway combines all durudex services so that it can be used through a single gateway.

The Durudex gateway combines all durudex services so that it can be used through a single gateway.

Dec 13, 2022
Feb 10, 2022
GRPC - A client-server mockup, using gRPC to expose functionality.

gRPC This is a mockup application that I built to help me visualise and understand the basic concepts of gRPC. In this exchange, the client can use a

Jan 4, 2022
Grpc-train - Train booking demo using gRPC

gRPC Demo: Train Booking Service Description Usage Contributing Development Tool

Feb 6, 2022
Go-grpc-tutorial - Simple gRPC server/client using go

Simple gRPC server/client using go Run server go run usermgmt_server/usermgmt_

Feb 14, 2022