[
https://issues.apache.org/jira/browse/NIFI-7969?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17298369#comment-17298369
]
ASF subversion and git services commented on NIFI-7969:
-------------------------------------------------------
Commit 4d64a71cd94361f390fb67bf9c4ce34959b279d7 in nifi's branch
refs/heads/support/nifi-1.13 from Peter Gyori
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=4d64a71 ]
NIFI-7969: ValidateRecord enhanced with Force Types From Schema property
NIFI-7969: Documentation update
Clarified that the Force Types From Schema property applies to the data read,
whereas the Strict Type Checking property applies to the validation.
NIFI-7969: Documentation update - updated the property name in
additionalDetails.html
This closes #4825.
Signed-off-by: Peter Turcsanyi <[email protected]>
> XMLReader / ValidateRecord: arrays are not read correctly
> ---------------------------------------------------------
>
> Key: NIFI-7969
> URL: https://issues.apache.org/jira/browse/NIFI-7969
> Project: Apache NiFi
> Issue Type: Bug
> Components: Core Framework, Extensions
> Affects Versions: 1.9.0, 1.12.0
> Reporter: Vesa Sokka
> Assignee: Peter Gyori
> Priority: Major
> Labels: records, validation, xml
> Fix For: 1.14.0, 1.13.1
>
> Attachments: image-2020-10-30-13-09-08-833.png, xml_array.xml
>
> Time Spent: 1h
> Remaining Estimate: 0h
>
> I'm trying to convert XML to JSON with ValidateRecord using XMLReader. Arrays
> with multiple elements work fine, but an *array with only one element fails*.
>
> In XMLReader docs it says clearly:
> _"If a field in a schema is embedded in an array, the *reader expects zero,
> one or more* occurrences of the field in a record. "_
> But in fact an array with only one field is transferred to "invalid" with an
> error message:
> "Record #1 is invalid due to:
> content1 is not a valid value for /array_field: Value is of type
> java.lang.String but was expected to be of type ARRAY[STRING]"
>
> examples modified from:
>
> [https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-record-serialization-services-nar/1.12.1/org.apache.nifi.xml.XMLReader/additionalDetails.]
> !image-2020-10-30-13-09-08-833.png|height=250!
> _Both examples have same schema_;
> {code:json}
> {
> "namespace": "nifi",
> "name": "test",
> "type": "record",
> "fields": [
> { "name": "array_field",
> "type":
> { "type": "array", "items": "string" }
> }
> ]
> }
> {code}
>
>
> *Example 1* (success)
> {code:xml}
> <record>
> <array_field>content1</array_field>
> <array_field>content2</array_field>
> </record> {code}
> --> *valid*+:+
> {code:json}
> [{"array_field":["content1","content2"]}]
> {code}
>
> *Example 2* (invalid):
> Same as example 1, but the second array_field removed
> {code:xml}
> <record>
> <array_field>content1</array_field>
> </record>
> {code}
> --> *invalid*
> {code:json}
> [{"array_field":"content1"}]{code}
>
>
> *Seems to be a BUG or is this an error in the processor documentation?*
>
> Template attached:
> xml_array.xml
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)