Skip to content
This repository was archived by the owner on Apr 13, 2026. It is now read-only.

fix: convert JSON Schema draft-07 exclusive bounds to draft-04 format - #147

Merged
ezynda3 merged 2 commits into
mark3labs:mainfrom
corylanou:fix/json-schema-draft-07-compatibility
Jan 9, 2026
Merged

fix: convert JSON Schema draft-07 exclusive bounds to draft-04 format#147
ezynda3 merged 2 commits into
mark3labs:mainfrom
corylanou:fix/json-schema-draft-07-compatibility

Conversation

@corylanou

Copy link
Copy Markdown
Contributor

Problem

Chrome DevTools MCP and other MCP servers use JSON Schema draft-07 where exclusiveMinimum/exclusiveMaximum are numeric values. However, kin-openapi (used for OpenAPI 3.0 schema parsing) expects them as booleans (draft-04 format).

This causes failures like:

conv mcp tool input schema fail(unmarshal): ...

Solution

Pre-process input schemas to convert numeric exclusive bounds to boolean format before unmarshaling:

  • exclusiveMinimum: 5minimum: 5, exclusiveMinimum: true
  • exclusiveMaximum: 10maximum: 10, exclusiveMaximum: true

The conversion is recursive, handling nested schemas in:

  • properties
  • items (arrays)
  • additionalProperties
  • allOf, anyOf, oneOf, not

Testing

Tested with Chrome DevTools MCP which uses draft-07 schemas extensively.

🤖 Generated with Claude Code

corylanou and others added 2 commits December 28, 2025 20:02
Chrome DevTools MCP and other MCP servers use JSON Schema draft-07 where
exclusiveMinimum/exclusiveMaximum are numeric values representing the
actual bounds. However, kin-openapi (OpenAPI 3.0) expects these fields
as booleans that modify the minimum/maximum values (draft-04 format).

This fix recursively processes input schemas to convert:
- exclusiveMinimum: N → minimum: N, exclusiveMinimum: true
- exclusiveMaximum: N → maximum: N, exclusiveMaximum: true

Handles nested schemas in properties, items, additionalProperties,
and schema composition keywords (allOf, anyOf, oneOf, not).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds comprehensive tests for convertExclusiveBoundsToBoolean():
- Simple exclusiveMinimum/exclusiveMaximum conversion
- Both bounds together
- Already boolean values (draft-04 style, unchanged)
- No exclusive bounds (unchanged)
- Nested properties
- Array items
- allOf composition
- additionalProperties
- Real-world Chrome DevTools MCP schema example
- Invalid JSON handling (returns unchanged)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ezynda3
ezynda3 merged commit 1b3a8c1 into mark3labs:main Jan 9, 2026
1 check passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants