Skip to content

1.1.0

Latest

Choose a tag to compare

@github-actions github-actions released this 07 Aug 21:04
8e37203

🚀 [Feature]: Parsed YAML documents render as YAML text (#72)

Parsed YAML mapping and sequence documents now describe themselves as YAML when converted to text. Users can inspect a parsed document with ToString() or string interpolation without losing normal property access, indexing, or scalar behavior.

New: Parsed documents render as YAML text

ConvertFrom-Yaml now returns mapping and sequence document roots that render back to YAML text through ToString(). This makes ad-hoc inspection easier in the console and keeps string interpolation useful for parsed document values.

$config = 'name: Ada' | ConvertFrom-Yaml
$config.ToString()
"name": "Ada"

Scalar documents keep their native text conversion. A parsed integer still renders as an integer, a parsed Boolean still renders as a Boolean, and a parsed string still renders as the string content.

Changed: Document roots keep object behavior

The rendered text reflects the current value, so edits made after parsing are visible when the document is rendered. The document marker used for rendering is not emitted as YAML content, and existing mapping property access, dictionary access, and sequence indexing continue to work as before.


Technical details
  • Added a failing-first test commit for document-root rendering before implementation.
  • ConvertFrom-Yaml decorates projected mapping and sequence document roots with the PSModule.Yaml.Document type name and a ToString() script method.
  • Rendering delegates to ConvertTo-Yaml at call time and trims the final newline so interactive text output is compact.
  • Scalars, null values, strings, chars, and byte arrays are not decorated, preserving native text conversion.
  • Top-level sequence enumeration decorates each emitted collection item; -NoEnumerate decorates the sequence document root.
  • Documentation updated in README.md, command help, and the conversion guide.
  • Verification: focused tests failed before implementation and pass after implementation; full tests/ConvertFrom-Yaml.Tests.ps1 passes locally; markdownlint passes for touched docs; PR CI is green after rerunning an external PowerShell Gallery 403 failure.
Surface Guidance Result
src/** PowerShell module source PSModule module source layout and PowerShell command behavior Aligned
tests/** Pester tests Failing-first coverage and regression verification Aligned
README.md and command guide docs User-facing release-note documentation Aligned
Relevant issues (or links)
  • No scoped issue; this is a small user-facing enhancement discovered during YAML behavior work.