Skip to content

Bug with DocList[] #1782

@samsja

Description

@samsja

Context

from docarray import DocList, BaseDoc

docs = DocList[BaseDoc()]# 1

class MyDoc(BaseDoc):
    text: str

DocList[MyDoc][MyDoc] # 2

Both 1 and 2 lines should failed with a nice error message

description

DocList[X] should only accept BaseDoc class and should not be called twice

How to do it

This should be as easy as adding if else statement and raise properly error in this part of the codebase:

if not safe_issubclass(item, BaseDoc):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Todo/Bug

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions