feat: improve validation error messages for invalid YAML specs#27
Open
aicontentcreate2023-star wants to merge 1 commit intoprime-vector:mainfrom
Open
Conversation
Fixes prime-vector#24 Summary: Enhance validation error messages to be more descriptive and actionable. Error messages now include: - The specific field that failed validation - The actual type received vs expected type - Example of correct format - For missing tools, list of available tool IDs Changes: - oas_cli/validators.py: * _validate_version(): Show actual type, provide example format * _validate_agent(): Check for missing section, show examples * _validate_behavioural_contract(): Improved type mismatch messages * _validate_tools(): Show array indices, actual types, examples * _validate_tasks(): List available tools when reference fails, show examples for input/output schemas - tests/test_validation_errors.py (NEW): * Test missing fields show helpful messages * Test type mismatches show actual vs expected * Test array errors include item indices * Test tool references show available options * Verify consistent error message format Before: ValueError: agent.name must be a string After: ValueError: Field 'agent.name' must be a string, got int. Example: agent: name: "my-agent" Benefits: - New users get immediate guidance on how to fix errors - Reduced guesswork when debugging invalid specs - Faster development cycle (clear error → quick fix) - Better developer experience overall
|
Someone is attempting to deploy a commit to the Andrew's projects Team on Vercel. A member of the Team first needs to authorize it. |
sgriffiths
added a commit
that referenced
this pull request
Mar 11, 2026
Resolves the conflict from PR #27 (by Chu Julung) by applying enhanced error message patterns to the current validator codebase. All errors now show the actual type received, expected type, field path, and YAML examples. Tool/task reference errors list available options. Co-authored-by: Chu Julung <chujulung@ChudeMacBook-Air.local>
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #24
Summary
Enhance validation error messages to be more descriptive and actionable for developers working with Open Agent Spec YAML files.
Problem
When users provide invalid YAML specs, the current error messages are minimal and don't provide enough context to quickly fix the issue. For example:
agent.name must be a string(doesn't show what type was actually provided)task X references non-existent tool Y(doesn't list available tools)This leads to:
Solution
Enhanced all validation functions to provide:
agent.name,tools[2].id)got int,got missing)must be a string)Changes
oas_cli/validators.py
_validate_version()open_agent_spec: "1.0"_validate_agent()agentsectionnameandrolefields_validate_behavioural_contract()versionanddescriptionbehavioural_flags,policy, etc.)_validate_tools()tools[2].id_validate_tasks()task X references non-existent tool 'Y'task X references non-existent tool 'Y'. Available tools: 'tool1', 'tool2'. Check your 'tools' section.input/outputschemastests/test_validation_errors.py (NEW)
Comprehensive test suite verifying:
Before/After Examples
Example 1: Wrong Type for
open_agent_specBefore:
After:
Example 2: Missing Agent Section
Before:
After:
Example 3: Invalid Tool Reference
Before:
After:
Example 4: Wrong Type in Array
Before:
After:
Benefits
✅ Faster debugging — users immediately know what's wrong and how to fix it
✅ Better onboarding — new users can self-serve without reading docs extensively
✅ Reduced support burden — fewer questions about "what's wrong with my YAML?"
✅ Consistent format — all errors follow the same pattern
✅ Actionable guidance — every error includes an example or suggestion
Testing
Code Quality
ValueError)Future Work
This pattern can be extended to: