Commit Graph

223 Commits

Author SHA1 Message Date
Samuel Colvin f48cb7b93c allow arbitrary times in Settings (#229) 2018-07-12 20:25:10 +01:00
Evghenii Goncearov a0e0aa4f79 Docs for json type (#228) 2018-07-11 15:08:51 +01:00
Samuel Colvin 1dc294015d cleaning up _populate_sub_fields, support tuples (#227)
* cleaning up _populate_sub_fields

* support tuples, fix #12

* fix, history and docs

* rename _create_sub_type
2018-07-10 18:45:15 +01:00
Samuel Colvin facfbddb91 tweak _validate_json 2018-07-10 17:22:13 +01:00
Evghenii Goncearov c31b8d6719 Json type (#214)
* Json type

* Sort imports

* one more unsorted import

* Changed the way Json type is defined

* Fix Function is too complex (C901) warning

* Fixed remarks

* Fix additional remarks

* Additional test

fix #195
2018-07-10 15:38:28 +01:00
Samuel Colvin 03517e4e07 fix FilePath and DirectoryPath (#226) 2018-07-07 16:58:58 +01:00
Nikita Grishko 489a1d32b1 add `by_alias argument in .dict() and .json()` model methods (#222)
* add ``by_alias`` argument in ``.dict()`` and ``.json()`` model methods #205

* review fixes

fix #205
2018-07-07 15:06:55 +01:00
Samuel Colvin 725b3c3bcf uprev 2018-07-05 14:48:47 +01:00
Samuel Colvin f6643d60f9 add validate_model (#224)
* add validate_model, fix #221

* errors None from validate_model if ok
2018-07-05 14:42:40 +01:00
Samuel Colvin c0413c8896 list, set, tuple validation (#225)
* list, set, tuple validation, fix #202

* update HISTORY.rst
2018-07-04 16:32:42 +01:00
Nikita Grishko c002c490ae add `NewType` support #115 (#223)
* add ``NewType`` support #115

* updated history

fix #115
2018-07-04 16:11:55 +01:00
Nikita Grishko f2190c4b24 uprev 2018-07-02 10:08:29 -07:00
Samuel Colvin 85f8a6b60e fix benchmarks with 3.7 (#219) 2018-07-02 12:28:46 +01:00
pyup.io bot 9f83ca48b9 Scheduled monthly dependency update for July (#217)
* Update sphinxcontrib-websupport from 1.0.1 to 1.1.0

* Update mypy from 0.600 to 0.610

* Update pycodestyle from 2.3.1 to 2.4.0

* Update pytest from 3.6.0 to 3.6.2

* revert pycodestyle agaaaain
2018-07-02 12:12:01 +01:00
Samuel Colvin a821cbfea9 update history 2018-07-02 12:11:38 +01:00
Evghenii Goncearov 73015d2a72 Allow arbitrary types in model (#209)
* Allow arbitrary types in model

* Replaced ConfigError with RuntimeError

* Corrections of the ArbitraryTypeError exception class
2018-07-02 12:08:43 +01:00
layday 8f42e515d5 Add support for Python 3.7 (#216)
* Add support for Python 3.7

* fixup! Add support for Python 3.7

* fixup! Add support for Python 3.7

* fixup! Add support for Python 3.7
2018-07-01 00:26:07 +01:00
Nikita Grishko d43ab483ee fix schema creation docs (#212)
* fix schema creation docs

* review fixes
2018-06-30 23:06:39 +01:00
Samuel Colvin 37364a05b9 implement JSON serialisation (#210)
* implement JSON serialisation, fix #133

* documenting JSON serialisation

* fix coverage
2018-06-28 18:21:45 +01:00
Samuel Colvin 596ddac02e uprev 2018-06-28 13:07:57 +01:00
Samuel Colvin dd8d013e10 Schemas (#190)
* starting field and model schemas

* field.schema()

* sub-models working

* move default in Schema and tests

* adding schema

* tweak docs
2018-06-28 13:06:24 +01:00
Nikita Grishko f8c1a350f4 add `FilePath and DirectoryPath` types #10 (#208)
* add ``FilePath`` and ``DirectoryPath`` types #10

* review fixes

* improve tests

* simplify errors
2018-06-28 11:04:00 +01:00
clip d2745065f5 fix typo (#207)
* fix typo

* fix test
2018-06-24 17:52:56 +01:00
Ben Demaree 29d61400f1 Fix doc references to values and add some clarifications (#204) 2018-06-19 16:39:05 +01:00
Samuel Colvin 9338c413c7 remove msgpack (#201)
* remove msgpack

* update history
2018-06-18 12:20:10 +01:00
Nikita Grishko 4f19d2b94a Strict validation of list, set and tuple (#86) (#200)
* Strict validation of `list`, `set` and `tuple` (#86)

* review fixes
2018-06-13 19:11:01 +01:00
Samuel Colvin 7e44bcaf7a uprev 2018-06-11 13:11:45 +01:00
Samuel Colvin f0f9de5f96 improve docs on error handling (#198)
* improve docs on error handling

* change ValidationError signature

* cleanup

* rename _raw_errors > raw_errors

* improve _display_error_type_and_ctx
2018-06-11 13:06:50 +01:00
Samuel Colvin 043cf63199 remove TODO comment, ref #195 2018-06-11 11:15:02 +01:00
Nikita Grishko 10be4dc0bc Removed extra f-strings (#196) 2018-06-11 11:12:41 +01:00
Jasper Schulz 3ef595556c Added le and ge bounds to constrained numerics. (#194)
* Added `le` and `ge` bounds to constrained numerics.

* Addressed comments.

* Addressed @Gr1N comments.

* Removed comment.
2018-06-08 10:32:26 +01:00
Samuel Colvin e57f8c4725 correct and complete #188 (#193) 2018-06-07 09:19:02 +01:00
Samuel Colvin 2687fae6e9 copy defaults to values, fix #154 (#192) 2018-06-06 16:36:40 +01:00
Samuel Colvin 9021d94e31 validator exception typo, fix #150 (#191) 2018-06-04 11:11:09 +01:00
Nikita Grishko 3f53cb5980 Update documentation (#162) (#189)
* Update documentation (#162)

* More docs about error handling
2018-06-04 10:55:48 +01:00
Samuel Colvin 95aba150b2 gt, lt, (#188)
* gt, lt, fix #176

* change test names
2018-06-02 20:53:10 +01:00
Samuel Colvin 31f5f9c267 Cleanup 183 (#187)
* fix coverage

* use change_exception

* simplifying get_exc_type

* improve to_snake_case

* improve change_exception

* remove to_snake_case completely

* correct comment
2018-06-02 18:08:07 +01:00
pyup.io bot cbfbe6b11c Scheduled monthly dependency update for June (#186)
* Update sphinx from 1.7.4 to 1.7.5

* Update attrs from 17.4.0 to 18.1.0

* Update pycodestyle from 2.3.1 to 2.4.0

* Update pyflakes from 1.6.0 to 2.0.0

* Update pytest from 3.5.1 to 3.6.0

* Update pytest-isort from 0.1.0 to 0.2.0

* Update pytest-mock from 1.9.0 to 1.10.0

* revert pycodestyle, yawwwwn
2018-06-02 15:35:52 +01:00
Nikita Grishko 4f4e22ef47 Error context and message (#183)
* POC of error context and message

* Move type errors to the `errors.py` module; Change errors interface a bit

* Rename `.as_dict()` to `.dict()`

* Fix `PydanticErrorMixin` constructor

* Rename `exceptions.py` to `error_wrappers.py`

* Do not include nullable `ctx`

* Fix tests

* Added `int_validator`; Added `IntegerError`

* Added `float_validator`; Added `FloatError`

* Get rid of `__mro__` in prior of `exc.code`

* Removed `min_number_size` and `max_number_size` from config (#174)

* Added `NumberMinSizeError` and `NumberMaxSizeError`

* Added `NoneIsNotAllowedError`

* Added `EnumError`

* Added `path_validator`; Added `PathError`

* Added `DictError`

* Added `ListError`

* Added `TupleError`

* Added `SetError`

* Added `datetime` related errors

* Added `bytes` and `str` related errors

* Added `SequenceError`

* Improved code coverage

* Display error context in string representation of validation error

* Redefine error message templates using config

* Review fixes

* Updated changelog
2018-05-31 14:35:38 +01:00
Samuel Colvin 0698384788 fix coverage 2018-05-24 19:24:03 +01:00
Samuel Colvin 1bf385f5bd adding gitter badges 2018-05-24 16:58:18 +01:00
Ben Demaree 62d39d90a7 Make model dump/load symmetric for aliased fields (#160)
* Make dump/load symmetric for aliased fields

* Only populate model fields by alias if enabled

* Document Config.allow_population_by_alias

* Update history

* Fix doc formatting

* Fix doc errors
2018-05-24 16:46:03 +01:00
Nikita Grishko 31683f8dc4 Errors format (#179)
* Get rid of `track` in errors

* Move `display_as_type` func into utils module

* Get rid of error as `namedtuple`

* Renamed `Error.index` to `Error.loc`

* New way to get error type

* New way to get error message

* New errors format

* Renamed `flatten_errors` property to `flat_errors`

* `__slots__` for `Error` and `ValidationError`

* `loc` as `tuple`

* Tests

* Review fixes

* `flatten_errors` as generator
2018-05-23 14:50:04 +01:00
Samuel Colvin 9061cb20ba prepare for deploy 2018-05-10 16:05:39 +01:00
Samuel Colvin 3eec750640 allow custom get_field_config (#165)
* allow custom get_field_config, fix #159

* improving config inheritance
2018-05-10 12:12:37 +01:00
Nikita Grishko 99d7eafa61 add `Decimal, ConstrainedDecimal and condecimal` types #170 (#175) 2018-05-10 12:11:45 +01:00
pyup.io bot f4207281a0 Scheduled monthly dependency update for May (#168)
* Update sphinx from 1.7.2 to 1.7.4

* Update mypy from 0.580 to 0.590

* Update pycodestyle from 2.3.1 to 2.4.0

* Update pytest from 3.5.0 to 3.5.1

* Update pytest-mock from 1.7.1 to 1.9.0

* correct pycodestyle and mypy

* update history
2018-05-05 14:55:55 +01:00
Nikita Grishko 0ee1ffa52a fix type annotations for exotic types; re-use type validators in exotic types (#171) 2018-05-05 14:08:23 +01:00
YannLuo 89b37d8473 modify some inconsistent docstrings and annotations, solve #169 (#173)
* modify some inconsistent docstrings and annotations

* modify HISTORY.rst
2018-05-04 10:55:31 +01:00
Nikita Grishko b4d3a2d544 add `UUID1, UUID3, UUID4 and UUID5` types (#167) (#167) 2018-05-02 22:49:55 +01:00