pydantic / pydantic-extra-types

Extra Pydantic types.
MIT License
195 stars 51 forks source link

Add hypothesis plugin #34

Closed hirotasoshu closed 1 year ago

hirotasoshu commented 1 year ago

Since this is separate package, hypothesis plugin for pydantic will not work for this types. Instead of making a separate plugin, support for pydantic-extra-types can be added to the pydantic hypothesis plugin as part of pydantic/pydantic#4682.

yezz123 commented 1 year ago

Hey @hirotasoshu

I appreciate your input, but I disagree because there are various types available such as PostgreSQL, MySQL, Emailstr, and other commonly used types including the Hypothesis plugin.

IMO, it would be more beneficial for these types to remain within Pydantic for now.

I guess @samuelcolvin @dmontagu will agree with me about that

samuelcolvin commented 1 year ago

I think with V2 we probably won't need the hypothesis plugin for most things, well need some compatibility on a few types.

yezz123 commented 1 year ago

well need some compatibility on a few types.

+1 working on them to make bunch of stuff ready

hirotasoshu commented 1 year ago

@yezz123 I'm sorry, I think I put it wrong. I didn't mean to transfer the entire pydantic hypothesis plugin into this package. I just wanted hypothesis to work with pydantic-extra-types because the current implementation of the hypothesis plugin only registers pydantic types. I was thinking of two options:

  1. Create a separate pydantic-extra-types hypothesis plugin only for types in this package.
  2. Add pydantic-extra-types support to the existing hypothesis plugin.

@samuelcolvin will this work for types that have complex validation? For example, for card numbers (luhn algorithm).If so, then this issue doesn't make sense)

samuelcolvin commented 1 year ago

See https://github.com/annotated-types/annotated-types/issues/37.

Ideally we don't need any hypothesis plugins.

hirotasoshu commented 1 year ago

See annotated-types/annotated-types#37.

Ideally we don't need any hypothesis plugins.

Oh, I see, thanks for the clarification)