- [Fix] Do not parse semicolons in urlencoded POST body
- [Fix] error_to_dict fail on BadField error.
- [Break]
covador.aiohttp.AsyncValidationDecorator
removed in favour of unified sync/async through AST transformation (_async/gen_validator.py
). - [Feature] python 3.8 support.
- [Feature] view function can raise
covador.errors.Invalid
exception and covador will handle it with an appropriate error handler. - [Fix] use AST transformer to get legacy and new style coroutines for
covador.aiohttp.get_form
andcovador.aiohttp.get_json
. Fixes@coroutine
deprecation warning in python3.8.
- [Fix] Right hand pipe must coerce value to item.
- [Feature] web frameworks in integration tests were updated.
- [Fix] aiohttp query_string decorator led to deprecation error.
- [Fix] length(min=N) was treated as length(N) -- sequence must have length of N exactly. This is confusing and wrong behavior.
- [Refactor] extract item getter entity from Map.
- [Feature] soft map type. It can describe dicts with unknown keys.
- [Fix] One can pass pipes with maps into schema.
Schema introspection for view functions
import covador from covador.flask import query_string @query_string(boo=int) def view(): pass print(view.schema.items) # {'boo': <covador.types.item object at 0x7fb2c9dad208>}
- [Feature] python 3.7 support
- [Optimization] schema(...) tries to return Map with merged items instead of MergedMap.
- [Break] rparams renamed to args.
- [Fix] aiohttp and sanic.
- [Refactor] Real integration tests with whole app starting.
- [Feature] python 2.6 support
- [Fix] missing pipeable support for
oneof
. - [Fix] django support
- [Fix] Ensure
List
validator for items withmulti=True
.
- [Break] IMPORTANT!!
empty_is_none
consider empty strings only. For example,schema(price=int)({'price': 0})
does not raises Required Item exception anymore. - [Feature/Break] Strict parsing for
application/x-www-form-urlencoded
,multipart/form-data
andapplication/json
content types. - [Feature]
covador.vdecorator.mergeof
validation decorator compositor. For example, allparams
decorators aremergeof(query_string, form)
. - [Feature] Support for
multipart/form-data
content type. - [Feature] Assume empty dictionary for
json_body
in case of empty request body. - [Feature]
covador.check
allows to create validators from boolean functions. - [Feature] Log invalid inputs for validation decorators. One can use
COVADOR_DEBUG
environment variable to enable stack traces in logs. - [Refactor] Extract
covador.vdecorator
module fromcovador.utils
.
- [Break] empty_is_none=True for
covador.item
to synchronize behavior withcovador.opt
. Introduce similarcovador.nitem
. Change allows to make explicit empty values acceptance.
- [Fix] Common item declarations lead to field erasure in schema.
- [Feature] Add support for Sanic.
- [Feature]
KeyVal
validator for typed mappings like Map<T1,T2>.
- [Fix] reimplementation of parse_qs to deal with bug in py3.
- [Fix] UnicodeDecodeError in parse_qs under python3.
- [Break] rename
t_date
,t_time
,t_datetime
intoDate
,Time
,DateTime
respectively. - [Feature]
aiohttp.rparams
now usesrequest.match_info
.
- [Break]
length
validator with single argument asumes min=max, solength(3) is equivalent for length(3, 3)
. - [Feature]
numbers
validator which can extract number sequences from strings. Can be used to extract digits from phone numbers.
[Feature] Naive
t_datetime
,t_date
andt_time
validators. Completely timezone-unaware. Suitable only for simple cases when only a local time is needed. And you always can apply pytz for these values.[Feature]
timestamp
validator to deal with unix timestamps in seconds and milliseconds and treat it like UTC and local values.[Feature] Error handler wrapper allows to override default error handlers without touching decorators:
from covador import flask @flask.error_hanler.set def custom_error_handler(ctx): print ctx.exception ctx.reraise() # reraise exception with original traceback
- [Break] Changed argument order for
item
.default
is on a second position now, so one can useopt(int, 0)
instead ofopt(int, default=0)
. Default values are more common case then custom source keys. - [Feature]
oneof
validator to select suitable alternative. - [Feature]
dest
andsrc
(an alias forsource_key
) parameters foritem
, it controls a destination and a source key value for a Map. - [Feature]
dpass
decorator helper allows to use complex expression inline. - [Feature]
_
keyword argument for schema constructor to attach a validation chain to a resulted schema. Can be used instead ofdpass
. - [Feature] Public properties for built-in validation exceptions.
- [Fix] Fixed
covador.aiohttp.params
decorator. - [Fix] Incorrect schema for
rparams
for all supported frameworks.
- [Feature] Exception hierarchy for built-in checkers.
Drop
covador.aiohttp.m_*
decorators in favor simple query_string/form/etc... Support for CBV are kept.Added json_body for django, tornado and aiohttp.
Ability to customize error handler via
.on_error
validator decorator method:from covador import flask def error_handler(ctx): print ctx.exception ctx.reraise() # reraise exception with original traceback custom_query_string = flask.query_string.on_error(error_handler)
Pipeable decorators:
from covador import wrap_in, flask pager = (flask.query_string(offset=int, limit=int) | (lambda d: Paginator(d['limit'], d['offset'])) | wrap_in('pager')) @pager def view(pager): # use pager... pass