Open jdimeo opened 4 years ago
Hmmh. Yes, that looks like it ought to prevent start marker from being written. Thank you for reporting this, I will need to have a look!
One thing that might help is if you could try a work-around of explicitly creating YAMLFactory
, configuring setting, constructing YAMLMapper
with it -- I suspect this might be related to writer not applying settings correctly.
Ok, I can reproduce this issue. I also realized that it may be tricky to fix with 2.x, the problem being that the document start marker is being written during construction of YAMLGenerator
whereas ObjectWriter
passes its settings right after construction but (supposedly) before actual output. 3.x (master
) solves this initialization problem but that required bigger refactoring.
I'll have to think of how to tackle this.
You may be able to work around this issue by pre-configuring YAMLFactory
however:
YAMLMapper mapper = new YAMLMapper(YAMLFactory.builder()
.disable(YAMLGenerator.Feature.WRITE_DOC_START_MARKER)).build());
in which case setting is used as expected.
Thank you so much for your fast response! I can definitely wait for 3.x and/or use YAMLFactory
in the meantime.
Ok good. I hope I'll address this for 2.12(.0).
Unfortunately it seems unlikely this can be fixed for 2.x.
Work-around mentioned above does, however, work: that is, configuring YAMLFactory
directly works
I feel like I may be using the APIs incorrectly, but I can't figure out what I'm doing wrong. The following code:
still puts the
---
at the beginning of the string.I'm using version 2.11.2
P.S. YAML support is a game. changer. Huge fan and huge thanks!