* ✨ Add support for Decimal-specific configs in Field()
* ✅ Add/update tests for condecimal and variant with Field()
* 📝 Update schema - Field() docs including Decimal-specific configs
* 📝 Add PR changes file
* Add unique items validation to constrained list
* add unique_items to field and schema
add failover for unhashable types
check keyword value to call the validator
add some tests
* update unique_items validation
Co-authored-by: Nuno André Novo <nuno.novo@forensic-security.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* add repr parameter to hide a field from repr()
* fix styling issues
… found by flake8.
* fix type annotation issues
* correctly name changes file
* test hiding default values from repr() of a Field
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* 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>
* doc(schema): use boldface to highlight a note
* doc(schema): fix small formatting typo
* doc(schema): attempt to fix the callout
* docs(schema): indent the callout
* introduce read_only Field constraint
* add changes markdown for read_only constraint
* add readOnly property to json schema generation
* Revert "add readOnly property to json schema generation"
This reverts commit dad3d3e23a7336aa978dcdedc157559ea102fa54.
* change read_only field constraint to allow_mutation
* Update change notes for allow_mutation
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
* allow field constraints defaults to be not None
* remove unnecessary test after constraint refactor
* push used constraints check back to schema functions
* use tuple item name descriptions instead of indexes
* move get_constraints function to method on FieldInfo
* address code review comments for minor changes
* Apply suggestions from code review
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
* fix merge conflict
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
* Infer root type from Annotated
* Extract Field from Annotated
* Add changelog
* Extend existing get_args/get_origin
* Fix Annotated on py3.6 without typing-extensions
* Handle Ellipsis default
* Fix field reuse after FieldInfo.default mutation
* Fix ci
* ignore Pipfile, .lock files
* add ref_template option
use a string.Template instead of a ref_prefix to allow for more varied`$ref`s to be created.
Template string is expected to have $model_name `identifier `
* formatting / linting
* add changes
* typo
* use string.format instead of string.Template
* remove ref_prefix default
if no `ref_prefix` provided, use the `template_default`
* use ref_template in field_singleton_schema
* fix test_schema_with_ref_template
* add parameters for `test_schema_with_refs`
test name change
test for key error
* provide ref_template default argument
* fix linting
* fix mypy and coverage
* docs and correct model_schema usage
* fastAPI tests actualy caught an error
* linting
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* 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