Context
YAML 1.2.2 defines the %YAML and %TAG directives, reserves all other directives, and specifies how processors should handle version compatibility and unknown directives. Directive handling is a conformance boundary because it determines whether a document version can be processed and how tag shorthands expand.
Official YAML 1.2.2 references:
Current State
The module parses directive blocks, supports TAG handles, rejects malformed directives and duplicate tag handles, and rejects YAML major versions other than 1. It currently accepts every %YAML 1.x version without distinguishing YAML 1.0 from YAML 1.1/1.2/higher minor versions, and reserved directives are ignored without warning.
Objective
Make directive handling explicit, testable, and aligned with YAML 1.2.2 while preserving idiomatic PowerShell pipeline behavior.
PowerShell Design Considerations
- Warnings for accepted-but-not-exactly-1.2 documents should use normal PowerShell warning streams and must not change Boolean validation results.
Test-Yaml should remain a clean Boolean validation surface; warnings may be observable but must not be encoded as success/failure.- Unsupported versions should produce a stable, specific error identifier so automation can distinguish version refusal from malformed syntax.
- Parameter sets should not be added just to control directive parsing unless a future compatibility mode is introduced; default conformance should be clear.
Tasks
Benefits
- Aligns stream version handling with YAML 1.2.2 processor requirements.
- Gives script authors meaningful warnings without making valid documents fail validation.
- Makes future compatibility modes easier to add without changing current defaults.
Acceptance Criteria
Related
- Spec folder:
spec/Directive-Handling.md
Context
YAML 1.2.2 defines the
%YAMLand%TAGdirectives, reserves all other directives, and specifies how processors should handle version compatibility and unknown directives. Directive handling is a conformance boundary because it determines whether a document version can be processed and how tag shorthands expand.Official YAML 1.2.2 references:
docs/yaml-spec-1.2.2/07-chapter-structural-productions/08-directives/index.mdspec/Directive-Handling.mdCurrent State
The module parses directive blocks, supports
TAGhandles, rejects malformed directives and duplicate tag handles, and rejects YAML major versions other than1. It currently accepts every%YAML 1.xversion without distinguishing YAML 1.0 from YAML 1.1/1.2/higher minor versions, and reserved directives are ignored without warning.Objective
Make directive handling explicit, testable, and aligned with YAML 1.2.2 while preserving idiomatic PowerShell pipeline behavior.
PowerShell Design Considerations
Test-Yamlshould remain a clean Boolean validation surface; warnings may be observable but must not be encoded as success/failure.Tasks
%YAML,%YAML 1.2, and%YAML 1.1documents under YAML 1.2 processing rules.%YAML 1.xversions with a PowerShell warning.%YAMLdirectives and duplicate%TAGhandles.Benefits
Acceptance Criteria
%YAML 1.1parses with YAML 1.2 scalar resolution; YAML 1.1-only boolean words remain strings.%YAML 1.3parses successfully and emits a warning.%YAML 2.0and%YAML 1.0terminate with an unsupported-version error.Test-Yamlreturns$truefor warning-only directive cases and$falsefor rejected directive cases.Related
spec/Directive-Handling.md