* linting as a separate ci step
* CI and docs improvements
* fix docs preview
* fix docs, benchmarks fastapi tests
* fix formatting and docs build
* tweak publishing docs
* fix for new download-artifact action
* skip check tag to check docs build
* prepare for merge
* add description of subclass each_item scenario
* add example of subclass validator with each_item
* each_item causes validator to not run when parent class has List field #1566
* Add datamodel-code-generator link in pydantic document site.
* tweak menu
* fix blank lines
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* Add (failing) test for Subclass JSON encoding
* Allow subclasses of known types to be encoded with superclass encoder
* Add change file
* Add documentation, fix custom json_encoders and add unit test
Blacken doc
Fix test that worked on my machine
datetime.timestamp() is flakey?
Single quotes only
* Reduce lookups
- Remove last element in `__mro__` as it will always be `object`
- Use .get for compactness
* Regarding the loop
* Move Path and Enum into ENCODERS_BY_TYPE
Sort ENCODERS_BY_TYPE
* improve JSON docs
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* Add change file
* Add datetime field to default_factory example
Print instead of assert
Remove bad quotes
Remove bad quotes from all examples
* fix change description
* remove 'avoid-escape' from setup.cfg
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* Raise informative TypeError when passing bad exclude kwargs to export
* Cleanup spurious example
* Add __all__ keyword to enable excluding fields from all members of a list/tuple of child submodels
* Add changelog
* Fix MD format inconsistencies and consolidate export tests
* Excluding from exported List of Dict fields with "__all__"
* tweaks
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* README change to make type annotations valid
* example fixed to have valid type annotations
* changes description
* Update README.md
explicit assignment for an optional field
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* Update docs/examples/index_main.py
explicit assignment for an optional field
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
* Add right __init__ signature generation
* Add params overlay support for custom __init__, enhance tests
* Change fake_ini creation to solve AttributeError in cython
AttributeError: attribute '__code__' of 'cython_function_or_method' objects is not writable
Possible there's other attrs that cannot be set in cython, but can't check myself yet
* Cython compatibility, add __signature__, ignore non-identifiers fields
Moved tests to separate file
Moved __init__ creation to utils
* Remove # pragma: no cover
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* Fixed adding signature to doc, some compatibility fixes
* Changed None to tuple() for py3.8 compatibility
* Finally (hope so) fix issues with closure. Add new docstring each time
* coverage for UndefinedType
* Checking signature more simple and obvious way
* Changed doc caption to simple message, used Undefined, merge conflicts
* Compatibility with py3.6
* Add changes/ file
* Ah, that space... Reformatted and ready to go!
* Update pydantic/main.py
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* Update pydantic/main.py
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* Fix signature for properties declared as fields
* Sort imports
* Add comments
* Generate BaseModel signature instead of __init__ signature
* Fixed imports
* Minor improvements from review
* Add docs for model signature
* Delete unused imports
* Fix formatting in tests
* Remove inspect imports from top level
* Update docs/examples/models_signature.py
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* Add missing import
* Remove notes from doc
* change hypothesis-auto mention to hypothesis
* Use None as slice end instead of len()
* tweak generate_model_signature
* improve docs
* Revert af3dd4d, add fields to custom init only if var_kw declared
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
* starting validation_decorator
* correct skip_pre_38
* fix coverage and type hints
* mypy tests and move to class based decorator
* 3.6 fix, prevent duplicate github actions
* correct py 3.6 check
* better errors
* cleaner field names for args and kwargs
* add change and comments
* starting docs
* back to 3.7 for docs
* docs
* bump
* add async example and fix print indents
* allow type annotations as strings
* python 3.8 in docs
* fix alias priority so alias_generators don't take priority
* improve test names
* remove debugs
* Apply suggestions from code review
* more tests and allow custom alias_priority on fields
* precedence tests and docs
* tweaks and add change
* suggestions
* ✨ Add support for generics with __get_validators__
* ✅ Add tests for Generics with __get_validators__
* 📝 Add change note
* ✨ Add support for Generic fields with validation of sub-types
* 📝 Add docs for arbitrary generic types
* ✅ Add tests for generic sub-type validation
* 📝 Update change note. Generic support is not so "basic" now
* 📝 Update docs with code review
* ♻️ Update fields module with code review changes
* ✅ Update tests from code review
* 📝 Update example for generics, try to simplify and explain better
* tweak docs example
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
* ✨ Implement support for infinite generators with Iterable
* ✅ Add tests for infinite generators
* 🎨 Fix format
* 📝 Add docs for infinite generators
* 📝 Add changes file
* ✨ Store sub_field with original type parameter to allow custom validation
* 📝 Add example for validating first value in infinite generators
* 🔥 Remove unused import in example
* ✅ Add test for infinite generator with first-value validation
* ♻️ Update fields with code review
* 📝 Update example from code review
* 📝 Update docs and format from code review
* Pass model_class to schema_extra staticmethod
Resolves#1122
* Add changelog
* Apply suggestions from code review
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com>
* Fix import after rebase
* Fix test bug
* Use TypeError instead of assert as per review
* Rename var so declaration fits one one line
* tiny tweaks
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
* Implement Optional required, when creating a ModelField(required=True), make it persist
* Add test for nullable required
* Improve formatting of Undefined custom object
* Refactor field infer/creation with Undefined to make it idempotent
Needed for when _type_analysis is re-run in Generics
* Add PR changes
* Increment/update tests with code review
* Update/refactor Undefined implementation with code review
* Fix BoolUndefined as string type for mypy, not runtime
* Add docs about required Optional
* Add explicit tests for Any
* Apply code review requested changes
* move tests out of test_validators.py
* Add support for mapping types as custom root
* Incorporate feedback
* Add changes
* Incorporate feedback
* Add docs and tests
* Fix linting issue
* Incorporate more feedback
* Add more specific match
* Add mypy plugin
* Make all arguments optional for BaseSettings
* Get test coverage up
* Add changes
* Add type-checking for BaseModel.construct, and checking for from_orm
* Fix formatting and linting
* Fix the build
* Heavy refactor of plugin and mypy tests
* Make linting pass
* Handle dynamic aliases
* Better organize plugin code
* Add docs
* Add support for error codes
* Fix minor docs typo
* Rename config settings, add docstrings, and incorporate other feedback
* Incorporate feedback
* Update docs, remove dataclasses for cython
* fix mypy example
* release notes for v1
* uprev and tweaks
* Apply suggestions from code review
Co-Authored-By: dmontagu <35119617+dmontagu@users.noreply.github.com>
* tweak notes, add back link to old docs
* build changelog
* modify behaviour of the construct method
* change construct signature
* Add example for construct function (#907)
* add example for construct
* edit exporting_models
* typo
* add changes file
* code review changes
* fix bad copy paste
* extend example in docs
* use __field_defaults__ in construct