-
-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing support for multiple yaml documents in a single file. #66
Comments
Does not work in what sense? Note that since they are separate logical documents, you can not read into a single value, but you can construct a So perhaps this could be usage issue. |
For those not familiar with YAMLFactory yaml;
ObjectMapper mapper;
YAMLParser yamlParser = yaml.createParser("file-with-multiple-docs.yaml")
List<ObjectNode> docs =
mapper
.readValues[ObjectNode](yamlParser, new TypeReference[ObjectNode] {})
.readAll(); |
@zcourts thank you for sharing this! Yes, that is the way (from Scala in this example?). |
How does this work for serialisation? |
@teabot You would use So something like SequenceWriter sw = mapper.writer().writeValues(outputStream); |
@cowtowncoder I am trying to serialize into multi docs, but not successful. Here is my code :
|
@piyushkumar13 Could you please file a new issue with title of something like "Can not write multi-document YAML output" or something, with that example, ref to this issue? Btw, that |
@cowtowncoder Sure. will raise a separate issue. Thanks for replying. |
In order to manage documents with Array at the root (instead of Object as the common case), we went with
|
Thank you @blacelle! I think nominal type |
yaml spec v1.2 contained information about files with multiple documents:
http://www.yaml.org/spec/1.2/spec.html
Example:
Example with
...
:The above-mentioned structures are not supported by object mapper at the moment.
The text was updated successfully, but these errors were encountered: