fix: resolve CI build errors in types, console, and fields packages#1154
fix: resolve CI build errors in types, console, and fields packages#1154
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
- Fix TS2430: Rename ChatbotSchema.body to requestBody to avoid conflict with BaseSchema.body - Fix TS2322: Add type assertion for DesignerFieldType in ObjectManagerPage.tsx - Fix SSR: Add react/jsx-runtime to fields package vite externals for Next.js compatibility - Update CHANGELOG.md Agent-Logs-Url: https://github.com/objectstack-ai/objectui/sessions/f91e232a-9e03-48ed-9599-fcc920e1e008 Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Resolves multiple CI build failures across the monorepo by aligning schema types, fixing a console type error, and adjusting Vite externals for Next.js SSR compatibility.
Changes:
- Renames
ChatbotSchema.body→ChatbotSchema.requestBodyto avoid conflicting withBaseSchema.body(child schema nodes) and updates plugin-chatbot renderer usage. - Fixes a
DesignerFieldTypeassignment error in the consoleObjectManagerPageby importing the type and asserting the field type. - Externalizes
react/jsx-runtimein@object-ui/fieldsVite config to prevent SSR failures in Next.js/Turbopack docs builds.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/types/src/complex.ts | Renames chatbot schema request payload field to requestBody to resolve BaseSchema.body type conflict. |
| packages/plugin-chatbot/src/renderer.tsx | Updates renderer wiring to pass schema.requestBody into useObjectChat/components. |
| packages/fields/vite.config.ts | Externalizes react/jsx-runtime (and adds globals mapping) to avoid bundling SSR-hostile CJS wrappers. |
| apps/console/src/pages/system/ObjectManagerPage.tsx | Fixes DesignerFieldType assignment with import + assertion. |
| CHANGELOG.md | Documents the fixes and schema field rename. |
| /** | ||
| * Additional body parameters to include with each API request. | ||
| */ | ||
| body?: Record<string, unknown>; | ||
| requestBody?: Record<string, unknown>; | ||
| /** |
There was a problem hiding this comment.
ChatbotSchema was renamed to requestBody, but the runtime Zod validator for Chatbot still defines an API body field (and overrides BaseSchema.body). This leaves validation/JSON-schema behavior inconsistent with the TypeScript interface and reintroduces the same conceptual conflict at runtime (child nodes vs HTTP body params). Update the Zod ChatbotSchema to use requestBody (and keep BaseSchema.body for child schema nodes) so validated schemas match the published types.
| @@ -528,7 +528,7 @@ export interface ChatbotSchema extends BaseSchema { | |||
| /** | |||
| * Additional body parameters to include with each API request. | |||
There was a problem hiding this comment.
The JSDoc still refers to “body parameters” even though the property was renamed to requestBody. Consider updating the wording to “request body parameters” (or similar) to avoid confusion with BaseSchema.body (child nodes).
| * Additional body parameters to include with each API request. | |
| * Additional request body parameters to include with each API request. |
| model: schema.model, | ||
| streamingEnabled: schema.streamingEnabled, | ||
| headers: schema.headers, | ||
| body: schema.body, | ||
| body: schema.requestBody, | ||
| maxToolRoundtrips: schema.maxToolRoundtrips, |
There was a problem hiding this comment.
requestBody is a breaking rename from the previously documented body schema field. If existing saved schemas may still send body as request params, consider adding a backward-compatible fallback (e.g., treat schema.body as request params when it’s a plain object rather than a SchemaNode) so older configs continue working while migrating to requestBody.
| name: field.name || '', | ||
| label: typeof field.label === 'object' ? field.label.defaultValue || field.label.key || '' : (field.label || field.name || ''), | ||
| type: field.type || 'text', | ||
| type: (field.type || 'text') as DesignerFieldType, | ||
| group: field.group || undefined, |
There was a problem hiding this comment.
Casting field.type to DesignerFieldType bypasses type safety without ensuring the value is actually one of the supported field types. Since this comes from loose API metadata (type?: string), it would be safer to validate/narrow the value (e.g., via a small type guard / allowlist) and fall back to 'text' when unknown, instead of asserting.
Three independent build failures on main: a type incompatibility in
ChatbotSchema, a missing type assertion inObjectManagerPage, and a bundledreact/jsx-runtimebreaking Next.js SSR.@object-ui/types—ChatbotSchema.body: Record<string, unknown>conflicts withBaseSchema.body: SchemaNode | SchemaNode[]. Renamed torequestBodysince it represents HTTP request params, not child schema nodes.apps/console—ObjectManagerPage.toFieldDefinition()assignsfield.type(string) toDesignerFieldType(literal union). Added type assertion and missing import:@object-ui/fields—react/jsx-runtimewas not externalized in vite config, causing it to be bundled into the CJS output. Next.js Turbopack SSR rejects the resulting dynamicrequire()during static prerendering of/docs/components/overlay/tooltip. Addedreact/jsx-runtimeto externals, matching the pattern in plugin-list/plugin-detail.