Phil-Factor / PSYaml

A Powershell module to convert YAML documents to and from PowerShell objects
MIT License
91 stars 32 forks source link

Does not properly convert nested lists #24

Open btusakul opened 6 years ago

btusakul commented 6 years ago

Given a file with this content:

- test1
-   - test2
    - test3

the expected output from piping this file's content to ConvertFrom-Yaml would be a list with 'test1' and a nested list with 'test2' and 'test3'. This should be the proper formatting for nested lists in YAML and converting this YAML file in Python, with the PyYAML module, exhibits this behavior.

However, the ConvertFrom-Yaml cmdlet returns a list with 'test1', 'test2', and 'test3'.

Phil-Factor commented 5 years ago

Yes, this is valid yaml and should be represented as you describe. it is missing the second '-' on that line. Unfortunately this is happening in aaubry's YamlDotNet library. Curiously, the parser appears to get it right but at some point the result is converted to a string array with three components.