[
https://issues.apache.org/jira/browse/NIFI-11577?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Daniel Stieglitz resolved NIFI-11577.
-------------------------------------
Resolution: Won't Fix
This is not an issue and is actually addressed in example 2 in the [additional
details|https://nifi.apache.org/components/org.apache.nifi.processors.standard.ValidateRecord/]
of the ValidateRecord processor. In the reporter's case, job_requisition per
the given schema is of type array but in the XML it can only be represented as
a single object. Hence it depends whether the property "Force Types From Reader
Schema" in ValidateRecord is set to true or false. If set to true then
job_requisition will be treated as an array and validation will pass yet if it
is set to false it will be treated as a single object and fail validation.
> ValidateRecord fails to validate XML record of record and attributes;
> ConvertRecord recognises just fine
> --------------------------------------------------------------------------------------------------------
>
> Key: NIFI-11577
> URL: https://issues.apache.org/jira/browse/NIFI-11577
> Project: Apache NiFi
> Issue Type: Bug
> Components: Extensions
> Reporter: crissaegrim
> Assignee: Bryan Bende
> Priority: Major
> Attachments: image-2023-05-21-08-08-48-669.png
>
>
> h1. Input Data
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <wd:Report_Entry xmlns:wd="urn:com.workday.report/foo">
> <wd:Req_ID>REQ-7602</wd:Req_ID>
> <wd:Job_Requisition Descriptor="REQ-7602 Trader (Open)">
> <wd:ID type="WID">91384a20a89001a955bb7ded1401271f</wd:ID>
> <wd:ID type="Job_Requisition_ID">REQ-7602</wd:ID>
> </wd:Job_Requisition>
> <wd:wd:Report_Entry>
> {code}
> h1. Schema (avro)
> {code:json}
> {
> "type" : "record",
> "name" : "PendingHiresEntryType",
> "namespace" : "ns",
> "fields" : [ {
> "name" : "requisition_id",
> "type" : [ "null", "string" ],
> "default" : null,
> "aliases" : [ "Req_ID" ]
> }, {
> "name" : "job_requisition",
> "type" : [ "null", {
> "type" : "array",
> "items" : {
> "type" : "record",
> "name" : "WdDescribedIdType",
> "fields" : [ {
> "name" : "id_field",
> "type" : [ "null", {
> "type" : "array",
> "items" : {
> "type" : "record",
> "name" : "WdAttributedIdType",
> "fields" : [ {
> "name" : "content_value",
> "type" : [ "null", "string" ]
> }, {
> "name" : "type",
> "type" : "string"
> } ]
> }
> } ],
> "default" : null,
> "aliases" : [ "ID" ]
> }, {
> "name" : "description",
> "type" : [ "null", "string" ],
> "default" : null,
> "aliases" : [ "Descriptor" ]
> } ]
> }
> } ],
> "default" : null,
> "aliases" : [ "Job_Requisition" ]
> } ]
> }
> {code}
> h1. Expected Output
> It should successfully validate the record. Whereas `ConvertRecord` will
> successfully parse the record according to schema, `ValidateRecord` will
> report a failure.
> h1. Actual Output
> !image-2023-05-21-08-08-48-669.png!
> h1. Output Data of ConvertRecord (using same schema, no changes)
> {code:xml}
> <?xml version="1.0" ?>
> <PendingHiresEntryType>
> <requisition_id>REQ-7602</requisition_id>
> <job_requisition>
> <id_field>
> <content_value>91384a20a89001a955bb7ded1401271f</content_value>
> <type>WID</type>
> </id_field>
> <id_field>
> <content_value>REQ-7602</content_value>
> <type>Job_Requisition_ID</type>
> </id_field>
> <description>REQ-7602 Trader (Open)</description>
> </job_requisition>
> </PendingHiresEntryType>
> {code}
> h1. Schema (IDL)
> {code:java}
> record WdAttributedIdType {
> string? content_value;
> string type;
> }
> record WdDescribedIdType {
> union {null, array<WdAttributedIdType>} @aliases(["ID"]) id_field = null;
> string? @aliases(["Descriptor"]) description = null;
> }
> record PendingHiresEntryType {
> string? @aliases(["Req_ID"]) requisition_id = null;
> union { null, array<WdDescribedIdType> } @aliases(["Job_Requisition"])
> job_requisition = null;
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)