Skip to content

feat: WithSchemaValidation — JSON Schema arg validation#9

Merged
inhuman merged 1 commit into
mainfrom
010-schema-validation
May 11, 2026
Merged

feat: WithSchemaValidation — JSON Schema arg validation#9
inhuman merged 1 commit into
mainfrom
010-schema-validation

Conversation

@inhuman
Copy link
Copy Markdown
Owner

@inhuman inhuman commented May 11, 2026

Summary

  • WithSchemaValidation() Option — enables client-side validation of CallTool args against each tool's InputSchema before the call is dispatched
  • Validation uses xeipuuv/gojsonschema (already an indirect dep via dockertest, now promoted to direct — no new download)
  • Empty/nil args are treated as {}, so required-field violations are caught even when no args are passed
  • Disabled by default; tools without an InputSchema are skipped
  • Violations returned as *ErrInvalidArgs with SchemaErrors []string field populated

Test plan

  • 8 unit tests in validate_test.go for validateSchema (empty schema, valid args, missing required, wrong type, constraints, empty args)
  • 6 integration tests in caller_test.go (valid pass-through, missing required, wrong type, empty args + required, disabled by default, no schema skips)
  • api_surface_test.goWithSchemaValidation pinned
  • go test -race ./... — all pass
  • golangci-lint run ./... — 0 issues
  • CI passes

Validates CallTool args against each tool's InputSchema using
xeipuuv/gojsonschema (already an indirect dep, now promoted to direct).
Violations surface as *ErrInvalidArgs.SchemaErrors. Disabled by default.
@inhuman inhuman merged commit faaa985 into main May 11, 2026
3 checks passed
@inhuman inhuman deleted the 010-schema-validation branch May 11, 2026 21:50
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