[Bug]: format "time" rejects times with a UTC offset
SDK Language
TypeScript / Node.js SDK (@composio/core)
SDK Version
@composio/json-schema-to-zod 0.3.3 on next at 344845518 (@composio/core 0.21.0)
Runtime Environment
Node 24.21, macOS 27 (arm64)
Environment
Local Development
Describe the Bug
The converter rejects any format: "time" value that has a UTC offset. 10:30:00Z and 10:30:00+05:30 both fail with "Invalid time". 10:30 passes, even though it isn't a valid JSON Schema time.
JSON Schema defines time as an RFC 3339 full-time, and that always has an offset. The converter maps the format to Zod's time(), and time() doesn't allow an offset at all.
I think this rejects tool calls too. The providers validate arguments with these schemas, so a time with an offset should fail before the request goes out, like the object fields in #4064 did. I only tried it with the converter directly though, not through a live tool.
Steps to Reproduce
- Build a schema with
jsonSchemaToZod({ type: 'string', format: 'time' }). - Parse
10:30:00Zwith it. - It fails with "Invalid time", while
10:30passes.
Minimal Reproducible Example
import { jsonSchemaToZod } from '@composio/json-schema-to-zod';
const schema = jsonSchemaToZod({ type: 'string', format: 'time' });
schema.safeParse('10:30:00Z').success; // false
schema.safeParse('10:30:00+05:30').success; // false
schema.safeParse('10:30').success; // trueError Output / Stack Trace
[{"code":"invalid_string","validation":"time","message":"Invalid time","path":[]}]Reproducibility
- Always reproducible
- Intermittent / Sometimes
- Happened once, can’t reproduce
Additional Context or Screenshots
I've got a fix with a test for this, and I'll open a PR that links here.
Source: ComposioHQ/composio