Skip to content

fix(spec): improve YAML validation error messages for skills, repos, and agents#100

Merged
albertodebortoli merged 1 commit into
mainfrom
yaml-format-error-reporting
Jul 22, 2026
Merged

fix(spec): improve YAML validation error messages for skills, repos, and agents#100
albertodebortoli merged 1 commit into
mainfrom
yaml-format-error-reporting

Conversation

@albertodebortoli

Copy link
Copy Markdown
Member

Description

  • Type-mismatch errors previously leaked Yams' internal node-shape names (Mapping, Sequence, Scalar) into the user-facing message (e.g. Type mismatch at 'repos': expected Mapping.). These are now translated to plain wording (a mapping (key: value pairs), a list, a single value (text, number, or boolean)).
  • Custom decoding errors thrown from within a model's init(from:) (e.g. Skill.SkillDecodingError.missingVersion, raised when neither the skill nor its repo alias specifies a version) were being swallowed into a generic fallback message, because Yams wraps any error escaping a custom initializer as DecodingError.dataCorrupted. The unwrap logic now recurses into any underlying error, not just DecodingErrors, so the specific message surfaces correctly.

Type of Change

  • Bug fix

How Has This Been Tested?

  • Added / updated unit tests (new fixtures + tests in SpecLoaderTests.swift covering: skill missing repository, repo missing url, wrong container shapes for repos/skills/agents entries, and missing version on both skill and repo alias)
  • swift test — 547 tests passing

Checklist

  • Swift code builds locally (swift build)
  • Tests pass locally (swift test)
  • Code style / formatting respected

Breaking Changes?

  • No

@albertodebortoli albertodebortoli added this to the 0.22.0 milestone Jul 22, 2026
@albertodebortoli albertodebortoli added the feature New feature or enhancement label Jul 22, 2026
Base automatically changed from skill-versioning to main July 22, 2026 12:09
…and agents

Type-mismatch errors leaked Yams' internal node-shape names (Mapping,
Sequence, Scalar) instead of user-facing wording, and custom decoding
errors thrown from within init(from:) (e.g. Skill.SkillDecodingError)
got swallowed into a generic fallback message because Yams wraps any
error escaping a custom initializer as dataCorrupted.
@albertodebortoli
albertodebortoli force-pushed the yaml-format-error-reporting branch from 7649464 to 2b4b53a Compare July 22, 2026 12:19
@albertodebortoli
albertodebortoli merged commit 4d257da into main Jul 22, 2026
2 checks passed
@albertodebortoli
albertodebortoli deleted the yaml-format-error-reporting branch July 22, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant