All,

So it turns out the reason for the validation failure seems to be arising
here:

https://github.com/apache/nifi/blob/b1901d5fe0bf87be3dcce144f13b74eb995be168/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/RecordField.java#L44

When using the following schema:

{
    "type":"record",
    "name":"header",
    "fields":[
      {
        "name":"version",
        "type":"int",
        "doc":"The CEF version extracted from (CEF:0) where 0 is the
version"
      },
      {
        "name":"deviceVendor",
        "type":[
          "null",
          "float"
        ],
        "default":null
      }
    ]

}

The float field with default Null will parse correctly.

However

When using this:

{
  "name":"nifiCommonEventFormat",
  "namespace":"com.fluenda.SecuritySchemas.cefRev23",
  "type":"record",
  "fields":[
    {
      "name":"header",
      "type":{
        "type":"record",
        "name":"header",
        "fields":[
          {
            "name":"version",
            "type":"int",
            "doc":"The CEF version extracted from (CEF:0) where 0 is the
version"
          },
          {
            "name":"deviceVendor",
            "type":[
              "null",
              "float"
            ],
            "default":null
          }
        ]
      }
    }
  ]
}

It fails.

intelliJ seems to suggest an NPE is the underlying cause?

[image: Inline image 1]


What puzzles me, is that I tested with python and the schema seems valid?

$ ./test.py
{u'header': {u'version': 0, u'deviceVendor': 1.2345000505447388}}
{u'header': {u'version': 0, u'deviceVendor': None}}


The test.py script can be found here:

https://gist.github.com/trixpan/4d190bef83712001857548b63c1d995a


Cheers









On Fri, Jun 23, 2017 at 12:20 AM, Andre <[email protected]> wrote:

> Joey,
>
> Using Chrome on Windows. Tried with Firefox and faced the same issue.
>
> On Fri, Jun 23, 2017 at 12:14 AM, Joey Frazee <[email protected]>
> wrote:
>
>> Andre, if there are any line breaks in the schema and leading spaces on
>> those new lines, then this occurs. So if you minify the avsc or remove the
>> leading spaces, all should be good.
>>
>> Will open a JIRA on this since, including myself, I think you’re the
>> third to see this. Any chance you’re using Safari?
>>
>> > On Jun 22, 2017, at 8:53 AM, Andrew Grande <[email protected]> wrote:
>> >
>> > Definitely something is auto replacing quotes, I can confirm pasting
>> worked
>> > fine before from a programmer's editor.
>> >
>> > Andrew
>> >
>> > On Thu, Jun 22, 2017, 9:06 AM Mark Payne <[email protected]> wrote:
>> >
>> >> Andre,
>> >>
>> >> I've not seen this personally. I just clicked on the link you sent,
>> copied
>> >> the schema,
>> >> and pasted it in, and it did not have any problems. What application
>> are
>> >> you copying
>> >> the text from? I've certainly seen that some applications (specifically
>> >> Microsoft Outlook
>> >> and Office) love to take double-quotes and change them into other
>> >> characters so that
>> >> they look nicer. But if you then copy that and paste it, it is not
>> pasting
>> >> a double-quote but
>> >> some other unicode character.
>> >>
>> >> Would recommend you open the below link in Chrome and copy from there
>> and
>> >> see if
>> >> that works?
>> >>
>> >> Thanks
>> >> -Mark
>> >>
>> >>
>> >>
>> >>> On Jun 22, 2017, at 8:56 AM, Andre <[email protected]> wrote:
>> >>>
>> >>> All,
>> >>>
>> >>> I was playing with the AvroSchemaRegistry and noticed it seems to not
>> >> play
>> >>> ball when the DFM pastes the schema into the dynamic property value.
>> >>>
>> >>> To test it I basically copied the demo schema from Mark's blog post[1]
>> >> and
>> >>> pasted into a NiFi 1.3.0 instance. To my surprise the controller would
>> >> not
>> >>> validate, instead it displayed:
>> >>>
>> >>> "was expecting double-quote to start field name"
>> >>>
>> >>> I also faced similar errors using the following schema:
>> >>>
>> >>>
>> >> https://github.com/fluenda/SecuritySchemas/blob/master/CEFRe
>> v23/cefRev23_nifi.avsc
>> >>>
>> >>> Has anyone else seen this?
>> >>>
>> >>> Cheers
>> >>
>> >>
>>
>>
>

Reply via email to