forked from pyeve/cerberus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCHANGES
366 lines (290 loc) · 14.2 KB
/
CHANGES
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
Changelog
=========
Here you can see the full list of changes between each Cerberus release.
Unreleased
------------
- New: Allow applying of ``empty`` rule to sequences and mappings. Closes #270
(Frank Sachsenheim).
- Fix: ``readonly`` conflicts with ``default`` rule. Closes #268 (Dominik
Kellner).
- Fix: Creating custom Validator instance with ``_validator_*`` method raises
``SchemaError``. Closes #265 (Frank Sachsenheim).
- Fix: Consistently use new style classes (Dominik Kellner).
- Fix: ``NotImplemented`` does not derive from ``BaseException`` (Bryan W.
Weber).
- Completely switch to py.test. Closes #213 (Frank Sachsenheim).
- Convert ``self.assert`` method calls to plain ``assert`` calls supported by
pytest. Addresses #213 (Bruno Oliveira).
- Docs: Add note concerning regex flags. Closes #173 (Frank Sachsenheim).
- Docs: Explain that normalization and coercion are performed on a copy of the
original document (Sergey Leshchenko).
Version 1.0.1
-------------
Released on September 1, 2016.
- Fix: bump trove classifier to Production/Stable (5).
Version 1.0
-----------
Released on September 1, 2016.
.. warning::
This is a major release which breaks backward compatibility in several
ways. Don't worry, these changes are for the better. However, if you are
upgrading, then you should really take the time to read the list of
`Breaking Changes`_ and consider their impact on your codebase. For your
convenience, some :doc:`upgrade notes <upgrading>` have been included.
- New: Add capability to use references in schemas (Frank Sachsenheim).
- New: Support for binary type (Matthew Ellison).
- New: Allow callables for 'default' schema rule (Dominik Kellner).
- New: Support arbitrary types with 'max' and 'min' (Frank Sachsenheim).
- New: Support any iterable with 'minlength' and 'maxlength'. Closes #158 (Frank Sachsenheim).
- New: 'default' normalization rule. Closes #131 (Damián Nohales).
- New: 'excludes' rule (calve). Addresses #132.
- New: 'forbidden' rule (Frank Sachsenheim).
- New: 'rename'-rule renames a field to a given value during normalization
(Frank Sachsenheim).
- New: 'rename_handler'-rule that takes an callable that renames unknown
fields (Frank Sachsenheim).
- New: 'Validator.purge_unknown'-property and conditional purging of unknown fields
(Frank Sachsenheim).
- New: 'coerce', 'rename_handler' and 'validator' can use class-methods (Frank
Sachsenheim).
- New: '*of'-rules can be extended by concatenating another rule (Frank
Sachsenheim).
- New: Allows various error output with error handlers (Frank Sachsenheim).
- New: Available rules etc. of a Validator-instance are accessible as
'validation_rules', 'normalization_rules', 'types', 'validators' and 'coercer'
-property (Frank Sachsenheim).
- New: Custom rule's method docstrings can contain an expression to validate
constraints for that rule when a schema is validated (Frank Sachsenheim).
- New: 'Validator.root_schema' complements 'Validator.root_document' (Frank
Sachsenheim).
- New: 'Validator.document_path' and 'Validator.schema_path' properties can
be used to determine the relation of the currently validating document to the
'root_document' / 'root_schema' (Frank Sachsenheim).
- New: Known, validated definition schemas are cached, thus validation run-time
of schemas is reduced (Frank Sachsenheim).
- New: Add testing with Docker (Frank Sachsenheim).
- New: Support CPython 3.5 (Frank Sachsenheim).
- Fix: 'allow_unknown' inside *of rule is ignored. Closes #251 (Davis
Kirkendall).
- Fix: unexpected TypeError when using allow_unknown in a schema defining
a list of dicts (Davis Kirkendall). Closes #250.
- Fix: validate with 'update=True' does not work when required fields are in
a list of subdicts (Jonathan Huot).
- Fix: 'number' type fails if value is boolean. Closes #144 (Frank
Sachsenheim).
- Fix: allow None in 'default' normalization rule (Damián Nohales).
- Fix: in 0.9.2, coerce does not maintain proper nesting on dict fields. Closes
#185.
- Fix: normalization not working for valueschema and propertyschema. Closes
#155 (Frank Sachsenheim).
- Fix: 'coerce' on List elements produces unexpected results Closes #161 (Frank
Sachsenheim).
- Fix: 'coerce'-constraints are validated (Frank Sachsenheim).
- Fix: Unknown fields are normalized (Frank Sachsenheim).
- Fix: Dependency on boolean field now works as expected. Addresses #138 (Roman
Redkovich)
- Fix: Add missing deprecation-warnings (Frank Sachsenheim).
- Docs: clarify read-only rule. Closes #127.
- Docs: split Usage page into Usage; Validation Rules: Normalization Rules
(Frank Sachsenheim).
Breaking Changes
~~~~~~~~~~~~~~~~
Several relevant breaking changes have been introduced with this release. For
the inside scoop, please see the :doc:`upgrade notes <upgrading>`.
- Change: 'errors' values are lists containing error messages. Previously, they were simple strings if single errors, lists otherwise. Closes #210 (Frank Sachsenheim).
- Change: Custom validator methods: remove the second argument (Frank Sachsenheim).
- Change: Custom validator methods: invert the logic of the conditional clauses where is tested what a value is not / has not (Frank Sachsenheim).
- Change: Custom validator methods: replace calls to 'self._error' with 'return True', or False, or None (Frank Sachsenheim).
- Change: Remove 'transparent_schema_rule' in favor of docstring schema validation (Frank Sachsenheim).
- Change: Rename 'property_schema' rule to 'keyschema' (Frank Sachsenheim).
- Change: Replace 'validate_update' method with 'update' keywork argument (Frank Sachsenheim).
- Change: The processed root-document of is now available as 'root_document'-
property of the (child-)Validator (Frank Sachsenheim).
- Change: Removed 'context'-argument from 'validate'-method as this is set
upon the creation of a child-validator (Frank Sachsenheim).
- Change: 'ValidationError'-exception renamed to 'DocumentError' (Frank Sachsenheim).
- Change: Consolidated all schema-related error-messages' names (Frank Sachsenheim).
- Change: Use warnings.warn for deprecation-warnings if available (Frank Sachsenheim).
Version 0.9.2
-------------
Released on September 23, 2015
- Fix: don't rely on deepcopy since it can't properly handle complex objects in
Python 2.6.
Version 0.9.1
-------------
Released on July 7 2015
- Fix: 'required' is always evaluated, independent of eventual missing
dependencies. This changes the previous behaviour whereas a required field
with dependencies would only be reported as missing if all dependencies were
met. A missing required field will always be reported. Also see the
discussion in https://github.com/nicolaiarocci/eve/pull/665.
Version 0.9
-----------
Released on June 24 2015.
Codename: 'Mastrolindo'.
- New: 'oneof' rule which provides a list of definitions in which only one
should validate (C.D. Clark III).
- New: 'noneof' rule which provides a list of definitions that should all not
validate (C.D. Clark III).
- New: 'anyof' rule accepts a list of definitions and checks that one
definition validates (C.D. Clark III).
- New: 'allof' rule validates if if all definitions validate (C.D. Clark III).
- New: 'validator.validated' takes a document as argument and returns
a validated document or 'None' if validation failed (Frank Sachsenheim).
- New: PyPy support (Frank Sachsenheim).
- New: Type coercion (Brett).
- New: Added 'propertyschema' validation rule (Frank Sachsenheim).
- Change: Use 'str.format' in error messages so if someone wants to override
them does not get an exception if arguments are not passed. Closes #105
(Brett).
- Change: 'keyschema' renamed to 'valueschema', print a deprecation warning
(Frank Sachsenheim).
- Change: 'type' can also be a list of types (Frank Sachsenheim).
- Fix: useages of 'document' to 'self.document' in '_validate' (Frank
Sachsenheim).
- Fix: when 'items' is applied to a list, field name is used as key for
'validator.errors', and offending field indexes are used as keys for field
errors ({'a_list_of_strings': {1: 'not a string'}}) 'type' can be a list of
valid types.
- Fix: Ensure that additional `**kwargs` of a subclass persist through
validation (Frank Sachsenheim).
- Fix: improve failure message when testing against multiple types (Frank
Sachsenheim).
- Fix: ignore 'keyschema' when not a mapping (Frank Sachsenheim).
- Fix: ignore 'schema' when not a sequence (Frank Sachsenheim).
- Fix: allow_unknown can also be set for nested dicts. Closes #75 (Tobias
Betz).
- Fix: raise SchemaError when an unallowed 'type' is used in conjunction with
'schema' rule (Tobias Betz).
- Docs: added section that points out that YAML, JSON, etc. can be used to
define schemas (C.D. Clark III).
- Docs: Improve 'allow_unknown' documentation (Frank Sachsenheim).
Version 0.8.1
-------------
Released on Mar 16 2015.
- Fix: dependency on a sub-document field does not work. Closes #64.
- Fix: readonly validation should happen before any other validation.
Closes #63.
- Fix: allow_unknown does not apply to sub-dictionaries in a list. Closes #67.
- Fix: two tests being ignored because of name typo.
- Fix: update mode does not ignore required fields in subdocuments. Closes #72.
- Fix: allow_unknown does not respect custom rules. Closes #66.
- Fix: typo in docstrings (Riccardo).
Version 0.8
-----------
Released on Jan 7 2015.
- 'dependencies' also supports dependency values.
- 'allow_unknown' can also be set to a validation schema, in which case unknown
fields will be validated against it. Closes nicolaiarocci/eve#405.
- New function-based custom validation mode (Luo Peng).
- Fields with empty definitions in schema were reported as non-existent. Now
they are considered as valid, whatever their value is (Jaroslav Semančík).
- If dependencies are precised for a 'required' field, then the presence of the
field is only validated if all dependencies are present (Trong Hieu HA).
- Documentation typo (Nikita Vlaznev #55).
- [CI] Add travis_retry to pip install in case of network issues (Helgi Þormar
Þorbjörnsson #49)
Version 0.7.2
-------------
Released on Jun 19 2014.
- Successfully validate int as float type (Florian Rathgeber).
Version 0.7.1
-------------
Released on Jun 17 2014.
- Validation schemas are now validated up-front. When you pass a Schema to the
Validator it will be validated against the supported ruleset (Paul Weaver).
Closes #39.
- Custom validators also have access to a special 'self.document' variable that
allows validation of a field to happen in context of the rest of the document
(Josh Villbrandt).
- Validator options like 'allow_unknown' and 'ignore_none_values' are now taken
into consideration when validating sub-dictionaries. Closes #40.
Version 0.7
-----------
Released on May 16 2014.
- Python 3.4 is now supported.
- tox support.
- Added 'dependencies' validation rule (Lujeni).
- Added 'keyschema' validation rule (Florian Rathgeber).
- Added 'regex' validation rule. Closes #29.
- Added 'set' as a core data type. Closes #31.
- Not-nullable fields are validated independetly of their type definition
(Jaroslav Semančík).
- Python trove classifiers added to setup.py. Closes #32.
- 'min' and 'max' now apply to floats and numbers too. Closes #30.
Version 0.6
-----------
Released on February 10 2014
- Added 'number' data type, which validates against both float and integer
values (Brandon Aubie).
- Added support for running tests with py.test
- Fix non-blocking problem introduced with 0.5 (Martin Ortbauer).
- Fix bug when _error() is calld twice for a field (Jaroslav Semančík).
- More precise error message in rule 'schema' validation (Jaroslav Semančík).
- Use 'allowed' field for integer just like for string (Peter Demin).
Version 0.5
-----------
Released on December 4 2013
- 'validator.errors' now returns a dictionary where keys are document fields
and values are lists of validation errors for the field.
- Validator instances are now callable. Instead of `validated
= validator.validate(document)` you can now choose to do 'validated
= validator(document)' (Eelke Hermens).
Version 0.4.0
-------------
Released on September 24 2013.
- 'validate_update' is deprecated and will be removed with next release. Use
'validate' with 'update=True' instead. Closes #21.
- Fixed a minor encoding issue which made installing on Windows/Python3
impossible. Closes #19 (Arsh Singh).
- Fix documentation typo (Daniele Pizzolli).
- 'type' validation is always performed first (only exception being
'nullable'). On failure, subsequent rules on the same field are skipped.
Closes #18.
Version 0.3.0
-------------
Released on July 9 2013.
- docstrings now conform to PEP8.
- `self.errors` returns an empty list if validate() has not been called.
- added validation for the 'float' data type.
- 'nullable' rule added to allow for null field values to be accepted in
validations. This is different than required in that you can actively change
a value to None instead of omitting or ignoring it. It is essentially the
ignore_none_values, allowing for more fine grained control down to the field
level (Kaleb Pomeroy).
Version 0.2.0
-------------
Released on April 18 2013.
- 'allow_unknown' option added.
Version 0.1.0
-------------
Released on March 15 2013.
Codename: 'Claw'.
- entering beta phase.
- support for Python 3.
- pep8 and pyflakes fixes (Harro van der Klauw).
- removed superflous typecheck for empty validator (Harro van der Klauw).
- 'ignore_none_values' option to ignore None values when type checking (Harro
van der Klauw).
- 'minlenght' and 'maxlength' now apply to lists as well (Harro van der Klauw).
Version 0.0.3
-------------
Released on January 29 2013
- when a list item fails, its offset is now returned along with the list name.
- 'transparent_schema_rules' option added.
- 'empty' rule for string fields.
- 'schema' rule on lists of arbitrary lenght (Martjin Vermaat).
- 'allowed' rule on strings (Martjin Vermaat).
- 'items' (dict) is now deprecated. Use the upgraded 'schema' rule instead.
- AUTHORS file added to sources.
- CHANGES file added to sources.
Version 0.0.2
-------------
Released on November 22 2012.
- Added support for addition and validation of custom data types.
- Several documentation improvements.
Version 0.0.1
-------------
Released on October 16 2012.
First public preview release.
.. _`upgrade notes`: upgrading