Skip to content

Commit

Permalink
Improve drop field schema for collection.update
Browse files Browse the repository at this point in the history
Prior implementation required "type" to be specified when dropping a field. Now only name, and `drop: true` are required/valid.
  • Loading branch information
cdoe committed Jul 21, 2023
1 parent 3237715 commit 45b73de
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Typesense/Collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@ export interface CollectionSchema extends CollectionCreateSchema {
num_memory_shards: number;
}

export interface CollectionUpdateFieldSchema extends CollectionFieldSchema {
drop?: boolean;
export interface CollectionDropFieldSchema {
name: string;
drop: true;
}

export interface CollectionUpdateSchema
extends Partial<Omit<CollectionCreateSchema, "name">> {
fields?: CollectionUpdateFieldSchema[];
extends Partial<Omit<CollectionCreateSchema, "name" | "fields">> {
fields?: (CollectionFieldSchema | CollectionDropFieldSchema)[];
}

export default class Collection<T extends DocumentSchema = object> {
Expand Down

0 comments on commit 45b73de

Please sign in to comment.