Skip to content

feat(schema): add support for JSON Schema $defs and definitions #146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

arcaputo3
Copy link

Added support for $defs and definitions properties in JsonSchema record to handle JSON Schema references properly. Added tests to verify both formats work correctly.

🤖 Generated with Claude Code

Motivation and Context

This change addresses issue #145 by adding support for both $defs and definitions properties in the JsonSchema record. Previously, the schema couldn't properly handle JSON Schema references that use these properties,
which are essential for defining complex schema structures with reusable components.

How Has This Been Tested?

Added comprehensive unit tests that verify:

  • Parsing JSON Schema with $defs property
  • Parsing JSON Schema with definitions property
  • Serializing and deserializing schemas with references
  • Working with tools that use complex schemas containing references

Breaking Changes

None. This is a backward-compatible enhancement to the existing JsonSchema implementation.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

This implementation supports both the older definitions keyword and the newer $defs keyword (introduced in JSON Schema draft 2019-09) to ensure compatibility with different JSON Schema versions.

Added support for $defs and definitions properties in JsonSchema record to handle JSON Schema references properly. Added tests to verify both formats work correctly.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
arcaputo3 and others added 3 commits April 15, 2025 21:55
Changed the JsonSchema test approach to use serialization/deserialization round-trip validation instead of property-by-property assertions. This makes tests more maintainable and less likely to break when new properties are added.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
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