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

🌟 [Major]: Introducing the Yaml module #6

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

MariusStorhaug
Copy link
Member

@MariusStorhaug MariusStorhaug commented Feb 27, 2025

Description

This pull request includes the addition of several new PowerShell functions to handle YAML processing, including conversion, merging, and validation. The changes also include corresponding tests to ensure the functionality of these new features. The most important changes are summarized below:

YAML Processing Functions:

  • ConvertFrom-Yaml:
    • Added a function to convert a YAML string to a PSCustomObject.
  • ConvertTo-Yaml:
    • Added a function to convert a PSCustomObject to a YAML string.

YAML Merging and Exporting:

  • Merge-Yaml:
    • Added a function to merge multiple YAML strings into one, with the ability to override values.
  • Export-Yaml:
    • Added a function to export a PowerShell object to a YAML file.
  • Import-Yaml:
    • Added a function to import a YAML file and convert it to a PowerShell object.

YAML Validation:

  • Test-Yaml:
    • Added a function to test the syntax of a YAML string and optionally validate it against a schema.

Testing:

  • tests/Yaml.Tests.ps1:
    • Added comprehensive tests for the YAML conversion functions, including tests for scalar values, nested structures, arrays, and handling of comments in YAML.

Private functions

  • Convert-YamlBlock:
    • Added a function to convert a block of YAML text into a PowerShell object, handling both sequences and mappings.
  • Convert-YamlValue:
    • Added a helper function to parse a scalar YAML value and return the appropriate PowerShell type.

Type of change

  • 📖 [Docs]
  • 🪲 [Fix]
  • 🩹 [Patch]
  • ⚠️ [Security fix]
  • 🚀 [Feature]
  • 🌟 [Breaking change]

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

@MariusStorhaug MariusStorhaug self-assigned this Feb 27, 2025
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.

1 participant