Skip to content

Add opt-in tag and scalar resolvers #62

Description

Context

YAML uses tags to identify node types, and applications often define their own local or global tags. The module needs an explicit, safe extension point for callers that want to construct custom PowerShell values from application tags.

Official YAML 1.2.2 references:

Current State

The module constructs known standard tags and safely falls back for valid unknown tags. There is no public resolver parameter for caller-defined tag construction or custom plain-scalar resolution.

Objective

Provide opt-in tag and scalar resolver functionality that is idiomatic for PowerShell and safe by default.

PowerShell Design Considerations

  • Resolver parameters should be explicit and pipeline-safe; no YAML content should trigger code unless the caller supplied a resolver.
  • Scriptblock constructors should receive rich node information without leaking implementation-specific parser objects as the public contract.
  • Parameter sets should separate broad typed projection from tag-specific construction when needed, while still allowing advanced users to compose schema, hashtable, and resolver options.
  • Resolver errors should preserve the original error as inner context and include tag/location metadata.

Tasks

  • Add an opt-in tag resolver for explicit tag construction.
  • Add an opt-in scalar resolver for custom plain-scalar tag assignment.
  • Allow callers to override standard tag construction intentionally.
  • Ensure aliases do not invoke constructors more than once for the same anchored node.
  • Keep validation, duplicate-key checks, and resource limits in force before resolver invocation.
  • Document safe resolver patterns and common PowerShell object outputs.

Benefits

  • Enables application-specific YAML without forking the parser.
  • Preserves safe defaults for untrusted YAML.
  • Supports rich PowerShell objects where the caller explicitly asks for them.

Acceptance Criteria

  • A caller can construct a custom value for a valid application tag.
  • Unknown tags without a resolver keep the safe default behavior.
  • Resolver failures terminate with a stable resolver error and preserve original error context.
  • Invalid resolver keys and invalid scalar patterns are rejected before parsing data.
  • Resolvers compose predictably with schema selection and mapping projection options.

Related

  • Spec folder: spec/Tag-Resolution.md
  • Related safe default: spec/Unknown-Tag-Policy.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions