[ 
https://issues.apache.org/jira/browse/NIFI-4901?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gardella Juan Pablo updated NIFI-4901:
--------------------------------------
    Description: 
Given the following valid Avro Schema:
{code}
{
   "type":"record",
   "name":"foo",
   "fields":[
      {
         "name":"isSwap",
         "type":[
            "boolean",
            "null"
         ]
      }     
   ]
}
{code}

And the following JSON:
{code}
{
  "isSwap": {
    "boolean": true
  }
}
{code}
When it is trying to be converted to Avro using ConvertRecord fails with:
{{org.apache.nifi.serialization.MalformedRecordException: Successfully parsed a 
JSON object from input but failed to convert into a Record object with the 
given schema}}

Attached a repository to reproduce the issue and also included the fix:
* Run {{mvn clean test}} to reproduce the issue.
* Run {{mvn clean test -Ppatch}} to test the fix.       

  was:
Given the following valid Avro Schema:
{code}
{
   "type":"record",
   "name":"foo",
   "fields":[
      {
         "name":"isSwap",
         "type":[
            "boolean",
            "null"
         ]
      }     
   ]
}
{code}

And the following JSON:
{code}
{
  "isSwap": {
    "boolean": true
  }
}
{code}
When it is trying to be converted to Avro using ConvertRecord fails with:
{{org.apache.nifi.serialization.MalformedRecordException: Successfully parsed a 
JSON object from input but failed to convert into a Record object with the 
given schema}}

Attached a repository to reproduce the issue and also included the fix:
* Run mvn clean test to reproduce the issue.
* Run mvn clean test -Ppatch to test the fix.   


> Json to Avro using Record framework does not support union types with boolean
> -----------------------------------------------------------------------------
>
>                 Key: NIFI-4901
>                 URL: https://issues.apache.org/jira/browse/NIFI-4901
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 1.5.0
>         Environment: ALL
>            Reporter: Gardella Juan Pablo
>            Priority: Major
>         Attachments: optiona-boolean.zip
>
>
> Given the following valid Avro Schema:
> {code}
> {
>    "type":"record",
>    "name":"foo",
>    "fields":[
>       {
>          "name":"isSwap",
>          "type":[
>             "boolean",
>             "null"
>          ]
>       }     
>    ]
> }
> {code}
> And the following JSON:
> {code}
> {
>   "isSwap": {
>     "boolean": true
>   }
> }
> {code}
> When it is trying to be converted to Avro using ConvertRecord fails with:
> {{org.apache.nifi.serialization.MalformedRecordException: Successfully parsed 
> a JSON object from input but failed to convert into a Record object with the 
> given schema}}
> Attached a repository to reproduce the issue and also included the fix:
> * Run {{mvn clean test}} to reproduce the issue.
> * Run {{mvn clean test -Ppatch}} to test the fix.     



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to