OpensourceEnthu
OpensourceEnthu

Reputation: 31

Avro schema not possible for json containing dash

My input Json fieldnames contain dash. ex: "Last-Name" : "Doe"

When I pass this json to Infer Avro Schema processor, it is failing telling me "Illegal character in:Last-Name"

I also noticed that using the dash in AvroSchemaRegistry, does not compile and ultimately does not allow to enable the service.

I tried escaping the dash with "\" but still does not work. I am on 1.4.0 version.

Any help in this regard would be appreciated.

Thanks!

Upvotes: 2

Views: 3151

Answers (1)

mattyb
mattyb

Reputation: 12083

A dash is not a valid character for Avro names (see the spec here). As a possible workaround for NiFi 1.4.0, you can use underscores instead of dashes. If this is not a viable workaround, then as of NiFi 1.5.0 (NIFI-4612) you can disable name validation so it will not complain about the dashes.

Upvotes: 9

Related Questions