Skip to content

fix: support plain equality in _where#1759

Open
LaplaceYoung wants to merge 1 commit into
typicode:mainfrom
LaplaceYoung:fix/where-primitive-equality
Open

fix: support plain equality in _where#1759
LaplaceYoung wants to merge 1 commit into
typicode:mainfrom
LaplaceYoung:fix/where-primitive-equality

Conversation

@LaplaceYoung
Copy link
Copy Markdown

Summary

  • Treat primitive values in _where JSON as equality filters.
  • Keep the existing operator-object syntax for eq, gt, contains, and related operators.
  • Add regression coverage for matchesWhere() and the HTTP _where query path.

Closes #1757

Verification

  • pnpm test
  • pnpm typecheck
  • pnpm lint
  • pnpm exec oxfmt --check src/app.test.ts src/matches-where.test.ts src/matches-where.ts
  • git diff --check

@Omar-Tnt04
Copy link
Copy Markdown
Contributor

I reviewed this change because it relates to the plain _where equality behavior.

The fix direction looks useful because users may expect _where={"title":"foo"} to behave like an equality check, similar to title=foo. One thing I would suggest is adding regression coverage for both supported forms: the primitive shorthand form and the operator-object form, for example _where={"title":"foo"} and _where={"title":{"eq":"foo"}}. That would help make sure both syntaxes stay consistent in future changes.

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.

Unexpected behavior with plain equality in _where

2 participants