Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✅ Deploy Preview for the-codegen-project canceled.
|
|
Re: Date unmarshal bug Acknowledged. This is a valid bug that will require fixes in two places:
Tracking this for a follow-up fix that spans both repos. |
- Remove 'time' format from isDateFormatModel to prevent Invalid Date (time strings like "14:30:00" are not valid Date constructor args) - Exclude ConstrainedUnionModel from hasItemUnmarshal to prevent undefined Union.unmarshal reference for tuple arrays 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| } | ||
| const format = model.originalInput?.format; | ||
| return format === 'date' || format === 'date-time'; | ||
| } |
There was a problem hiding this comment.
FormatTime unmarshal returns string despite Date type
Medium Severity
The isDateFormatModel function correctly excludes time format from new Date() wrapping because time-only strings produce Invalid Date. However, Modelina still generates type FormatTime = Date for format: "time" schemas. The resulting unmarshal uses the primitive path (JSON.parse(json) as FormatTime), returning a string unsafely cast to Date. Any caller using Date methods on the result will get runtime errors. Either the time format needs new Date() wrapping or Modelina's type mapping needs to produce string instead of Date for time-only formats.
Additional Locations (1)
| } | ||
| if (obj["updatedAt"] !== undefined) { | ||
| instance.updatedAt = obj["updatedAt"]; | ||
| } |
There was a problem hiding this comment.
Class model unmarshal assigns strings to Date fields
High Severity
Class-based models like AllOfTwoTypes, AllOfThreeTypes, and PetOrder now type createdAt, updatedAt, and shipDate as Date (from the Modelina upgrade), but their unmarshal methods assign raw JSON-parsed string values directly without wrapping in new Date(). Consumers will get a string at runtime despite the Date type annotation, causing runtime failures on any Date method call.


Note
Medium Risk
Changes core TypeScript codegen semantics (notably
Datevsstringand union/array marshal/unmarshal behavior), which can affect downstream generated clients and runtime validation behavior.Overview
Improves the TypeScript Modelina presets to better handle schema edge cases: adds explicit
nullmarshal/unmarshal generation, treatsstringformatsdate/date-timeasDateduring unmarshal, and avoids attempting per-item unmarshal for arrays of arrays/unions.Adjusts generated AJV schema/validation output by making
validate()accept marshalled JSON strings (parses string input) and bysafeStringifydropping root-leveltype: "object"when it conflicts withoneOf/anyOfunions.Updates runtime/generated fixtures accordingly, bumps
@asyncapi/modelinato6.0.0-next.8, and adds a comprehensive AsyncAPI payload-types runtime test spec + generator config to validate many JSON Schema type variations end-to-end.Written by Cursor Bugbot for commit cae72a5. This will update automatically on new commits. Configure here.