Commit Graph

42 Commits

Author SHA1 Message Date
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
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 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
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 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
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
Nikita Grishko 99d7eafa61 add `Decimal, ConstrainedDecimal and condecimal` types #170 (#175) 2018-05-10 12:11:45 +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
Nikita Grishko b4d3a2d544 add `UUID1, UUID3, UUID4 and UUID5` types (#167) (#167) 2018-05-02 22:49:55 +01:00
Nikita Grishko dc07277017 add `ConstrainedFloat, confloat, PositiveFloat and NegativeFloat` types #166 (#166) 2018-04-28 18:40:28 +01:00
Nikita Grishko f88e5925b5 add strip_whitespace option for ConstrainedStr and constr (#163) 2018-04-25 02:29:25 +07:00
Samuel Colvin afb90b91e8 implement email validator (#142)
* implement email validator, replace #112

* coverage and cleanup

* update docs
2018-03-25 18:09:37 +01: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 5cf23fb415 Uuid type (#89)
* adding UUID validator, fix #65

* add docs

* uprev
2017-10-23 19:49:52 +01:00
Samuel Colvin 378c96888e simplifying errors 2017-07-08 18:22:57 +01:00
Samuel Colvin 61d23b2796 show incorrect length in string validation error 2017-07-06 16:14:02 +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 ff3fa95eb0 convert values to a function, fix #28 (#43) 2017-06-07 22:40:09 +01:00
Samuel Colvin 3627bad768 more docs usage examples 2017-06-03 17:45:49 +01:00
Samuel Colvin 45cba8b1ae fixing isort, adding deploy recipe 2017-06-03 16:18:02 +01:00
Samuel Colvin 0757af6e5e make values recursive, fix #24 2017-05-31 11:44:31 +01:00
Samuel Colvin 21aa4a383b renaming Module > PyObect, fix #9 2017-05-23 17:01:34 +01:00
Samuel Colvin 35add310cc improve error display 2017-05-10 12:43:29 +01:00
Samuel Colvin ddb8e96401 allow tuples, also infer types for falsy, fix #11 2017-05-10 11:17:07 +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 11ea624e62 add int size validation 2017-05-08 17:25:44 +01:00
Samuel Colvin 3673c11d53 improving coverage 2017-05-08 11:54:43 +01:00
Samuel Colvin 19faa546d8 tests for standard dict, list, OrderedDict types 2017-05-06 14:20:55 +01:00
Samuel Colvin 63197fc34b cleaning up error display, enabling list parsing 2017-05-06 14:10:40 +01:00
Samuel Colvin 0214be13a5 proper support for unions 2017-05-06 00:10:48 +01:00
Samuel Colvin af6ab2b7e5 add email address validation 2017-05-05 22:01:10 +01:00
Samuel Colvin 7950e7f909 enum support and better type check 2017-05-05 21:10:49 +01:00
Samuel Colvin e2d4460429 add 'allow_extra' checks 2017-05-05 20:26:14 +01:00
Samuel Colvin d27a520c38 add .editorconfig to fix isort 2017-05-05 20:02:41 +01:00
Samuel Colvin c859ec8543 adding datetime, date, time and timedelta validation 2017-05-05 19:59:25 +01:00
Samuel Colvin 7254ddc5e6 improve test coverage 2017-05-05 18:05:42 +01:00