yaml-path / YamlPath

Apache License 2.0
20 stars 5 forks source link

write method return void #82

Closed moqimoqidea closed 1 year ago

moqimoqidea commented 1 year ago

hello, the code is:

public void write(String path, Object replacement) {
    readAndReplace(path, replacement);
}

but on readme, it show:

String newYamlContent = YamlPath.from(file)
        .write("metadata.name", "another-name!")
        .dumpAsString();
// Output of newYamlContent is:
//        ---
//        apiVersion: apps/v1
//        kind: Deployment
//        metadata:
//          name: another-name!

I think the update of the api may cause the write pipeline in the example to fail to run. Do we need to update the way to use write or update the api? thank you.

Sgitario commented 1 year ago

Thanks for reporting! The initial intention was to return the parser, so users can perform multiple write in the same line. Update of the API in: https://github.com/yaml-path/YamlPath/pull/83