Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How to make avro schema fields optional ?

Already tried below schema.

{ 
"type": "record",
"name": "MyRecord",
"fields": [
{ "name": "requiredField", "type": "string" },
{ "name": "optionalField", "type": ["null", "string"], "default": null } ] }
{
"requiredField" : "test"
}

 

When I try to test message using Google Console UI test message against above schema with below message it gives error. 
Error : Message is invalid against schema.

Message tested : 
{
"requiredField" : "test"
}

3 6 12K
6 REPLIES 6