Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

422 error on creating classes with references: invalid dataType: reference property to nonexistent class #44

Open
amirhouieh opened this issue Apr 14, 2023 · 2 comments

Comments

@amirhouieh
Copy link

amirhouieh commented Apr 14, 2023

I am trying to build something similar to the Wikipedia example in typescript and node.
It seems in the npm client, there is no create schema method, and hence I have to create classes async in different API calls, but in doing so I get 422 error: invalid dataType: reference property to a nonexistent class. I am not sure if this is the cause of the problem or something else.

  • There was a related conversation on Weaviate Slack, suggesting changing vectorizier would make it work (for example text2vec-transformers do not work but text2vec-contextionary does. In my case none works.
const schemaClasses = [
   ArticleClass,
   ParagraphClass
]

for await (classObj in schemaClasses){
   await client.schema.classCreator().withClass(classObj)
}
@ElvinD
Copy link

ElvinD commented May 30, 2023

I have the same issue. It's driving me crazy. Tried many different approaches like adding classes first, then properties for each class that reference other classes in separate API calls. Example log from Docker: {"action":"graphql_rebuild","level":"warning","msg":"ignoring ref prop "topConceptOf" on class "Concept", because it contains reference to nonexistent class ["ConceptScheme"]","time":"2023-05-30T17:34:52Z"}.
Using Weaviate 1.19.6

@tsmith023
Copy link
Contributor

tsmith023 commented Jun 21, 2023

Hi both @amirhouieh and @ElvinD, can the issue that you're both observing be summarised as so:

  • You have classes that depend on one another through their property definitions
  • You are looping through the classes in a flat manner and sending async requests
  • As such, there is no guarantee the classes are created in the correct order to be referenced successfully

If this is the case, might using promise chaining with the current classCreator() API fix your issue? So something like:

const createClass(classObj) => client.schema
  .classCreator()
  .withClass(classObj)
  .do();
await createClass(ParentClass)
  .then(async () => await createClass(ChildClass))

P.S. If your classes circularly reference one another then this above method won't work. The Python client is capable of this as shown here but I believe that the TypeScript client currently lacks this same functionality.

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

No branches or pull requests

3 participants