Context
YAML streams may contain multiple documents. PowerShell pipeline consumers often need exactly one document from a stream without manually enumerating and indexing output records.
Official YAML 1.2.2 references:
Current State
The module supports multi-document streams and emits one pipeline record per document. There is no dedicated document-selection parameter to request a single document by index.
Objective
Provide idiomatic single-document selection for conversion and file import while preserving default multi-document pipeline behavior.
PowerShell Design Considerations
- Use a clear parameter such as
-DocumentIndex rather than requiring users to pipe to Select-Object after parsing.
- Consider parameter-set interactions with
-AllDocuments style options in representation-preserving commands.
- Keep zero-based or one-based indexing explicit in help and errors; PowerShell arrays are zero-based, but user-facing document numbers need clarity.
- Validation should still parse enough of the stream to reject invalid later documents if the spec requires whole-stream validation.
Tasks
Benefits
- Makes multi-document usage easier in scripts.
- Avoids ambiguous post-processing of pipeline output.
- Provides a foundation for representation-preserving commands that address document roots.
Acceptance Criteria
Related
Context
YAML streams may contain multiple documents. PowerShell pipeline consumers often need exactly one document from a stream without manually enumerating and indexing output records.
Official YAML 1.2.2 references:
spec/Single-Document-Selection.mdCurrent State
The module supports multi-document streams and emits one pipeline record per document. There is no dedicated document-selection parameter to request a single document by index.
Objective
Provide idiomatic single-document selection for conversion and file import while preserving default multi-document pipeline behavior.
PowerShell Design Considerations
-DocumentIndexrather than requiring users to pipe toSelect-Objectafter parsing.-AllDocumentsstyle options in representation-preserving commands.Tasks
Benefits
Acceptance Criteria
Related
spec/Single-Document-Selection.md