Skip to content

[Feature Request] Support Checker([LIST_OF], LIST_OF=Optional[...]) #39

@mattwang44

Description

@mattwang44

Here is a minimum-reproducible code:

class _Spec:
    data = Checker([LIST_OF], LIST_OF=Optional[str])

validate_data_spec({'data': ['str', None]}, _Spec)
# TypeError: field: _Spec.data, reason: ['str', None] is not a spec of <class '__main__._Spec'>, detail: AttributeError('find')

tried with str | None

class _Spec:
    data = Checker([LIST_OF], LIST_OF=None | str)

validate_data_spec({'data': ['str', None]}, _Spec)
# TypeError: field: _Spec.data, reason: ['str', None] is not a spec of <class '__main__._Spec'>, detail: AttributeError("'types.UnionType' object has no attribute 'find'")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions