Commit Graph

36 Commits

Author SHA1 Message Date
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
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
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 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 f88e5925b5 add strip_whitespace option for ConstrainedStr and constr (#163) 2018-04-25 02:29:25 +07:00
Samuel Colvin 2b8216ab72 remove use of ordered dict (#126)
* remove use of ordered dict

* add history
2018-02-06 15:45:17 +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 b10566841e Less verbose errors (#90)
* make errors less verbose, fix #71

* remove track too if null

* update docs

* better dict error, fix #74

* add history
2017-10-23 20:06:48 +01:00
Samuel Colvin 5efa54d80d annotation only fields first 2017-07-08 19:01:38 +01:00
Samuel Colvin 044fd42f4f parser methods (#58), fix #39
* working on parsers

* starting parse tests

* proper tests for parse

* adding parse docs

* tweaks and history

* add test for datetime direct, fix tests

* tweak docs
2017-07-08 18:39:24 +01:00
Samuel Colvin 8d5fadb2e8 constr None, fix #59 2017-07-08 18:30:13 +01:00
Samuel Colvin 378c96888e simplifying errors 2017-07-08 18:22:57 +01:00
Samuel Colvin d8ac3f528b inheritance and config, fix #55 2017-07-08 13:48:32 +01:00
Samuel Colvin 53ba356158 stricter str validation (#52)
* inheritance bug, fix #49

* stricter str validation, fix #45

* couple for test cases

* adding StrictStr
2017-06-21 17:59:58 +01:00
Samuel Colvin dfcc199769 inheritance bug, fix #49 2017-06-21 14:58:13 +01:00
Samuel Colvin 6923e5e677 models allowing immutability (#44)
* working on models allowing immutability, ref #38

* up complexity

* use noqa c901

* fixing fields with new processor

* allow_mutation config and tests

* uprev, history and docs

* fix typos
2017-06-13 09:52:47 +01:00
Samuel Colvin ff3fa95eb0 convert values to a function, fix #28 (#43) 2017-06-07 22:40:09 +01:00
Samuel Colvin c81ec9aeec add support for annotation only fields (#41)
* add support for annotation only fields, fix #34

* adding tests with mypy

* adding docs for mypy usage

* adding mypy failure test

* adding alias tests

* tweak mypy tests
2017-06-07 19:56:46 +01:00
Samuel Colvin ea88afb212 allow aliases 2017-05-31 13:41:53 +01:00
Samuel Colvin 9ecae91dad allow Any, fix #21 2017-05-31 12:07:29 +01:00
Samuel Colvin 94402d0627 allow set validation, fix #17 2017-05-31 11:59:41 +01:00
Samuel Colvin 0757af6e5e make values recursive, fix #24 2017-05-31 11:44:31 +01:00
Samuel Colvin 90a2b6bfe3 fix enum validators ignore_extra on settings, fix #13 2017-05-11 22:19:11 +01:00
Samuel Colvin 35add310cc improve error display 2017-05-10 12:43:29 +01:00
Samuel Colvin 5cedb3e8e1 cleaner support for deep use of typing types 2017-05-09 15:40:01 +01:00
Samuel Colvin 30b54e70bd fixing recursive use of typing objects 2017-05-09 14:29:11 +01:00
Samuel Colvin 460feaee75 fixing fully recursive fields 2017-05-09 13:18:40 +01:00
Samuel Colvin cd37ad635c working on recursive fields 2017-05-09 12:21:08 +01:00
Samuel Colvin 242995beb6 simplify Union field choice 2017-05-08 19:08:16 +01:00
Samuel Colvin 24b9fdcd86 removing 'validator' from exception message 2017-05-08 17:43:39 +01:00
Samuel Colvin f7d42ae177 test for lists of sub models 2017-05-08 11:44:50 +01:00
Samuel Colvin c4f9398d79 model validator and utils tests 2017-05-06 15:35:04 +01:00
Samuel Colvin f7acee8646 support typed dicts 2017-05-06 15:07:37 +01:00
Samuel Colvin 63197fc34b cleaning up error display, enabling list parsing 2017-05-06 14:10:40 +01:00
Samuel Colvin 7afd34b4cb add test_complex.py 2017-05-06 00:11:57 +01:00