Samuel Colvin
f219501ff0
tests for missing user
2020-06-29 22:30:04 +01:00
John Carter
ff20477521
Apply __modify_schema__ on enum schema rather than fields that use it ( #1581 )
...
* Apply __modify_schema__ on enum schema rather than fields that use it
Resolves #1576
* tweak test
* correct linting :-(
Co-authored-by: Samuel Colvin <s@muelcolvin.com >
2020-06-29 13:22:27 +01:00
ll H
8aebba2c35
check ModelField().validate_always when inheriting ( #1545 )
...
fix #1155
* fix issure #1155
* add changes.1545-dcHHH.md
* improve change description
Co-authored-by: dchhh <hudacong@geetest.com >
Co-authored-by: Samuel Colvin <samcolvin@gmail.com >
2020-06-29 11:04:44 +01:00
PrettyWood
e5fff9ccd0
fix: make pydantic errors (un)pickable ( #1630 )
...
* fix: make pydantic errors (un)pickable
closes #1616
* add typing
* refactor: rename kwargs into ctx
2020-06-27 19:31:23 +01:00
Patrick Wang
5a2d78765a
squash internal __root__ models in .dict() ( #1607 )
...
fix #1414
* flatten internal __root__ models
* add 1414 changes doc
2020-06-27 14:55:17 +01:00
Mlbiche
113921c6c5
Update datetime parser to support negative timestamps ( #1605 )
...
- Negative timestamps corresponds to dates before 1970/1/1
2020-06-27 14:52:20 +01:00
PrettyWood
7ac9faf031
(fix) use right type check when modifying schema ( #1562 )
...
fix #1552
2020-06-27 14:12:36 +01:00
PrettyWood
c59db275dc
fix(field): remove some side effects of default_factory ( #1504 )
...
* Avoid some side effects of default factory
- by calling it only once if possible (fix #1491 )
- by not setting the default value in the schema (fix #1520 )
* refactor: ensure type is set when using default_factory
2020-06-27 14:02:29 +01:00
Samuel Colvin
d122b1dbdc
remove RedisDsn.user_required = True ( #1658 )
...
* remove RedisDsn.user_required = True
* update docs
2020-06-26 12:02:57 +01:00
dependabot-preview[bot]
d726497b5b
Bump mypy from 0.780 to 0.782 ( #1659 )
...
Bumps [mypy](https://github.com/python/mypy ) from 0.780 to 0.782.
- [Release notes](https://github.com/python/mypy/releases )
- [Commits](https://github.com/python/mypy/compare/v0.780...v0.782 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-06-26 12:02:32 +01:00
Samuel Colvin
8e00077cc4
uprev test dependencies ( #1657 )
2020-06-25 21:40:34 +01:00
dependabot-preview[bot]
70d531ff4c
Bump mypy from 0.770 to 0.780 ( #1598 )
...
* Bump mypy from 0.770 to 0.780
Bumps [mypy](https://github.com/python/mypy ) from 0.770 to 0.780.
- [Release notes](https://github.com/python/mypy/releases )
- [Commits](https://github.com/python/mypy/compare/v0.770...v0.780 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
* fix mypy errors and remove AnyType
* fix python 3.6 inconsistencies
* linting
* tweak typing
* fix typing for 3.6
* bump
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com >
2020-06-25 19:24:37 +01:00
PrettyWood
0cee311be5
feat(settings): allow custom encoding for dotenv files ( #1620 )
...
closes #1615
2020-06-11 11:04:08 +01:00
PrettyWood
329b1d3e7b
fix: type hints on BaseConfig ( #1618 )
...
closes #1614
2020-06-09 10:32:07 +01:00
wangpeibao
5e82689c79
Change schema frozenset ( #1560 )
...
* add frozenset to field_class_to_schema
* add change.md
* add my test
* format my test
* remove print()
* just test
* return to original code
Co-authored-by: wangpeibao <wangpeibao@troila.com >
Co-authored-by: Samuel Colvin <s@muelcolvin.com >
2020-06-02 11:03:12 +01:00
dependabot-preview[bot]
f89e372bda
Bump flake8 from 3.8.1 to 3.8.2 ( #1553 )
...
Bumps [flake8](https://gitlab.com/pycqa/flake8 ) from 3.8.1 to 3.8.2.
- [Release notes](https://gitlab.com/pycqa/flake8/tags )
- [Commits](https://gitlab.com/pycqa/flake8/compare/3.8.1...3.8.2 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-31 15:23:37 +01:00
Shawn Wall
4f9e77d213
1541 UUID bytes support for 16 byte strings / BINARY(16) ( #1542 )
...
* [1541] add fallback to UUID instantiation through bytes
* [1541] added changes md file
* Update UUID docs for bytes/bytearray
Co-authored-by: Shawn Wall <shawn@civicscience.com >
2020-05-31 15:05:53 +01:00
dependabot-preview[bot]
cb8e7e0930
Bump pytest-cov from 2.8.1 to 2.9.0 ( #1555 )
...
Bumps [pytest-cov](https://github.com/pytest-dev/pytest-cov ) from 2.8.1 to 2.9.0.
- [Release notes](https://github.com/pytest-dev/pytest-cov/releases )
- [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst )
- [Commits](https://github.com/pytest-dev/pytest-cov/compare/v2.8.1...v2.9.0 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-31 14:58:51 +01:00
dependabot-preview[bot]
d6f446fdc0
Bump cython from 0.29.17 to 0.29.19 ( #1544 )
...
Bumps [cython](https://github.com/cython/cython ) from 0.29.17 to 0.29.19.
- [Release notes](https://github.com/cython/cython/releases )
- [Changelog](https://github.com/cython/cython/blob/master/CHANGES.rst )
- [Commits](https://github.com/cython/cython/compare/0.29.17...0.29.19 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-05-31 14:58:38 +01:00
John Carter
827388b4fe
Add a test assertion that default_factory can return a singleton ( #1523 )
2020-05-31 14:51:50 +01:00
Calvin Young
5195e55c10
Enums as separate models ( #1432 )
...
* Updates schema() to generate enums as separate models
* Fixes mypy annotations
* Adds changes file
* Fixes comment
* Removes unused import
* Fixes test case
* Fixes missing partial branch in test coverage
* Resolves PR comments
* 🐛 Include enums in flat model schema handling
as they now have independent schemas, they kinda behave like top-level models, and should be taken into account for top level definitions
* ✅ Add test for coverage
* 🐛 Use Type[Enum] as type for consistency
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com >
2020-05-23 19:11:34 +01:00
Daniel Burkhardt Cerigo
913025ac3f
FIX: validation on model attribute with nested Literal breaks ( #1364 )
...
* Add tests for nested literals validator
* Implement flatten literal in validator
* Add test for flatten literal
* Add changelog entry
* Add test skip markers if not Literal
* Refactor: use improved all literals implementation
From Github user PrettyWood, see PR https://github.com/samuelcolvin/pydantic/pull/1364
* Add testing for typing module
Includes moving corresponding tests.
* Remove unnecessary type hint
* Move all literals test to test_utils
2020-05-23 13:01:43 +01:00
Stephen Bunn
1eeb225c67
Fix NameEmail equality comparison ( #1527 )
...
* Adding appropriate __eq__ method for NameEmail
- Introducing new test assertions for NameEmail
Signed-off-by: Stephen Bunn <stephen@bunn.io >
* Adding change doc for NameEmail.__eq__
Signed-off-by: Stephen Bunn <stephen@bunn.io >
* Update pydantic/networks.py
Co-authored-by: Samuel Colvin <samcolvin@gmail.com >
* Update tests/test_networks.py
Co-authored-by: Samuel Colvin <samcolvin@gmail.com >
* Fixing indentation issue left over from suggestion
Signed-off-by: Stephen Bunn <stephen@bunn.io >
Co-authored-by: Samuel Colvin <samcolvin@gmail.com >
2020-05-19 08:59:33 +01:00
Arseny Boykov
0b9b308ca5
Make signature class only ( #1466 )
...
* Make signature class only
* Add changes file
2020-05-18 21:41:24 +01:00
Samuel Colvin
c8906ce810
uprev all test and docs dependencies ( #1528 )
2020-05-18 21:31:23 +01:00
Samuel Colvin
5067508eca
fix tests and coverage for #1209
2020-05-01 10:32:39 +01:00
Selim Belhaouane
881df8bde7
move const validator to post validators. fixes #1410 ( #1446 )
2020-04-30 19:05:42 +01:00
Mostapha Sadeghipour Roudsari
a4adf892dc
Remove extra allOf keys in schema ( #1438 )
...
resolves #1209
2020-04-30 18:56:11 +01:00
Stephen Brown II
a5b0e741e5
Update pytest and pytest sugar, fix test ( #1312 )
...
Bumps [pytest](https://github.com/pytest-dev/pytest ) from 5.3.5 to 5.4.0.
- [Release notes](https://github.com/pytest-dev/pytest/releases )
- [Changelog](https://github.com/pytest-dev/pytest/blob/master/CHANGELOG.rst )
- [Commits](https://github.com/pytest-dev/pytest/compare/5.3.5...5.4.0 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
Update pytest and pytest-sugar, fix test for
- https://github.com/Teemu/pytest-sugar/pull/188 makes pytest-sugar compatible with pytest 5.4+
- pytest 5.4.0 flipped the signs for assert statement display, so this flips the string to match.
Fix test_fastapi.sh permissions
2020-04-30 13:11:02 +01:00
Atheuz
9238e3d98f
include format with secret types ( #1424 )
...
* include format with secret types
* fix: fix pr comments.
Co-authored-by: Lasse Gravesen <lasse.gravesen@falcon.io >
2020-04-30 13:09:45 +01:00
Jesse VanderWees
833d33dc0f
ConstrainedFloat schema: differences between IEEE floats and json ( #1422 )
...
* ConstrainedFloat schema: account for differences between IEEE floats and json
* add changes
* Update changes/1417-vdwees.md
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com >
* Update changes/1417-vdwees.md
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com >
* fixup
* Update pydantic/types.py
Difference of styles :)
Co-Authored-By: Samuel Colvin <samcolvin@gmail.com >
* merge _schema_ieee_compatibility_transform into parent method
* capitalize
* use type_, not outer_type_
Co-authored-by: Jesse VanderWees <jesse.vanderwees@kisters-bv.nl >
Co-authored-by: Samuel Colvin <samcolvin@gmail.com >
2020-04-30 13:08:23 +01:00
dependabot-preview[bot]
845e1eb075
Bump cython from 0.29.16 to 0.29.17 ( #1442 )
...
Bumps [cython](https://github.com/cython/cython ) from 0.29.16 to 0.29.17.
- [Release notes](https://github.com/cython/cython/releases )
- [Changelog](https://github.com/cython/cython/blob/master/CHANGES.rst )
- [Commits](https://github.com/cython/cython/commits )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-04-30 13:05:53 +01:00
dependabot-preview[bot]
38f382853d
Bump pytest-sugar from 0.9.2 to 0.9.3 ( #1441 )
...
Bumps [pytest-sugar](https://github.com/Teemu/pytest-sugar ) from 0.9.2 to 0.9.3.
- [Release notes](https://github.com/Teemu/pytest-sugar/releases )
- [Changelog](https://github.com/Teemu/pytest-sugar/blob/master/CHANGES.rst )
- [Commits](https://github.com/Teemu/pytest-sugar/commits )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-04-30 13:04:53 +01:00
PrettyWood
b2871468b7
Fix :: Signature generation with extra: allow never uses a field name ( #1420 )
...
* fix :: signature generation does not use field names
fix #1418
* fix :: use field.outer_type_ when generating signature
`extra_data: Dict[str, str]` would generate `extra_data: str` in the signature
* tweak to keep signature kwargs name
Co-authored-by: Samuel Colvin <s@muelcolvin.com >
2020-04-23 13:42:06 +01:00
PrettyWood
3cd8b1ee2d
Fix :: avoid mutating Field default value ( #1413 )
...
fix #1412
2020-04-22 11:25:13 +01:00
dependabot-preview[bot]
d280bdca41
Bump pytest-mock from 3 to 3.1.0 ( #1407 )
...
Bumps [pytest-mock](https://github.com/pytest-dev/pytest-mock ) from 3 to 3.1.0.
- [Release notes](https://github.com/pytest-dev/pytest-mock/releases )
- [Changelog](https://github.com/pytest-dev/pytest-mock/blob/master/CHANGELOG.rst )
- [Commits](https://github.com/pytest-dev/pytest-mock/compare/v3.0.0...v3.1.0 )
Signed-off-by: dependabot-preview[bot] <support@dependabot.com >
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-04-22 11:16:16 +01:00
Stephen Brown II
cab6313798
Allow subclasses of known types to be encoded with superclass encoder ( #1291 )
...
* 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 >
2020-04-18 17:11:00 +01:00
AlexECX
52af916206
Prevent mutation of excludes/includes ( #1404 )
...
* Don't mutate excludes/includes dictionaries inside ValueItems
* Make exludes/includes read-only
* Add changelog
* Update 1404-AlexECX.md
* Add test for includes/excludes immutability
2020-04-18 17:09:06 +01:00
AlexECX
92b0bbc0f3
Bug fix: excludes skipped for aliased nested fields when by_alias=True ( #1398 )
...
* Typo in test function name, fix #1397
* Always use a field's real name for includes/excludes
* Add changes.md file
2020-04-18 17:05:20 +01:00
Atheuz
097762b67a
make secret types idempotent ( #1330 )
...
* make secret types idempotent
* remove idempotent from secret types example.
add note to docs for idempotently creating secret types.
use isinstance for comparing when creating secret types idempotently.
add assert for idempotent secret types test.
* tweaks
Co-authored-by: Lasse Gravesen <lasse.gravesen@falcon.io >
Co-authored-by: Samuel Colvin <s@muelcolvin.com >
2020-04-18 16:10:36 +01:00
Samuel Colvin
9a8bda5b16
confirm shallow copy works as expected, ( #1394 )
...
* confirm shallow copy works as expected, fix #1383
* fix linting
2020-04-15 22:58:56 +01:00
Kittipat Virochsiri
c5af109e57
Fix argument name collision ( #1367 )
...
fix #1366
* Fix argument name collision
* change qoutes
* make mypy happy?
* Adding change file
2020-04-15 22:52:07 +01:00
Dima Boger
ccd5f7b8f3
Replace exception to silent passing in mypy plugin for non-Var attributes ( #1348 )
...
* Replace exception to silent passing in mypy plugin for non-Var attributes
* Add a history file
2020-04-15 22:46:22 +01:00
PrettyWood
2c05415bae
accept None as value for all optional fields ( #1307 )
...
* ignore pyenv generated file
* Allow `None` as input to all optional list fields
* skip test on python 3.6
* fix mypy error, line length
Co-authored-by: Samuel Colvin <s@muelcolvin.com >
2020-04-15 22:43:38 +01:00
Danny Weinberg
a015cd01ba
Have BaseModel inherit from Representation ( #1319 )
...
* Have BaseModel inherit from Representation
This changes the inheritance so that `BaseModel` *actually* inherits from `Representation`, rather than just having the same methods as it. While this doesn't actually affect the runtime, it does make mypy happier.
Fixes https://github.com/samuelcolvin/pydantic/issues/1310
* Add '__dict__' back into slots
2020-04-15 22:07:16 +01:00
laevilgenius
7bebf2bdc3
Allow schema_extra to be a classmethod ( #1306 )
...
* Remove FunctionType check
* Fix mypy
* Add classmethod test
* Add instance method test
* Fix linting
* model_class
* Remove __call__ implementation
* Fix linting for py3.8
* noqa tweak
* undo mistake sorry, :-/
Co-authored-by: Samuel Colvin <s@muelcolvin.com >
2020-04-15 22:06:25 +01:00
George Sakkis
b749e224c9
Allow None for (virtual) superclasses of NoneType ( #1266 )
...
* Set allow_none to True for (virtual) superclasses of NoneType
* Add full support for Hashable
2020-04-15 16:45:23 +01:00
Samuel Colvin
76ebdb915d
combined uprev of packages ( #1395 )
...
* combined uprev of packages
* unused f-strings
* scroll-spy on docs
2020-04-15 16:40:21 +01:00
PrettyWood
aaec3c9c15
Remove typing-extension dependency on python 3.8 ( #1342 )
...
* Remove typing-extension dependency on python 3.8
* retrigger CI
* retrigger CI bis
2020-03-26 15:44:11 +00:00
Samuel Colvin
d495710303
Cleanup ci & coverage ( #1329 )
...
* fix badges and deploy check
* fix coverage and correct check_tag.py
2020-03-21 18:14:17 +00:00