[
https://issues.apache.org/jira/browse/NIFI-13963?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ferenc Kis updated NIFI-13963:
------------------------------
Fix Version/s: 1.29.0
> Unknown fields not dropped by JSON Writer as expected by specified schema
> -------------------------------------------------------------------------
>
> Key: NIFI-13963
> URL: https://issues.apache.org/jira/browse/NIFI-13963
> Project: Apache NiFi
> Issue Type: Bug
> Affects Versions: 1.26.0, 1.27.0, 1.28.0
> Reporter: Daniel Stieglitz
> Assignee: Daniel Stieglitz
> Priority: Major
> Fix For: 1.29.0
>
> Time Spent: 1h 50m
> Remaining Estimate: 0h
>
> This is a back port of the fix introduced in NIFI-13843 for 2.x. This bug
> apparently was introduced in 1.26.0 in NIFI-13090 (which was a back port of
> NIFI-12480 for 2.x which probably was the cause of both NIFI-13843 and
> NIFI-13362) with the changes to _AbstractJsonRowRecordReader_ in method
> _createRecordFromRawValue_ which included a serialized form of the schema
> even with unknown fields in the following lines:
> {code:java}
> final SerializedForm serializedForm =
> SerializedForm.of(fieldNode::toString, "application/json");
> return new MapRecord(childSchema, childValues, serializedForm);
> }{code}
> Apparently the _WriteJsonResult_ which _JsonRecordSetWriter_ returns, always
> had the ability to write out the serialized form of the JSON as seen in
> method _writeRecord_
> {code:java}
> if (isUseSerializeForm(record, writeSchema)) {
> final String serialized = (String)
> record.getSerializedForm().get().getSerialized();
> generator.writeRawValue(serialized);
> return;
> }{code}
> but it seems it never did since the _AbstractJsonRowRecordReader_ never
> returned a serialized form of the JSON until 1.26.0. This explains how
> [~mosermw] in a comment on NIFI-13843 was able to see no issues when using
> nifi-record-serialization-services-nar-{*}1.25.0{*} for _JsonTreeReader_
> (which uses _JsonTreeRowRecordReader_ which extends
> {_}AbstractJsonRowRecordReader{_}) and
> nifi-record-serialization-services-nar-{*}1.26.0{*} for _JsonRecordSetWriter_
> but only saw issues with nifi-record-serialization-services-nar-{*}1.26.0{*}
> for _JsonTreeReader_ and nifi-record-serialization-services-nar-{*}1.26.0{*}
> for _JsonRecordSetWriter._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)