Skip to content

Add client-side schema validation before execution #19

@gauthierpiarrette

Description

@gauthierpiarrette

Problem
The form engine renders inputs from JSON Schema but does not validate before sending to the server. Required fields can be left empty, number fields can contain non-numeric text, and enum fields have no constraint checking. Users only discover input errors after the server rejects the call.

Proposed solution
Add client-side validation that runs when the user clicks Execute:

  • Required fields: show inline error if empty
  • Number/integer: validate type and min/max constraints
  • String: validate minLength/maxLength/pattern
  • Enum: ensure value is in allowed set
  • Nested objects: recursively validate required properties

Show errors inline below each field with red text. Disable the Execute button while validation errors exist. This mirrors the UX of FastAPI's /docs Swagger UI.

Alternatives considered
Using a JSON Schema validation library (e.g., Ajv). For the subset of JSON Schema that MCP tools actually use, hand-written validation in the form components is simpler and avoids a heavy dependency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions