[
https://issues.apache.org/jira/browse/NIFI-11197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17761383#comment-17761383
]
Daniel Stieglitz commented on NIFI-11197:
-----------------------------------------
[~exceptionfactory] I believe I found a simpler way where I was able to reuse
much of JsonRecordSource, JsonTreeRowRecordReader and JsonTreeReader. I ended
up creating an interface which encapsulates the creation of a JsonParser and I
have two implementations one for Json and for Yaml so they each use
JsonFactory/ObjectMapper or YamlFactory/YamlMapper. I have created
YamlRecordSource and YamlTreeRowRecordReader to extend JsonRecordSource and
JsonTreeRowRecordReader adding an argument to the constructor to take an
instance of the interface in order to create a JsonParser.
I made a YamlTreeRowRecordReader class which extends JsonTreeRowRecordReader
and uses all if its functionality. I was not sure if this is overkill but I
duplicated the TestJsonTreeRowRecordReader to a new class
TestYamlTreeRowRecordReader and created Yaml files from all the json files and
ran the tests. However there were four tests which I did not think make any
sense for Yaml and I would like to get your opinion on them.
# testReadMixedJSON (I tried a mixed file with an array and an object and I
got a Yaml parsing error)
# testReadMultilineArrays (In Yaml I believe the two arrays will appear as one)
# testReadMultilineJSON (Creating two object next to each other in Yaml will
appear as one big object in Yaml)
# testReadOneLinePerJSON ( I do not think Yaml has a concept of one document
per line)
Please advise. Thanks!
> Add YAML Record Reader
> ----------------------
>
> Key: NIFI-11197
> URL: https://issues.apache.org/jira/browse/NIFI-11197
> Project: Apache NiFi
> Issue Type: Improvement
> Components: Extensions
> Affects Versions: 1.20.0
> Reporter: macdoor615
> Assignee: Daniel Stieglitz
> Priority: Major
>
> The yaml format is basically equivalent to json. When used as a configuration
> file, it is much more convenient than json. It can have comments and the file
> is shorter.
> More and more systems adopt yaml format. Now we developed a conversion tool
> from yaml to json with the ExecuteGroovyScript processor.
> It is recommended to add a processor that can convert between yaml and json
--
This message was sent by Atlassian Jira
(v8.20.10#820010)