Skip to content

fix: CLI validate now accepts YAML/TOML specs - #3

Merged
mansurarief merged 3 commits into
mainfrom
fix/cli-validate-yaml-support
Apr 17, 2026
Merged

fix: CLI validate now accepts YAML/TOML specs#3
mansurarief merged 3 commits into
mainfrom
fix/cli-validate-yaml-support

Conversation

@mansurarief

@mansurarief mansurarief commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Bug: vnvspec validate was hardcoded to json.loads(), failing on YAML/TOML spec files with a misleading error
  • Fix: Added Spec.from_file(path) that auto-detects format by extension, and rewired CLI validate to use it
  • Specs: Added REQ-SELF-CLI-002 and REQ-SELF-IO-002 to self-spec
  • Tests: 10 new tests (5 for Spec.from_file(), 5 for CLI validate multi-format)

Test plan

  • All 575 tests pass (10 new)
  • vnvspec validate .vnvspec/self-spec.yaml works correctly
  • Verify CI passes

The `vnvspec validate` command was hardcoded to use `json.loads()`,
causing it to fail on YAML and TOML spec files with a misleading
"Spec validation error" message. This was inconsistent with the
programmatic API which already supported all three formats.

Changes:
- Add `Spec.from_file(path)` classmethod that auto-detects format
  by file extension (.yaml/.yml, .json, .toml)
- Rewrite CLI validate to use `Spec.from_file()` instead of raw
  `json.loads()`
- Add REQ-SELF-CLI-002 and REQ-SELF-IO-002 to self-spec
- Add 10 new tests covering from_file and CLI multi-format support
@codecov

codecov Bot commented Apr 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@mansurarief
mansurarief merged commit cb1b898 into main Apr 17, 2026
5 checks passed
@mansurarief
mansurarief deleted the fix/cli-validate-yaml-support branch April 17, 2026 19:18
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.

1 participant