dan-s1 commented on PR #7665:
URL: https://github.com/apache/nifi/pull/7665#issuecomment-1764511710

   > > @exceptionfactory I am trying to rework my code to handle the changes 
made in #7823 for NIFI-12153. What I am discovering is that YAML supports 
comments and there is no way to turn off parsing of comments. In addition I am 
trying to mimic `TestJsonTreeRowRecordReader#testReadJSONStringTooLong` and I 
am trying to use `StreamReadConstraints.builder().maxStringLength(1).build()` 
yet no exception is thrown even though I have strings longer than one character 
long. It would seem that aspect only works for Json parsing and not Yaml 
parsing. I did find the following article [How to parse large YAML file in Java 
or 
Kotlin](https://stackoverflow.com/questions/74805240/how-to-parse-large-yaml-file-in-java-or-kotlin)
 which would seem to handle larger Yaml files but I am not sure if that is the 
same setting as `StreamReadConstraints.builder().maxStringLength(1).build()`. 
Please advise.
   > 
   > Thanks for the details @dan-s1. If the YAML implementation does not 
support the same constraints, then I recommend not including those property 
descriptors on the YAML Record Reader implementation.
   
   @exceptionfactory Then would it be okay to have in `YamlTreeReader` code 
like:
   
   ```
   @Override
       protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
           final List<PropertyDescriptor> properties = new 
ArrayList<>(super.getSupportedPropertyDescriptors());
           //NOTE: Remove those properties which are not applicable for Yaml.
           properties.remove(AbstractJsonRowRecordReader.MAX_STRING_LENGTH);
           properties.remove(AbstractJsonRowRecordReader.ALLOW_COMMENTS);
           
           return properties;
       }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to