avro-user mailing list archives

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

I forgot to mention, I'm using the java implementation of avro.


> -----Urspr√ľngliche Nachricht-----
> Von: Alexander Zenger [mailto:a.zenger@cetec.cc]
> Gesendet: Donnerstag, 2. April 2015 10:35
> An: user@avro.apache.org
> Betreff: check for required fields
> 
> 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