avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Zenger <a.zen...@cetec.cc>
Subject check for required fields
Date Thu, 02 Apr 2015 08:34:49 GMT
Hi,

it seems to me that Avro does not check if non optional fields are present.
My schema looks like this:

{
   "namespace": "azen.avro.person",
   "type": "record",
   "name": "Person",
   "fields": [
     {"name": "id",   "type": "int"},
     {"name": "number",   "type": "double"},
     {"name": "name", "type": "string"},
     {"name": "email",  "type": ["string", "null"]},
   ]
 }

If I ommit setting the value for id or number, it works and on deserialization
a null value ist set automatically.
If I omit the value for name, an nullpointer exception is thrown.

Is there a way to check if the "required" fields are all set?

--
regards
 alex


Mime
View raw message