Closed tsmith023 closed 1 year ago
To avoid any confusion in the future about your contribution to Weaviate, we work with a Contributor License Agreement. If you agree, you can simply add a comment to this PR that you agree with the CLA so that we can merge.
beep boop - the Weaviate bot 👋🤖
PS:
Are you already a member of the Weaviate Slack channel?
@weaviate-git-bot I agree with the Weaviate CLA
This PR introduces a method to the
schema
property ofclient
that checks for the existence of a class within the database by itsclassName
.In an effort to keep the implementation decoupled but logical, the
ClassExists
builder class is introduced that conforms to the logic of other builder classes within thesrc/schema/
directory. Thedo()
method of this class is, however, abstracted away from the end user such that they only access:without the added overhead and complexity of making many builder calls to achieve the result. This was done to conform with the previously raised issue: https://github.com/weaviate/typescript-client/issues/16.
The implementation simply calls the
/schema
endpoint of the Weaviate REST API and uses the.some()
Array.prototype
method to compare the returnedclasses
property with the providedclassName
.@dirkkul :grin: