Skip to content

Fix/curation set types#335

Open
zaffron wants to merge 3 commits intotypesense:masterfrom
zaffron:fix/curation-set-types
Open

Fix/curation set types#335
zaffron wants to merge 3 commits intotypesense:masterfrom
zaffron:fix/curation-set-types

Conversation

@zaffron
Copy link

@zaffron zaffron commented Mar 12, 2026

Change Summary

Fix two missing type definitions for curation set support in Typesense v30:

  1. CollectionUpdateSchema missing curation_sets — synonym_sets was explicitly
    added but curation_sets was not, even though BaseCollectionCreateSchema already
    defines both. This forces consumers to extend the interface locally to call
    collection.update({ curation_sets: [...] }). The
    https://typesense.org/docs/30.0/api/curation.html confirm curation_sets is
    supported on collection PATCH.

  2. CurationSetItem.upsert() requires id in the body — The upsert endpoint is PUT
    /curation_sets/:name/items/:id, so id lives in the URL path. But the method
    requires CurationObjectSchema which has id as mandatory, forcing as unknown as
    casts. Introduced CurationItemUpsertSchema (Omit<CurationObjectSchema, "id">) to
    align the SDK with the https://typesense.org/docs/30.0/api/curation.html.

PR Checklist

zaffron added 2 commits March 13, 2026 00:38
CollectionUpdateSchema explicitly lists synonym_sets but is missing
curation_sets, even though BaseCollectionCreateSchema already defines it.
This causes consumers to extend the interface locally or use type
assertions when calling collection.update() with curation_sets.
CurationSetItem.upsert() currently requires CurationObjectSchema which
includes id as a required field. Since the item id is already part of
the URL path (PUT /curation_sets/:name/items/:id), the request body
should not require it.

Introduce CurationItemUpsertSchema as Omit<CurationObjectSchema, "id">
and use it as the parameter type for upsert(), aligning the SDK with the
actual Typesense v30 API contract.
…hema

synonym_sets and curation_sets are already inherited via
Partial<Omit<CollectionCreateSchema, "name" | "fields">>.
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.

2 participants