Feature or bug? :) first letter of class name gets capitalized

I had declared my first class as:

    schema = {
        "classes": [
            {
                "class": "wpArticle",  # NB the first letter gets capitalized regardless of how you write it here
                "description": "Contains the WP article text data along with embeddings",
                "vectorizer": "none",  # we will provide the embedding, not let Weaviate do it
                "properties": [
                    {
                        "name": "slug",
                        "dataType": ["text"],
                    },
                    {
                        "name": "kicker",
                        "dataType": ["text"],
                    },
                ],
            }
        ]
    }

but the class was nevertheless created as WpArticle (first letter uppercased). Find it a bit offsetting. Is there a prescription to name classes only with a capital initial?
Thanks !

Hi @rjalex !!

Weaviate will auto capitalize the class/collection/schema name. It will also ensure they are unique when in lower case.

This is indeed a good questioning, as just today I saw a user having issues while defining the class as someclass, and expecting to get the results as :

result["data"]["Get"]["someclass"]

while the correct way is:

result["data"]["Get"]["Someclass"]

due to the auto capitalization.

Note that this will not be a problem in python client v4, as it will deliver an object rather than a python dictionary tied to the class name, as it is in python client v3.

Thanks for this questions. I will poke internally to see if there is other reasons for that other than a convention.

1 Like

I think doing that “under the covers” might cause some confusion.
Python itself in the naming convention section of PEP8 PEP 8 – Style Guide for Python Code | peps.python.org recommends but does not enforce CamelCase. So my vote would be that if possible you leave the casing as declared but of course it’s only my humble opinion :slight_smile: As always thanks a lot. Take care. I’m starting to love Weaviate :slight_smile:

1 Like