yaml-path / YamlPath

Apache License 2.0
20 stars 5 forks source link

YamlPath not using list node names. #96

Closed jamesoneill closed 1 year ago

jamesoneill commented 1 year ago

I have some YAMLPATH with values as described. [applications.name=my-app, applications.routes[0].route=example.com, applications.routes[1].route=www.example.com/foo, applications.routes[2].route=tcp-example.com:1234, applications.env.greeting=hello, applications.env.BUNDLE_WITHOUT=test:development, stuff=other]

This is my base yaml file:

When i apply my YAMLPATH using write method i get:

Im wondering why the route name gets dropped completely it feels like this should replace the routes element name route as well as the value.

Sgitario commented 1 year ago

Thanks for reporting! Can you share the write call you are doing (with the arguments) to help me understand what is going on?

jamesoneill commented 1 year ago

Yes of course,

data in this case is the serialised Map below: [applications.name=my-app, applications.routes[0].route=example.com, applications.routes[1].route=www.example.com/foo, applications.routes[2].route=tcp-example.com:1234, applications.env.greeting=hello, applications.env.BUNDLE_WITHOUT=test:development, stuff=other]

for(Map.Entry<String, String> entry: data.entrySet()) { yaml.write(entry.getKey(), entry.getValue()); }

Sgitario commented 1 year ago

Yet I can't see what is going on. Can you share a simple reproducer please?

Sgitario commented 1 year ago

Yet I can't see what is going on. Can you share a simple reproducer please?

Never mind. I think I was able to reproduce it.

Sgitario commented 1 year ago

https://github.com/yaml-path/YamlPath/pull/97 should fix this issue.