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

Eric Secules updated NIFI-7636:
-------------------------------
    Description: 
When there is a avro Validation Error in an element of a JSON array the array 
index is placed before the array's name in the path. For example if the input 
JSON was this:
{code:java}
{
  "myArray": [
    {
      "myValue": null
    }
  ]
}
{code}
 and "myValue" was required

 the validation error would be:

 
{code:java}
{
  "fieldName" : "[0]/myArray/myValue",
  "inputValue" : null,
  "explanation" : "Field is required",
  "type" : "MISSING_FIELD"
}
{code}
It would make more sense if the array index was after the array field name like 
so. Placing the array index before the array doesn't make any sense to me.
{code:java}
{ 
  "fieldName" : "/myArray[0]/myValue",
  "inputValue" : null,
  "explanation" : "Field is required",
  "type" : "MISSING_FIELD"
}

{code}
or if the field name was made using JSONPath syntax like:
{code:java}
{ 
  "fieldName" : "$.myArray[0].myValue",
  "inputValue" : null,
  "explanation" : "Field is required",
  "type" : "MISSING_FIELD"
} 
{code}
 

  was:
When there is a avro Validation Error in an element of a JSON array the array 
index is placed before the array's name in the path. For example if the input 
JSON was this:
{code:java}
{
  "myArray": [
    {
      "myValue": null
    }
  ]
}
{code}
 and "myValue" was required

 the validation error would be:

 
{code:java}
{
  "fieldName" : "[0]/myArray/myValue",
  "inputValue" : null,
  "explanation" : "Field is required",
  "type" : "MISSING_FIELD"
}
{code}
It would make more sense if the array index was after the array field name like 
so. Placing the array index before the array doesn't make any sense to me.
{code:java}
{ 
  "fieldName" : "/myArray/[0]/myValue",
  "inputValue" : null,
  "explanation" : "Field is required",
  "type" : "MISSING_FIELD"
}

{code}
or if the field name was made using JSONPath syntax like:
{code:java}
{ 
  "fieldName" : "$.myArray[0].myValue",
  "inputValue" : null,
  "explanation" : "Field is required",
  "type" : "MISSING_FIELD"
} 
{code}
 


> Validate Record Prints Array Paths in Confusing Way
> ---------------------------------------------------
>
>                 Key: NIFI-7636
>                 URL: https://issues.apache.org/jira/browse/NIFI-7636
>             Project: Apache NiFi
>          Issue Type: Bug
>    Affects Versions: 1.11.4
>            Reporter: Eric Secules
>            Priority: Major
>
> When there is a avro Validation Error in an element of a JSON array the array 
> index is placed before the array's name in the path. For example if the input 
> JSON was this:
> {code:java}
> {
>   "myArray": [
>     {
>       "myValue": null
>     }
>   ]
> }
> {code}
>  and "myValue" was required
>  the validation error would be:
>  
> {code:java}
> {
>   "fieldName" : "[0]/myArray/myValue",
>   "inputValue" : null,
>   "explanation" : "Field is required",
>   "type" : "MISSING_FIELD"
> }
> {code}
> It would make more sense if the array index was after the array field name 
> like so. Placing the array index before the array doesn't make any sense to 
> me.
> {code:java}
> { 
>   "fieldName" : "/myArray[0]/myValue",
>   "inputValue" : null,
>   "explanation" : "Field is required",
>   "type" : "MISSING_FIELD"
> }
> {code}
> or if the field name was made using JSONPath syntax like:
> {code:java}
> { 
>   "fieldName" : "$.myArray[0].myValue",
>   "inputValue" : null,
>   "explanation" : "Field is required",
>   "type" : "MISSING_FIELD"
> } 
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to