Skip to content

enhancement: fetch() mixing scalar PK and outputFields array fails with confusing "PKs must be non-empty strings" #206

Description

@s2x

Finding (from #192 follow-up)

fetch('doc1', ['name']) (scalar PK followed by an outputFields array) fails with PKs must be non-empty strings — technically correct but gives no hint about the actual calling convention.

Evidence

  • src/ZVec.php:766-776 — in the scalar form, all of $args are treated as PKs, so the array element fails the string check.
  • The two supported forms are fetch('pk1', 'pk2') and fetch(['pk1','pk2'], ?array $outputFields) — mixing scalar PK + array outputFields is not supported.
  • Verified by subagent review (CONFIRMED; no duplicate — closed fetch() with outputFields parameter (zvec v0.5.0) #176 is unrelated).

Suggested improvement

Detect an array in the scalar-form arguments and throw (or better: accept) with a message pointing to the calling convention, e.g.:
"Mixing scalar PKs with an outputFields array is not supported — use fetch(['pk1'], ['name']) instead" (or support the form outright).

Low priority / DX polish.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions