Skip to content

fix(provider): validate JSON-compatible objects and values - #21232

Open
halvaradop wants to merge 5 commits into
vercel:mainfrom
halvaradop:fix/validate-json-compatible-values
Open

halvaradop wants to merge 5 commits into
vercel:mainfrom
halvaradop:fix/validate-json-compatible-values

Conversation

@halvaradop

@halvaradop halvaradop commented Sep 21, 2026 •

Copy link
Copy Markdown

Summary

This pull request improves JSON-compatible value validation through the isJSONObject function.

The function now verifies that the provided value contains only JSON-compatible values, including JSON primitives, arrays, and plain objects. It rejects unsupported values such as functions, symbols, bigints, and non-plain objects such as class instances, Date, and RegExp objects.

Additionally, this PR re-exports the new isPlainObject function, which verifies whether a value is a plain object.

Previously, isJSONObject accepted values such as Date, RegExp, and other objects that inherit from custom prototypes or classes.

Package Structure

The is-json.ts implementation could potentially be moved to the provider-utils package.

The provider package primarily contains provider definitions and types, while provider-utils contains provider-related logic and utility functions. Moving this implementation to provider-utils would keep the package responsibilities more consistent.

Checklist

  • All commits are signed (PRs with unsigned commits cannot be merged)
  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)
  • I have reviewed this pull request (self-review)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant