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

Add option to return PSCustomObjects #138

Conversation

gabriel-samfira
Copy link
Member

@gabriel-samfira gabriel-samfira commented Aug 26, 2024

This change adds a new option to return PSCustomObjects instead of hashtables. The same option makes powershell-yaml output arrays instead of generic lists.

The new option is called -AsHashtable. By default it's set to true, as not to change the current default and prevent breaking any expectations.

However, you can change the default by setting:

$PSDefaultParameterValues=@{
    "ConvertFrom-Yaml:AsHashtable"=$false
    "cfy:AsHashtable"=$false
}

Anywhere in your script, before calling the powershell-yaml commandlets.

Fixes: #85

This change adds a new option to return PSCustomObjects instead of
hashtables. The same option makes powershell-yaml output arrays
instead of generic lists.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
@gabriel-samfira
Copy link
Member Author

As mentioned in #85 (comment), using PSCustomObjects will break unserializing YAML that contain case sensitive keys (eg: "a":1 vs "A":2). Dropping this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Work with PSCustomObjects instead of hashtables
1 participant