Skip to content
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

XML array with one member is not detected as array #280

Open
yorickdowne opened this issue Dec 28, 2022 · 1 comment
Open

XML array with one member is not detected as array #280

yorickdowne opened this issue Dec 28, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@yorickdowne
Copy link

Describe the bug

dasel v2.0.2. This is present in 1.x as well.

Create array with one entry:
dasel put -f NLog.config -r xml -w xml -t json 'nlog.rules.logger' -v '{"-name":"JsonWebAPI.Microsoft.Extensions.Diagnostics.HealthChecks.DefaultHealthCheckService","-maxlevel":"Error","-final":" true"}'

And try to append:
dasel put -f NLog.config -r xml -w xml -t json 'nlog.rules.logger.[]' -v '{"-name":"JsonWebAPI*","-minlevel":"Error","-writeTo":"auto-colored-console-async","-final":"true"}'

results in error:
Error: cannot use append selector on non slice/array types

Expected behavior

Dasel can append to an array with just one member

Additional context

Workaround: Create an array with two members first.
dasel put -f NLog.config -r xml -w xml -t json 'nlog.rules.logger' -v '{"-name":"JsonWebAPI.Microsoft.Extensions.Diagnostics.HealthChecks.DefaultHealthCheckService","-maxlevel":"Error","-final":"true"}{"-name":"JsonWebAPI*","-minlevel":"Error","-writeTo":"file-async","-final":"true"}'

The same append will then work.
NLog.config.txt

@yorickdowne yorickdowne added the bug Something isn't working label Dec 28, 2022
@TomWright
Copy link
Owner

I need to improve the documentation in V2 around this, but it is documented in V1: https://daseldocs.tomwright.me/v/v1/usage/supported-file-types#arrays-lists

This is due to the XML parser used and there isn't any known workaround for it right now. I'll keep this open as a reminder to do some digging to see if I can find a solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants