Skip to content

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

Merged
Marius Storhaug (MariusStorhaug) merged 2 commits into
mainfrom
feat/yaml-document-tostring
Aug 7, 2026
Merged

🚀 [Feature]: Parsed YAML documents render as YAML text#72
Marius Storhaug (MariusStorhaug) merged 2 commits into
mainfrom
feat/yaml-document-tostring

Conversation

@MariusStorhaug

@MariusStorhaug Marius Storhaug (MariusStorhaug) commented Aug 7, 2026

Copy link
Copy Markdown
Member

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.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Super-linter summary

Language Validation result
CHECKOV Pass ✅
GITHUB_ACTIONS Pass ✅
GITLEAKS Pass ✅
GIT_MERGE_CONFLICT_MARKERS Pass ✅
MARKDOWN Pass ✅
NATURAL_LANGUAGE Pass ✅
POWERSHELL Pass ✅
PRE_COMMIT Pass ✅
SPELL_CODESPELL Pass ✅
TRIVY Pass ✅
YAML Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

@MariusStorhaug Marius Storhaug (MariusStorhaug) changed the title feat: render parsed YAML documents with ToString 🚀 [Feature]: Parsed YAML documents render as YAML text Aug 7, 2026
@MariusStorhaug
Marius Storhaug (MariusStorhaug) merged commit 8e37203 into main Aug 7, 2026
131 of 134 checks passed
@MariusStorhaug
Marius Storhaug (MariusStorhaug) deleted the feat/yaml-document-tostring branch August 7, 2026 20:54
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

✅ New release: PowerShell Gallery - Yaml 1.1.0

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

✅ New release: GitHub - Yaml 1.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant