Skip to content

Fix/vtex#268

Merged
viniciusventura29 merged 5 commits intomainfrom
fix/vtex
Mar 2, 2026
Merged

Fix/vtex#268
viniciusventura29 merged 5 commits intomainfrom
fix/vtex

Conversation

@viniciusventura29
Copy link
Collaborator

@viniciusventura29 viniciusventura29 commented Mar 2, 2026

Summary by cubic

Improve VTEX tool adapter by normalizing operation results and making error messages clearer. Prevents crashes when SDK returns null, undefined, or primitive values and provides consistent response shapes.

  • Bug Fixes

    • Errors now extract a clean message from Error, string, or object values.
    • Result normalization: arrays -> { items }, primitives/null/undefined -> { result }, objects unchanged.
  • Migration

    • If you consumed primitive results directly, read them from result instead (e.g., payload.result).

Written for commit 28fc4ec. Summary will update on new commits.

- Updated `coerceNumericField` to accept numeric strings for both integer and float fields, normalizing them to numbers.
- Added tests to ensure that numeric strings are correctly parsed and coerced in the `flattenRequestSchema` function.
- Improved type handling for path parameters, allowing for more flexible input in request validation.
- Changed the TypeScript types configuration from "bun-types" to "bun" for improved compatibility and clarity in the project setup.
- Updated the `createToolFromOperation` function to return a structured response when the result data is null, undefined, or not an object, ensuring consistent handling of various data types.
- Enhanced the error handling in the `createToolFromOperation` function to provide clearer error messages. The error message is now derived from the error object directly, ensuring that both string and object errors are handled appropriately.
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@github-actions
Copy link

github-actions bot commented Mar 2, 2026

🚀 Preview Deployments Ready!

Your changes have been deployed to preview environments:

📦 vtex

🔗 View Preview

These previews will be automatically updated with new commits to this PR.


Deployed from commit: 415372c

@viniciusventura29 viniciusventura29 merged commit 203bf06 into main Mar 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant