redis / redis-om-python

Object mapping, and more, for Redis and Python
MIT License
1.09k stars 108 forks source link

Clarity on HashModel inside JsonModel #462

Open XChikuX opened 1 year ago

XChikuX commented 1 year ago

I believe, as per the datastructures redis supports here.

There was no intention of a HASH structure being allowed within a JSON formatted string. Especially since the latter is a new add-on meant for in-text searches using ReJSON & Redisearch.

If this is the case there should be type checks within the class to ensure that a nested structure of classes can only contain: JsonModel and EmbeddedJsonModel (Should it support multiple nesting since json does?).

If I stand corrected and Redis is in fact planning to somehow integrate both the datastructures in the future; Please ignore and close this.

If not, then I'm not sure how we can achieve this outside of a pydantic root_validator to check this during runtime. Open to suggestions!