Skip to content

fix: onError consistency, scalar shorthand tests, README docs for !reference/!reference-all shorthands#21

Merged
ryodine merged 2 commits intofeat/shorthandfrom
copilot/sub-pr-19
Mar 15, 2026
Merged

fix: onError consistency, scalar shorthand tests, README docs for !reference/!reference-all shorthands#21
ryodine merged 2 commits intofeat/shorthandfrom
copilot/sub-pr-19

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 15, 2026

Review feedback on the scalar shorthand feature for !reference and !reference-all identified three issues: error reporting inconsistency, missing test coverage, and stale README docs.

Changes

  • Error handling (src/Reference.ts, src/ReferenceAll.ts): Replaced throw new Error(...) with onError(...) callback in both scalar shorthand resolvers, aligning with the pattern used in all other tag resolvers (e.g., illegalReferenceOnSequence, illegalFlattenOnScalar).

  • Tests (test/parser.test.ts): Added 4 tests covering scalar shorthand for both tags:

    • Valid string path/glob resolves to correct Reference/ReferenceAll instance
    • Numeric literal is coerced to string by the YAML parser before reaching the resolver (documents the behavior — !reference 123 yields path: "123")
    # These now have test coverage:
    database: !reference "./config/database.yaml"
    configs:  !reference-all "./refs/*.yaml"
  • README (README.md): Added scalar shorthand syntax examples, updated the "Note" to reflect both mapping and shorthand forms are valid, and removed the outdated "Deterministic Behavior" bullet stating scalar syntax is rejected.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: ryodine <5068378+ryodine@users.noreply.github.com>
Copilot AI changed the title [WIP] Add shorthand for !reference and !reference-all tags fix: onError consistency, scalar shorthand tests, README docs for !reference/!reference-all shorthands Mar 15, 2026
Copilot AI requested a review from ryodine March 15, 2026 03:24
@ryodine ryodine marked this pull request as ready for review March 15, 2026 03:25
@ryodine ryodine merged commit 54e563e into feat/shorthand Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants