* Fix#867 by accepting and passing on **kwargs in ModelMetaclass.__new__
pydantic.main.MetaModel.__new__ should include **kwargs at the end of
the method definition and pass them on to the super call at the end in
order to allow the special method __init_subclass__ to be defined with
custom parameters on extended BaseModel classes.
* MetaModel -> ModelMetaclass
* shrink change notes
* rename and reformat change description
* moving docs to mkdocs
* transfering readme to md and more
* fixing build
* splitting usage.md
* improving schema.md and index.md
* fix make_history.rst
* models intro
* working on data conversation and required fields
* more fixes to models.md
* list all standard types supported
* list of pydantic types
* tweaks
* update links in code
* Apply suggestions from code review
incorporate @dmontagu's suggestions.
Co-Authored-By: dmontagu <35119617+dmontagu@users.noreply.github.com>
* Apply suggestions from code review
more missed suggestions.
Co-Authored-By: dmontagu <35119617+dmontagu@users.noreply.github.com>
* Apply suggestions from code review
more corrects.
* cleanup
* Field order warning
* fix and regenerate benchmarks
* format examples better, cleanup
* improve schema mapping table
* correct highlighting file types in schema.md
* add redirects in javascript
* add logo
* fix(validate-assignment): do not validate extra fields when `vaidate_assignment` is on
* Update history
* Fix `value` vs. `value_`
* Add tests for `value` vs `value_` case
* uprev
* Fix generic required (#742)
* Fix required fields on GenericModel
* lint
* version up
* __post_init__ with inheritance, fix#739 (#740)
* Fix custom Schema on GenericModel fields (#754)
* Fix custom Schema on GenericModel fields
* Add PR#
* uprev
* Fix error messages for Literal types with multiple allowed values (#770)
* Fix error messages for Literal types with multiple allowed values
* Incorporate feedback
* update history
* rename Schema to Field
* add Schema function with deprecation warning
* mypy tests and other tweaks
* tweaks and cleanup
* Update pydantic/fields.py
Co-Authored-By: Sebastián Ramírez <tiangolo@gmail.com>
* root validators and rename __obj__ -> __root__
* implement root validation
* tweak Validator
* dataclass and generic tests, docs
* repeat and signature checks
* fix inheritance
* tweaks tests and var names
* improvements to 'from_orm' to work better with root validators (#822)
* improvements to 'from_orm' to work better with root validators
* cython compatibility and tweaks
* tweak config order
* added test for derived classes using custom getter_dict config (#833)
* added test for derived classes using custom getter_dict config
* fix linting
* fix formatting
* cleanup
* Add failing generic subclass test
* Only raise type parameter failure on base GenericModel class
* Add changes to describe PR #842
* Change the class check to use is
* Fix formatting in subclass test
* correct change
* big performance improvement!
* exception performance improvement
* check errors and explicit export from errors.py
* more tweaks
* fix coverage
* fix tests and remove "from e" in exceptions for performance
* Added generic approach to strict type checking for constraint types
- Use the arbitrary validator to build strict validators for ConstrainedInt, ConstrainedFloat, ConstrainedStr
- Make StrictStr a derived class of ConstrainedStr
- Add tests for new strict cases for ConstrainedInt and ConstrainedFloat
* - Created StrictInt and StrictFloat subclasses and exported them
- Changed strictness tests to use these new subclasses
* - Added section for Strict Types to docs
* - Added changes file
* Update docs/index.rst
Co-Authored-By: Zaar Hai <haizaar@users.noreply.github.com>
* Update docs/index.rst
Co-Authored-By: Zaar Hai <haizaar@users.noreply.github.com>
* - Create validators for strict int and float
- Make ConstrainedInt and ConstrainedFloat use those validators instead of abusing arbitrary type validator for strictness
- Prevent double validaton of same conditions by only yielding either the strict or non-strict type validator for for those classes
* Changed strict int and float tests to alos match for exception message in invalid cases
* - Removed obvious note about lack of ConstrainedBool
- Added example for strict type usage
- Added note about caveats for StrictInt and StrictFloat
* Update pydantic/validators.py
faster method to check if a value is boolean for strict int validator
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* - Removed StrictBool part from Boolean section of docs
- Moved the Strctbool code example into strict_types.py example file
* - Changed behavior of strictness for COnstrainedStr to match that fo other constrained types
* - Actually make ConstrainedStr use the correct validator for strictness
* initial proposal of payment card validation #788
* some cleanup for PaymentCardNumber #788
* fix linting issues
* tests and more robust errors #788
* fixed linting
* fixing mypy errors
* let's try this to make mypy work
* make consistent with cpython tests
* avoid using __new__
* use __init__ instead of properties
* clean up PaymentCardNumber.__init__
* use ClassVar where applicable
* add to changes/
* turns out this is never used
* get brand for other
* clean up a bit
* make PaymentCardNumber private
* use if/else to make faster in cython
* card_number => card number in errors
* make it clearer in the tests which exception is being raised
* parameterize tests for PaymentCardNumber
* lint
* clean up merge mistake from earlier
* fix mypy test error
* take out commented line
* update comment since code is moved
* docs for PaymentCardNumber
* clean up docs for PaymentCardNumber
* var name that makes more sense
* Add support for Type[T] typehints when arbitrary_types_allowe==True.
* Add documentation.
* Let black do its magic.
* Ignore mypy warning - see here: https://github.com/python/mypy/issues/3060
* Prettify docs.
* Change Changelog.
* Refactor and simplify check for Type[T].
* Black again. ^^ - Really need pre-commit hooks.
* Update pydantic/validators.py
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* Rename arbitrary_class to class.
* Black.
* Add type hints.
* Make private function public.
* Add support for bare Type.
* Black again.
* Update docs.
* CO_ct not meant for export.
* Fix get_class for Python3.6
* Update error message of ClassError.
* Use relative import.
* Incorporate typing feedback (both versions are fine with mypy).
* Move from issubclass to lenient_issubclass.
* correct docs
* Test local and global part of EmailStr validation return values
* Make local part of email case-sensitive per RFC 5321
* Update changes/798-henriklindgren.rst
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* remove case-sensitive specific tests from EmailStr
* new URL parsing, fix#603, fix#541
* AnyUrl parts and more tests
* more coverage and db DSNs
* remove DSN methods
* tests for urlstr
* remove debug
* make AnyStr a subtype of str
* fix with cython
* rearranging networking code
* allowing international domains, cleanup
* support international domains
* better URL builder
* allow underscores in subdomains and domains
* tests for json and schema, max length
* urlstr > stricturl
* updating docs
* tweak docs examples
* tweak docs
* Better error for unsuported "typing" objects.
Fixes#745
Add a better error message for fields with types from the typing
module that are not directly supported by Pydantic. Previously,
it caused a cryptic assertion failure.
* Add support for frozenset fields.
Also provide an example of their usage.
Fixes#745
* Address review comments.
Fixes#745
* use equals not "is" for int comparison.
* small performance improvements to validators and fields
* simplify ErrorWrapper and ValidationError
* more cleanup of errors, combine test_error_wrapper.py and test_error.py
* tweak datetime_parse.py
* fix for python 3.6
* add change
* fix bug with int or float passed to datetime.time
* Test mypy integration with pytest
* Fix for without deps
* Fix filenames issue
* Remove python run in external-mypy
* Update changes
* Remove external-mypy
* add documentation for PyCharm Plugin
* add a change document for a history
* Delete typing.py
* update documents
* Apply suggestions from code review
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>