Skip to content

SequenceWriter does not create multiple docs in a single yaml file #163

@piyushkumar13

Description

@piyushkumar13

Hi,
I am trying to use SequenceWriter as suggested here to serial objects to multidocs but unsuccessful in doing do. Here is my code :

File directory = new File("src/main/resources/output");
        String fileName = "output-multidocs.yaml";

        try(SequenceWriter sequenceWriter = mapper.writer().writeValues(new File(directory, fileName))){
            sequenceWriter.init(true);
            sequenceWriter.writeAll(detailsList); // detailsList is an arrayList of object. 
            sequenceWriter.writeAll(detailsList); // Expectation is this would create separate doc in the same yaml file. But it was appending to above list.

        }catch (Exception e){
            e.printStackTrace();
        }

Could you please advice me the way to serialize objects into multidocs in a single yaml file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    yamlIssue related to YAML format backend

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions