* fix: handle basemodel fallback for custom encoders
* put back old behaviour and add to_dict
* typo
Co-authored-by: Christian Bundy <christianbundy@fraction.io>
Co-authored-by: Christian Bundy <christianbundy@fraction.io>
* Add exclude/include as field parameters
- Add "exclude" / "include" as a field parameter so that it can be
configured using model config (or fields) instead of purely at
`.dict` / `.json` export time.
- Unify merging logic of advanced include/exclude fields
- Add tests for merging logic and field/config exclude/include params
- Closes#660
* Precompute include/exclude fields for class
* Increase test coverage
* Remove (now) redundant type checks in Model._iter: New
exclusion/inclusion algorithms guarantee that no sets are passed further down.
* Add docs for advanced field level exclude/include settings
* Minimal optimization for simple exclude/include export
Running benchmarks this vs. master is at:
this: pydantic best=33.225μs/iter avg=33.940μs/iter stdev=1.120μs/iter version=1.7.3
master: pydantic best=32.901μs/iter avg=33.276μs/iter stdev=0.242μs/iter version=1.7.3
* Apply review comments on exclude/enclude field arguments
* Fix/simplify type annotations
* Allow both ``True`` and ``Ellipsis`` to be used to indicate full field
exclusion
* Reenable hypothesis plugin (removed by mistake)
* Update advanced include/include docs to use ``True`` instead of ``...``
* Move field info exclude/include updates into FieldInfo class
This way, the model field object does not need to concern itself with
dealing with field into specific fields.
(Same was done for alias in a previous commit).
* remove double back tick in markdown.
Co-authored-by: Samuel Colvin <samcolvin@gmail.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>
* 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>
* Rename skip-defaults, and add ability to exclude actual defaults
* Add __defaults__ and deprecation warnings
* Add note about `skip_defaults` to docs
* Incorporate feedback
* Add tests and changes
* Fix reference to .json()
* starting insert prints
* working exec_script
* remove prints, fix exec_examples.py
* more cleanup of examples, better model printing
* upgrade netlify runtime
* extra docs deps
* few more small tweaks
* 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