avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Schmitt <dan.schm...@gmail.com>
Subject Re: how to do non-optional field in nested object?
Date Mon, 27 Nov 2017 15:19:48 GMT
The top level object in all the examples is a record (of which you can
have 0 or more.)

So, right now, even the top level is failing the spec:

IV) valid (0 ARecords):
{ }

V) valid (2 ARecords):
  "id": "...",
  "B": {
    "C": "..."
} ,
"id": "...",
  "B": {
    "C": "..."

On Mon, Nov 27, 2017 at 9:47 AM, Martin Mucha <alfonz19@gmail.com> wrote:
> I don't understand where "or more" is comming from.

Because of the use of nested records.  Anywhere you put a record you can have 0,
or more than 1.  I don't know of a pure schema way to enforce only 1/optional.

If you are doing something with any of the APIs you could add a validation step
that says "must have only 1 ARecord, and must have only 1 BRecord" after you
read the data and throw an error for the 0 or 1+ situations, but you'd
need to write
some code somewhere with one of the APIs and build your own validator.

View raw message