You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2020/11/05 23:49:51 UTC

[GitHub] [nifi] markap14 commented on pull request #4648: NIFI-7981 - add support for enum type in avro schema

markap14 commented on pull request #4648:
URL: https://github.com/apache/nifi/pull/4648#issuecomment-722710471


   I'm personally not a fan of introducing Enum here as a datatype. I avoided introducing that as one of the data types when originally creating the Record API. What I think makes far more sense is a more general notion of restrictions of types. Consider, for example, how XSD allows you to add a restriction to a base type. We want to eventually support specifying schemas using XSD, and we'll need to support this notion in order to make that happen. I would certainly favor introducing that notion now over introducing an Enum. Then, when converting an Avro schema into a RecordSchema, we could do so as a restriction on the String type. This provides far more power and flexibility when using schemas, such as specifying that an int must be in the range of 1-100, and this then becomes extremely powerful when coupled with something like ValidateRecord.
   Adding an enum at this time, IMO, makes this a bit awkward, because it is then a specific type whose purpose is to introduce a restriction on another type (I.e., it is basically a Restriction on a String type). So I think it kind of makes things confusing if our API provides two mechanisms for specifying an enumeration: using an enum type, or specifying a restriction on a String type...


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org