Commit Graph

23 Commits

Author SHA1 Message Date
Samuel Colvin 27323aa8b2 fix for python 3.8 (#396)
* fix for python 3.8

* history and tweak types in main.py
2019-02-15 18:29:13 +00:00
Samuel Colvin baade9a117 rebuild validator arguments (#388)
* rebuild validator arguments

* cleanup and tests

* update docs
2019-02-13 10:31:36 +00:00
pyup.io bot a85334682c Scheduled monthly dependency update for February (#382)
* Update flake8 from 3.6.0 to 3.7.4

* Update mypy from 0.650 to 0.660

* Update pycodestyle from 2.4.0 to 2.5.0

* Update pyflakes from 2.0.0 to 2.1.0

* Update pytest from 4.0.2 to 4.2.0

* Update pytest-cov from 2.6.0 to 2.6.1

* fix test linting
2019-02-04 20:31:42 +00:00
Samuel Colvin 0f7f8fcf14 allow validate_always with default=None (#344)
* allow validate alwasy with None, fix #132

* prevent whole validators being called on subitems

* improve Optional validators edge cases
2018-12-29 11:07:45 +00:00
Samuel Colvin eeb48fbeac don't call validators on keys of dictionaries, fix #254 (#342) 2018-12-28 16:07:48 +00:00
Samuel Colvin c725a4a5e5 prevent validators being called repeatedly after inheritance (#327)
* prevent validators being called repeatedly after inheritance

* fix linting

* more tests
2018-12-25 22:33:18 +00:00
Hugo Duncan 3249330b80 Properly set Config in create_model (#320)
* Properly set Config in create_model

Set the Config attribute in create_model, so it is found by the
MetaModel.

* Black formatting fixes

* Remove uneeded validator logic

* Use single quotes

* Add return value to inherit_validators

* Refactor inherit_validators

* Add HISTORY.rst entry

* Address feedback

* Extend existing validator test cases and remove field aliasing

* Add test cases for validators inherted from parent

* Make test case names consistent with where validators are configured

* Add detail create_model validator inheritance tests
2018-12-07 20:27:42 +00:00
Samuel Colvin 9ff946d2fa PyObject = None, and Pattern (#306)
* PyObject = None, fix #305

* history formatting on pypi

* fix history rendering in setup

* allow Pattern validation, fix #303

* fix for python3.7

* fix linting

* proper processing for regex pattern errors
2018-11-18 16:11:29 +00:00
Samuel Colvin 15850a43c5 moving to black (#287)
* moving to black

* put back flake8

* remove isort option

* putting back isort

* uprev pycodestyle

* remove black from docs/examples

* tweak parse.py
2018-11-15 11:30:07 +00:00
Nicholas Hyatt 10414a7a04 use type() in int validator (#264)
* use type() in int validator to avoid returning a bool since bool is and instance of int

* add note to HISTORY.rst

* add tests & add username and PR # to HISTORY.rst

* use not ininstance(v, bool) to allow int subclassing
2018-09-21 10:37:16 +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 9021d94e31 validator exception typo, fix #150 (#191) 2018-06-04 11:11:09 +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
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 a3a9b14531 validate attributes of parent models (#141)
* validate attributes of parent models, fix #137

* add history
2018-03-25 17:46:55 +01:00
Samuel Colvin a8096959e2 check for invalid validators (#140)
* check for invalid validators

* documentation and history
2018-03-25 16:41:48 +01:00
Samuel Colvin 89201f08b0 add wildcard validators (#128)
* add wildcard validators

* update docs and history

* more tests

* history links
2018-02-06 19:32:30 +00:00
Samuel Colvin 7050654062 better tests for validator checks 2017-11-08 15:39:44 +00:00
Samuel Colvin ed2b3f2afd errors for invalid validator use 2017-11-08 15:36:19 +00:00
Samuel Colvin acf3128dcd Validator always (#102)
* validators called always, fix #100

* testing validate always validators

* adding docs
2017-11-08 14:37:01 +00:00
Samuel Colvin ae6f5e7192 prevent duplicate validators (#101)
* prevent duplicate validators

* uprev and history
2017-11-08 13:53:14 +00:00
Samuel Colvin 91f962e533 replace values() with dict() (#99)
* replace values(), with dict(), fix #98

* add history and test
2017-11-07 13:28:42 +00:00
Samuel Colvin dfc5924936 Better validators (#97)
* working on improved validators

* full tests for validators

* tweask

* tweaking fields.py

* adding docs

* add history

* fix classmethod validators
2017-11-07 13:06:44 +00:00