* Replacing encode_default instance check with strict type check
* Adding change notes
* Changing to dictionary indexing in tests
* Adding explicit Enum check and returning its value
* Allow passing schema_overrides to get_field_info_schema
This function was resetting schema_overrides which prevents **extras on Enum type Fields
from being saved to their json schema
* Add changes file
* Update changes/2697-sammchardy.md
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
Co-authored-by: Sam McHardy <sam.mchardy@psma.com.au>
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* Try to evaluate forward refs after model created
* Upadate docs and remove code duplication
* Update changes/2588-uriyyo.md
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* Update docs/usage/postponed_annotations.md
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* Remove unused import
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* Derive concrete subclasses for parameterised generics
* Resolve type issues
* Add negative assertions to generic subclass tests
* Remove incorrect subclassing of partial.
The type was incorrectly being picked up for this style of subclassing,
and it can be regardless inferred through cls.
* Apply feedback:
* Improve parameterisation explanation
* fix typos
* Alias Parameterisation type
* Apply suggestions from code review
* start docstring with newline.
* Use None as default over empty tuple.
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
* Combine _assigned_parameters cases in __paramaterized_bases__ of generics
* Add description for the `_assigned_parameters` variable.
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* feat(schema): enforce length in generated JSON schema for tuple type
* docs: add change file
* docs: update documentation
* simplify a bit
* always set array
* ✨ Add autocomplete support for VS Code, via dataclass_transform
* 📝 Update changes
* 📝 Add docs for VS Code
* 📝 Clarify strict type error checks alternatives, include example with cast()
* ♻️ Update BaseSettings annotation to improve editor support
keeping editor support for BaseSetting's custom Config, but preventing __config__ from showing in constructor on editors supporting dataclass_transform
* 🎨 Remove unused type: ignore comment
* 🎨 Update type annotations for BaseSettings and BaseModel to use ClassVar where suitable
to improve editor support with type annotations and dataclass_transform
* 🎨 Apply ClassVars again
* 📝 Simplify VS Code docs terms
refer mainly to Pylance and clarify the relationship with Pyright
* 📝 Add link to Pylance FAQ
Co-authored-by: PrettyWood <em.jolibois@gmail.com>
* Fix bug when mypy plugin fail on construct method call
* Update type annotation for __config__ field
* Remove type ignore
* Update changes/2753-uriyyo.md
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
Thanks to @PrettyWood for pointing me to the right place to fix this!
Since I was told that both NamedTuple and TypedDict use the same
__pydantic_model__ machinery that dataclasses do, I checked and found
that TypedDict had the same bug, and fixed that too.
Tests for both issues are included, which fail without the associated
fixes being applied.
* Added dark color scheme for docs
Added alternative, dark color scheme for docs, which should be automatically activated if user's browser presents the `prefers-color-scheme: dark` media query.
* switch icons
* add change file
Co-authored-by: PrettyWood <em.jolibois@gmail.com>
* Parse JSON for union type with complex subfields (#2936)
* style
* simplify
Co-authored-by: Christopher Bartz <c.bartz@zbw.eu>
Co-authored-by: PrettyWood <em.jolibois@gmail.com>
* Add test for type hint subclass as default
* Fix support for using a subclass of an annotation as a default
* Add changes file
* add check in test
Co-authored-by: PrettyWood <em.jolibois@gmail.com>
* Add a TypedDict class for error objects
This adds more specific typing for the dictionaries in
`ValidationError.errors()`. This shouldn't introduce any functional
change.
* quotes
* split required and not required keys
* type but be a class
* workaround cython (can't wait for v3)
Co-authored-by: PrettyWood <em.jolibois@gmail.com>
* Fix: _pydantic_post_init() reassigns __dict__ and removes properties added to the object, for example in __new__(), breaking integration with SQLAlchemy and other libraries #3043
* Added changes file
* Fix 2860
When dealing with JsonWrapper, replace the inner type when constructing
a a generic model.
* tweak and schema test
Co-authored-by: PrettyWood <em.jolibois@gmail.com>