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
The annotated-types project https://github.com/annotated-types/annotated-types provides a format for expressing constraints, like string length, integer bounds, or general predicates, by using Annotated in type annotations.
Pydantic is using it in V2 and FastAPI has adopted Annotated in v0.95 (I'm not sure about annotated-types).
I'm assuming annotated-types doesn't have the full power of contracts, e.g. how do you relate outputs to inputs. So it should be supported in conjunction with contract syntax.
The text was updated successfully, but these errors were encountered:
So glad that someone else has thought of this too! I've been following annotated-types for a bit, and talking a little about a CrossHair integration.
Even without contracts, crosshair could play a role here, because essentially any annotated return type is already a contract; e.g. something like this could be checked by crosshair:
I am in the middle of some intense performance work, but esp with your nudge, I think this should be next-ish in the prioritization queue. (or if someone finding this wants to take a stab at it in the meantime, I'll help!)
The annotated-types project https://github.com/annotated-types/annotated-types provides a format for expressing constraints, like string length, integer bounds, or general predicates, by using
Annotated
in type annotations.Pydantic is using it in V2 and FastAPI has adopted
Annotated
in v0.95 (I'm not sure about annotated-types).I'm assuming annotated-types doesn't have the full power of contracts, e.g. how do you relate outputs to inputs. So it should be supported in conjunction with contract syntax.
The text was updated successfully, but these errors were encountered: