Affected package or area
@sapiom/agent packages/agent/src/introspection.ts, skeletonFromJsonSchema
Affected version, release, or commit
latest main (3cbe957)
Environment
Any pure TypeScript logic, no platform dependency
Minimal reproduction and steps
- Define an agent with a nullable input field, e.g. z.string().nullable()
- Zod generates JSON Schema: { type: ["string", "null"] }
- skeletonFromJsonSchema receives { type: ["string", "null"] }
- switch(schema.type) receives an array no case matches
- Falls through to default: return null
Expected behavior
skeletonFromJsonSchema({ type: ["string", "null"] }) returns "" (the non-null type's skeleton)
skeletonFromJsonSchema({ type: ["number", "null"] }) returns 0
Actual behavior
Returns null for any nullable type the example seed value is always null instead of a type appropriate placeholder.
Logs, screenshots, and additional context
Fix: normalize schema.type before the switch
const type = Array.isArray(schema.type)
? schema.type.find(t => t !== 'null') ?? 'null'
: schema.type;
Affected: introspection.ts line 108
Acknowledgements
Affected package or area
@sapiom/agent packages/agent/src/introspection.ts, skeletonFromJsonSchema
Affected version, release, or commit
latest main (3cbe957)
Environment
Any pure TypeScript logic, no platform dependency
Minimal reproduction and steps
Expected behavior
skeletonFromJsonSchema({ type: ["string", "null"] }) returns "" (the non-null type's skeleton)
skeletonFromJsonSchema({ type: ["number", "null"] }) returns 0
Actual behavior
Returns null for any nullable type the example seed value is always null instead of a type appropriate placeholder.
Logs, screenshots, and additional context
Fix: normalize schema.type before the switch
const type = Array.isArray(schema.type)
? schema.type.find(t => t !== 'null') ?? 'null'
: schema.type;
Affected: introspection.ts line 108
Acknowledgements