p2p-ld / numpydantic

Type annotations for specifying, validating, and serializing arrays with arbitrary backends in Pydantic (and beyond)
https://numpydantic.readthedocs.io/
MIT License
66 stars 1 forks source link

[bugfix] Revalidate with already-validated/proxied array #14

Closed sneakers-the-rat closed 2 months ago

sneakers-the-rat commented 2 months ago

When a proxy object is passed to some validators after having already been validated, validation fails.

This should always succeed:

from numpydantic import NDArray
from pydantic import BaseModel

class MyModel(BaseModel):
    array: NDArray

instance = MyModel(array=valid_input)
_ = MyModel(array=instance.array)

but it's currently failing for the proxied interfaces.

This PR