I  have a piece of groovy code in a custom nifi processor that creates a 
SimpleRecordSchema from an arraylist of  RecordField objects.

So, it looks like this:

// dataObject is a large map, we need to create a SimpleRecord Schema from it
dataObject.each {key, value ->
               if (value instanceof String)
               {
                   fields.add(new RecordField(key, new 
DataType(RecordFieldType.STRING, null)))
               }
...
}
return new SimpleRecordSchema(fields)

What Id like to do is say that the field is an OPTIONAL one.  That is, it may 
not have all fields.  Its ok if the field doesn't appear in the final json.  It 
doesn't have the value null, its just MISSING.

Is there a way to specify that kind of a schema?  Or must all fields always 
appear?

Geoff Greene

Reply via email to