You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nifi.apache.org by Mike Thomsen <mi...@gmail.com> on 2018/04/08 22:05:20 UTC

Programmatically building a nested schema

Can someone tell me how to build a nested schema using RecordSchema and
RecordField objects? The use case here is to make MongoDBLookupService able
to roughly detect the schema from the returned bson Document.

Thanks,

Mike

Re: Programmatically building a nested schema

Posted by Bryan Bende <bb...@gmail.com>.
Add a RecordField to the RecordSchema where the DataType is a
RecordDataType... a RecordDataType then has a child schema.

May be helpful to look at the code that converts between RecordSceham
and Avro schemas:

https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/avro/AvroTypeUtil.java#L195-L205

On Sun, Apr 8, 2018 at 6:05 PM, Mike Thomsen <mi...@gmail.com> wrote:
> Can someone tell me how to build a nested schema using RecordSchema and
> RecordField objects? The use case here is to make MongoDBLookupService able
> to roughly detect the schema from the returned bson Document.
>
> Thanks,
>
> Mike