[
https://issues.apache.org/jira/browse/NIFI-16021?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18098265#comment-18098265
]
ASF subversion and git services commented on NIFI-16021:
--------------------------------------------------------
Commit 259c58eb1e1bb2e187cb649d7b99d06e39accfca in nifi's branch
refs/heads/main from dan-s1
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=259c58eb1e1 ]
NIFI-16021 Improved JoltTransformJSON invalid specification messaging (#11426)
- Improved JoltTransformJSON error message when specified JOLT spec is invalid
and ensured leading single and multi-line Java comments are supported when the
Jolt spec is specified as text. Also added tests to ensure ValidateJson causes
Json parsing exception when any Java comments is specified before or inside a
schema.
Signed-off-by: David Handermann <[email protected]>
> JoltTransformJSON and ValidateJson do not allow for leading multi-line Java
> comment in Jolt spec and validation schema
> ----------------------------------------------------------------------------------------------------------------------
>
> Key: NIFI-16021
> URL: https://issues.apache.org/jira/browse/NIFI-16021
> Project: Apache NiFi
> Issue Type: Bug
> Reporter: Daniel Stieglitz
> Assignee: Daniel Stieglitz
> Priority: Major
> Time Spent: 1h 10m
> Remaining Estimate: 0h
>
> JoltTransformJSON allows for multi-line Java comment anywhere in the Jolt
> spec except for the leading line when the Jolt Spec is specified as text (not
> with a file path). The error message is not really helpful as to what the
> issue is, as seen with the following error message
> {code:java}
> 'Jolt Specification' is invalid because Specification not valid for the
> selected transformation: Read JOLT Transform failed{code}
> but ultimately the cause of the error is a java.io.FileNotFoundException.
> On the other hand, ValidateJson does not allow for any type of comments, as
> the com.fasterxml.jackson.databind.ObjectMapper it uses for creating Json
> schemas object uses strict parsing and does not allow for Java comments.
> There should be a com.fasterxml.jackson.core.JsonParseException thrown if a
> comment is used before the actual schema
> {code:java}
> // Single line Java comment
> {
> "$schema": "https://json-schema.org",
> "type": "object",
> "additionalProperties": true
> }
> /*
> Multi-line Java comment
> */
> {
>
> "$schema": "https://json-schema.org",
> "type": "object",
> "additionalProperties": true
> } {code}
> or inside the schema
> {code:java}
> {
> // Single line Java comment
> "$schema": "https://json-schema.org",
> "type": "object",
> "additionalProperties": true
> }
> {
> // Multi-line Java comment
> "$schema": "https://json-schema.org",
> "type": "object",
> "additionalProperties": true
> } {code}
> yet when there is leading multi-line Java comment the error thrown is
> java.io.FileNotFoundException.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)