You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want users of my library to fill out an attrs class, then later I will unstructure it and send it out to a remote API. When the user creates the attrs instance, they can optionally use mypy to make sure they set the attributes to the correct types, but of course this is optional. Before I send out the data on the network I would like to be sure it matches the correct schema.
I know I could use attrs validators to enforce types in the attrs class, but I've found that its hard to do correctly for more advanced types. Before I send out the data on the network I would like to be sure it matches the correct schema.
However, it appears that cattrs doesn't check types in unstructure the same way structure does. Is there a way to make cattrs unstructure strictly, or perhaps the recommendation is to add separate validation after unstructuring?
And put in some additional hooks for strings and other primitives. A comprehensive solution would probably involve writing a strategy, which I'd be glad to mentor someone to do.
Description
I want users of my library to fill out an attrs class, then later I will unstructure it and send it out to a remote API. When the user creates the attrs instance, they can optionally use mypy to make sure they set the attributes to the correct types, but of course this is optional. Before I send out the data on the network I would like to be sure it matches the correct schema.
I know I could use attrs validators to enforce types in the attrs class, but I've found that its hard to do correctly for more advanced types. Before I send out the data on the network I would like to be sure it matches the correct schema.
However, it appears that cattrs doesn't check types in
unstructure
the same waystructure
does. Is there a way to make cattrs unstructure strictly, or perhaps the recommendation is to add separate validation after unstructuring?What I Did
Actual output:
Expected output: Exception
The text was updated successfully, but these errors were encountered: