1Changelog 2--------- 3 48.0.1 (2021-08-12) 5****************** 6 7Bug fixes: 8 9* Fix "``DelimitedList`` deserializes empty string as ``['']``" (:issue:`623`). 10 Thanks :user:`TTWSchell` for reporting and for the PR. 11 12Other changes: 13 14* New documentation theme with `furo`. Thanks to :user:`pradyunsg` for writing 15 furo! 16* Webargs has a new logo. Thanks to :user:`michaelizergit`! (:issue:`312`) 17* Don't build universal wheels. We don't support Python 2 anymore. 18 (:pr:`632`) 19* Make the build reproducible (:pr:`#631`). 20 21 228.0.0 (2021-04-08) 23****************** 24 25Features: 26 27* Add `Parser.pre_load` as a method for allowing users to modify data before 28 schema loading, but without redefining location loaders. See advanced docs on 29 `Parser pre_load` for usage information. (:pr:`583`) 30 31* *Backwards-incompatible*: ``unknown`` defaults to `None` for body locations 32 (`json`, `form` and `json_or_form`) (:issue:`580`). 33 34* Detection of fields as "multi-value" for unpacking lists from multi-dict 35 types is now extensible with the ``is_multiple`` attribute. If a field sets 36 ``is_multiple = True`` it will be detected as a multi-value field. If 37 ``is_multiple`` is not set or is set to ``None``, webargs will check if the 38 field is an instance of ``List`` or ``Tuple``. (:issue:`563`) 39 40* A new attribute on ``Parser`` objects, ``Parser.KNOWN_MULTI_FIELDS`` can be 41 used to set fields which should be detected as ``is_multiple=True`` even when 42 the attribute is not set (:pr:`592`). 43 44See docs on "Multi-Field Detection" for more details. 45 46Bug fixes: 47 48* ``Tuple`` field now behaves as a "multiple" field (:pr:`585`). 49 507.0.1 (2020-12-14) 51****************** 52 53Bug fixes: 54 55* Fix `DelimitedList` and `DelimitedTuple` to pass additional keyword arguments 56 through their `_serialize` methods to the child fields and fix type checking 57 on these classes. (:issue:`569`) 58 Thanks to :user:`decaz` for reporting. 59 607.0.0 (2020-12-10) 61****************** 62 63Changes: 64 65* *Backwards-incompatible*: Drop support for webapp2 (:pr:`565`). 66 67* Add type annotations to `Parser` class, `DelimitedList`, and 68 `DelimitedTuple`. (:issue:`566`) 69 707.0.0b2 (2020-12-01) 71******************** 72 73Features: 74 75* `DjangoParser` now supports the `headers` location. (:issue:`540`) 76 77* `FalconParser` now supports a new `media` location, which uses 78 Falcon's `media` decoding. (:issue:`253`) 79 80`media` behaves very similarly to the `json` location but also supports any 81registered media handler. See the 82`Falcon documentation on media types 83<https://falcon.readthedocs.io/en/stable/api/media.html>`_ for more details. 84 85Changes: 86 87* `FalconParser` defaults to the `media` location instead of `json`. (:issue:`253`) 88* Test against Python 3.9 (:pr:`552`). 89* *Backwards-incompatible*: Drop support for Python 3.5 (:pr:`553`). 90 917.0.0b1 (2020-09-11) 92******************** 93 94Refactoring: 95 96* *Backwards-incompatible*: Remove support for marshmallow2 (:issue:`539`) 97 98* *Backwards-incompatible*: Remove `dict2schema` 99 100 Users desiring the `dict2schema` functionality may now rely upon 101 `marshmallow.Schema.from_dict`. Rewrite any code using `dict2schema` like so: 102 103.. code-block:: python 104 105 import marshmallow as ma 106 107 # webargs 6.x and older 108 from webargs import dict2schema 109 110 myschema = dict2schema({"q1", ma.fields.Int()}) 111 112 # webargs 7.x 113 myschema = ma.Schema.from_dict({"q1", ma.fields.Int()}) 114 115Features: 116 117* Add ``unknown`` as a parameter to ``Parser.parse``, ``Parser.use_args``, 118 ``Parser.use_kwargs``, and parser instantiation. When set, it will be passed 119 to ``Schema.load``. When not set, the value passed will depend on the parser's 120 settings. If set to ``None``, the schema's default behavior will be used (i.e. 121 no value is passed to ``Schema.load``) and parser settings will be ignored. 122 123This allows usages like 124 125.. code-block:: python 126 127 import marshmallow as ma 128 129 130 @parser.use_kwargs( 131 {"q1": ma.fields.Int(), "q2": ma.fields.Int()}, location="query", unknown=ma.EXCLUDE 132 ) 133 def foo(q1, q2): 134 ... 135 136* Defaults for ``unknown`` may be customized on parser classes via 137 ``Parser.DEFAULT_UNKNOWN_BY_LOCATION``, which maps location names to values 138 to use. 139 140Usages are varied, but include 141 142.. code-block:: python 143 144 import marshmallow as ma 145 from webargs.flaskparser import FlaskParser 146 147 # as well as... 148 class MyParser(FlaskParser): 149 DEFAULT_UNKNOWN_BY_LOCATION = {"query": ma.INCLUDE} 150 151 152 parser = MyParser() 153 154Setting the ``unknown`` value for a Parser instance has higher precedence. So 155 156.. code-block:: python 157 158 parser = MyParser(unknown=ma.RAISE) 159 160will always pass ``RAISE``, even when the location is ``query``. 161 162* By default, webargs will pass ``unknown=EXCLUDE`` for all locations except 163 for request bodies (``json``, ``form``, and ``json_or_form``) and path 164 parameters. Request bodies and path parameters will pass ``unknown=RAISE``. 165 This behavior is defined by the default value for 166 ``DEFAULT_UNKNOWN_BY_LOCATION``. 167 168Changes: 169 170* Registered `error_handler` callbacks are required to raise an exception. 171 If a handler is invoked and no exception is raised, `webargs` will raise 172 a `ValueError` (:issue:`527`) 173 1746.1.1 (2020-09-08) 175****************** 176 177Bug fixes: 178 179* Failure to validate flask headers would produce error data which contained 180 tuples as keys, and was therefore not JSON-serializable. (:issue:`500`) 181 These errors will now extract the headername as the key correctly. 182 Thanks to :user:`shughes-uk` for reporting. 183 1846.1.0 (2020-04-05) 185****************** 186 187Features: 188 189* Add ``fields.DelimitedTuple`` when using marshmallow 3. This behaves as a 190 combination of ``fields.DelimitedList`` and ``marshmallow.fields.Tuple``. It 191 takes an iterable of fields, plus a delimiter (defaults to ``,``), and parses 192 delimiter-separated strings into tuples. (:pr:`509`) 193 194* Add ``__str__`` and ``__repr__`` to MultiDictProxy to make it easier to work 195 with (:pr:`488`) 196 197Support: 198 199* Various docs updates (:pr:`482`, :pr:`486`, :pr:`489`, :pr:`498`, :pr:`508`). 200 Thanks :user:`lefterisjp`, :user:`timgates42`, and :user:`ugultopu` for the PRs. 201 202 2036.0.0 (2020-02-27) 204****************** 205 206Features: 207 208* ``FalconParser``: Pass request content length to ``req.stream.read`` to 209 provide compatibility with ``falcon.testing`` (:pr:`477`). 210 Thanks :user:`suola` for the PR. 211 212* *Backwards-incompatible*: Factorize the ``use_args`` / ``use_kwargs`` branch 213 in all parsers. When ``as_kwargs`` is ``False``, arguments are now 214 consistently appended to the arguments list by the ``use_args`` decorator. 215 Before this change, the ``PyramidParser`` would prepend the argument list on 216 each call to ``use_args``. Pyramid view functions must reverse the order of 217 their arguments. (:pr:`478`) 218 2196.0.0b8 (2020-02-16) 220******************** 221 222Refactoring: 223 224* *Backwards-incompatible*: Use keyword-only arguments (:pr:`472`). 225 2266.0.0b7 (2020-02-14) 227******************** 228 229Features: 230 231* *Backwards-incompatible*: webargs will rewrite the error messages in 232 ValidationErrors to be namespaced under the location which raised the error. 233 The `messages` field on errors will therefore be one layer deeper with a 234 single top-level key. 235 2366.0.0b6 (2020-01-31) 237******************** 238 239Refactoring: 240 241* Remove the cache attached to webargs parsers. Due to changes between webargs 242 v5 and v6, the cache is no longer considered useful. 243 244Other changes: 245 246* Import ``Mapping`` from ``collections.abc`` in pyramidparser.py (:pr:`471`). 247 Thanks :user:`tirkarthi` for the PR. 248 2496.0.0b5 (2020-01-30) 250******************** 251 252Refactoring: 253 254* *Backwards-incompatible*: `DelimitedList` now requires that its input be a 255 string and always serializes as a string. It can still serialize and deserialize 256 using another field, e.g. `DelimitedList(Int())` is still valid and requires 257 that the values in the list parse as ints. 258 2596.0.0b4 (2020-01-28) 260******************** 261 262Bug fixes: 263 264* :cve:`CVE-2020-7965`: Don't attempt to parse JSON if request's content type is mismatched 265 (bugfix from 5.5.3). 266 2676.0.0b3 (2020-01-21) 268******************** 269 270Features: 271 272* *Backwards-incompatible*: Support Falcon 2.0. Drop support for Falcon 1.x 273 (:pr:`459`). Thanks :user:`dodumosu` and :user:`Nateyo` for the PR. 274 2756.0.0b2 (2020-01-07) 276******************** 277 278Other changes: 279 280* *Backwards-incompatible*: Drop support for Python 2 (:issue:`440`). 281 Thanks :user:`hugovk` for the PR. 282 2836.0.0b1 (2020-01-06) 284******************** 285 286Features: 287 288* *Backwards-incompatible*: Schemas will now load all data from a location, not 289 only data specified by fields. As a result, schemas with validators which 290 examine the full input data may change in behavior. The `unknown` parameter 291 on schemas may be used to alter this. For example, 292 `unknown=marshmallow.EXCLUDE` will produce a behavior similar to webargs v5. 293 294Bug fixes: 295 296* *Backwards-incompatible*: All parsers now require the Content-Type to be set 297 correctly when processing JSON request bodies. This impacts ``DjangoParser``, 298 ``FalconParser``, ``FlaskParser``, and ``PyramidParser`` 299 300Refactoring: 301 302* *Backwards-incompatible*: Schema fields may not specify a location any 303 longer, and `Parser.use_args` and `Parser.use_kwargs` now accept `location` 304 (singular) instead of `locations` (plural). Instead of using a single field or 305 schema with multiple `locations`, users are recommended to make multiple 306 calls to `use_args` or `use_kwargs` with a distinct schema per location. For 307 example, code should be rewritten like this: 308 309.. code-block:: python 310 311 # webargs 5.x and older 312 @parser.use_args( 313 { 314 "q1": ma.fields.Int(location="query"), 315 "q2": ma.fields.Int(location="query"), 316 "h1": ma.fields.Int(location="headers"), 317 }, 318 locations=("query", "headers"), 319 ) 320 def foo(q1, q2, h1): 321 ... 322 323 324 # webargs 6.x 325 @parser.use_args({"q1": ma.fields.Int(), "q2": ma.fields.Int()}, location="query") 326 @parser.use_args({"h1": ma.fields.Int()}, location="headers") 327 def foo(q1, q2, h1): 328 ... 329 330* The `location_handler` decorator has been removed and replaced with 331 `location_loader`. `location_loader` serves the same purpose (letting you 332 write custom hooks for loading data) but its expected method signature is 333 different. See the docs on `location_loader` for proper usage. 334 335Thanks :user:`sirosen` for the PR! 336 3375.5.3 (2020-01-28) 338****************** 339 340Bug fixes: 341 342* :cve:`CVE-2020-7965`: Don't attempt to parse JSON if request's content type is mismatched. 343 3445.5.2 (2019-10-06) 345****************** 346 347Bug fixes: 348 349* Handle ``UnicodeDecodeError`` when parsing JSON payloads (:issue:`427`). 350 Thanks :user:`lindycoder` for the catch and patch. 351 3525.5.1 (2019-09-15) 353****************** 354 355Bug fixes: 356 357* Remove usage of deprecated ``Field.fail`` when using marshmallow 3. 358 3595.5.0 (2019-09-07) 360****************** 361 362Support: 363 364* Various docs updates (:pr:`414`, :pr:`421`). 365 366Refactoring: 367 368* Don't mutate ``globals()`` in ``webargs.fields`` (:pr:`411`). 369* Use marshmallow 3's ``Schema.from_dict`` if available (:pr:`415`). 370 3715.4.0 (2019-07-23) 372****************** 373 374Changes: 375 376* Use explicit type check for `fields.DelimitedList` when deciding to 377 parse value with `getlist()` (`#406 (comment) <https://github.com/marshmallow-code/webargs/issues/406#issuecomment-514446228>`_ ). 378 379Support: 380 381* Add "Parsing Lists in Query Strings" section to docs (:issue:`406`). 382 3835.3.2 (2019-06-19) 384****************** 385 386Bug fixes: 387 388* marshmallow 3.0.0rc7 compatibility (:pr:`395`). 389 3905.3.1 (2019-05-05) 391****************** 392 393Bug fixes: 394 395* marshmallow 3.0.0rc6 compatibility (:pr:`384`). 396 3975.3.0 (2019-04-08) 398****************** 399 400Features: 401 402* Add `"path"` location to ``AIOHTTPParser``, ``FlaskParser``, and 403 ``PyramidParser`` (:pr:`379`). Thanks :user:`zhenhua32` for the PR. 404* Add ``webargs.__version_info__``. 405 4065.2.0 (2019-03-16) 407****************** 408 409Features: 410 411* Make the schema class used when generating a schema from a 412 dict overridable (:issue:`375`). Thanks :user:`ThiefMaster`. 413 4145.1.3 (2019-03-11) 415****************** 416 417Bug fixes: 418 419* :cve:`CVE-2019-9710`: Fix race condition between parallel requests when the cache is used 420 (:issue:`371`). Thanks :user:`ThiefMaster` for reporting and fixing. 421 4225.1.2 (2019-02-03) 423****************** 424 425Bug fixes: 426 427* Remove lingering usages of ``ValidationError.status_code`` 428 (:issue:`365`). Thanks :user:`decaz` for reporting. 429* Avoid ``AttributeError`` on Python<3.5.4 (:issue:`366`). 430* Fix incorrect type annotations for ``error_headers``. 431* Fix outdated docs (:issue:`367`). Thanks :user:`alexandersoto` for reporting. 432 4335.1.1.post0 (2019-01-30) 434************************ 435 436* Include LICENSE in sdist (:issue:`364`). 437 4385.1.1 (2019-01-28) 439****************** 440 441Bug fixes: 442 443* Fix installing ``simplejson`` on Python 2 by 444 distributing a Python 2-only wheel (:issue:`363`). 445 4465.1.0 (2019-01-11) 447****************** 448 449Features: 450 451* Error handlers for `AsyncParser` classes may be coroutine functions. 452* Add type annotations to `AsyncParser` and `AIOHTTPParser`. 453 454Bug fixes: 455 456* Fix compatibility with Flask<1.0 (:issue:`355`). 457 Thanks :user:`hoatle` for reporting. 458* Address warning on Python 3.7 about importing from ``collections.abc``. 459 4605.0.0 (2019-01-03) 461****************** 462 463Features: 464 465* *Backwards-incompatible*: A 400 HTTPError is raised when an 466 invalid JSON payload is passed. (:issue:`329`). 467 Thanks :user:`zedrdave` for reporting. 468 469Other changes: 470 471* *Backwards-incompatible*: `webargs.argmap2schema` is removed. Use 472 `webargs.dict2schema` instead. 473* *Backwards-incompatible*: `webargs.ValidationError` is removed. 474 Use `marshmallow.ValidationError` instead. 475 476 477.. code-block:: python 478 479 # <5.0.0 480 from webargs import ValidationError 481 482 483 def auth_validator(value): 484 # ... 485 raise ValidationError("Authentication failed", status_code=401) 486 487 488 @use_args({"auth": fields.Field(validate=auth_validator)}) 489 def auth_view(args): 490 return jsonify(args) 491 492 493 # >=5.0.0 494 from marshmallow import ValidationError 495 496 497 def auth_validator(value): 498 # ... 499 raise ValidationError("Authentication failed") 500 501 502 @use_args({"auth": fields.Field(validate=auth_validator)}, error_status_code=401) 503 def auth_view(args): 504 return jsonify(args) 505 506 507* *Backwards-incompatible*: Missing arguments will no longer be filled 508 in when using ``@use_kwargs`` (:issue:`342,307,252`). Use ``**kwargs`` 509 to account for non-required fields. 510 511.. code-block:: python 512 513 # <5.0.0 514 @use_kwargs( 515 {"first_name": fields.Str(required=True), "last_name": fields.Str(required=False)} 516 ) 517 def myview(first_name, last_name): 518 # last_name is webargs.missing if it's missing from the request 519 return {"first_name": first_name} 520 521 522 # >=5.0.0 523 @use_kwargs( 524 {"first_name": fields.Str(required=True), "last_name": fields.Str(required=False)} 525 ) 526 def myview(first_name, **kwargs): 527 # last_name will not be in kwargs if it's missing from the request 528 return {"first_name": first_name} 529 530 531* `simplejson <https://pypi.org/project/simplejson/>`_ is now a required 532 dependency on Python 2 (:pr:`334`). 533 This ensures consistency of behavior across Python 2 and 3. 534 5354.4.1 (2018-01-03) 536****************** 537 538Bug fixes: 539 540* Remove usages of ``argmap2schema`` from ``fields.Nested``, 541 ``AsyncParser``, and ``PyramidParser``. 542 5434.4.0 (2019-01-03) 544****************** 545 546* *Deprecation*: ``argmap2schema`` is deprecated in favor of 547 ``dict2schema`` (:pr:`352`). 548 5494.3.1 (2018-12-31) 550****************** 551 552* Add ``force_all`` param to ``PyramidParser.use_args``. 553* Add warning about missing arguments to ``AsyncParser``. 554 5554.3.0 (2018-12-30) 556****************** 557 558* *Deprecation*: Add warning about missing arguments getting added 559 to parsed arguments dictionary (:issue:`342`). This behavior will be 560 removed in version 5.0.0. 561 5624.2.0 (2018-12-27) 563****************** 564 565Features: 566 567* Add ``force_all`` argument to ``use_args`` and ``use_kwargs`` 568 (:issue:`252`, :issue:`307`). Thanks :user:`piroux` for reporting. 569* *Deprecation*: The ``status_code`` and ``headers`` arguments to ``ValidationError`` 570 are deprecated. Pass ``error_status_code`` and ``error_headers`` to 571 `Parser.parse`, `Parser.use_args`, and `Parser.use_kwargs` instead. 572 (:issue:`327`, :issue:`336`). 573* Custom error handlers receive ``error_status_code`` and ``error_headers`` arguments. 574 (:issue:`327`). 575 576.. code-block:: python 577 578 # <4.2.0 579 @parser.error_handler 580 def handle_error(error, req, schema): 581 raise CustomError(error.messages) 582 583 584 class MyParser(FlaskParser): 585 def handle_error(self, error, req, schema): 586 # ... 587 raise CustomError(error.messages) 588 589 590 # >=4.2.0 591 @parser.error_handler 592 def handle_error(error, req, schema, status_code, headers): 593 raise CustomError(error.messages) 594 595 596 # OR 597 598 599 @parser.error_handler 600 def handle_error(error, **kwargs): 601 raise CustomError(error.messages) 602 603 604 class MyParser(FlaskParser): 605 def handle_error(self, error, req, schema, status_code, headers): 606 # ... 607 raise CustomError(error.messages) 608 609 # OR 610 611 def handle_error(self, error, req, **kwargs): 612 # ... 613 raise CustomError(error.messages) 614 615Legacy error handlers will be supported until version 5.0.0. 616 6174.1.3 (2018-12-02) 618****************** 619 620Bug fixes: 621 622* Fix bug in ``AIOHTTParser`` that prevented calling 623 ``use_args`` on the same view function multiple times (:issue:`273`). 624 Thanks to :user:`dnp1` for reporting and :user:`jangelo` for the fix. 625* Fix compatibility with marshmallow 3.0.0rc1 (:pr:`330`). 626 6274.1.2 (2018-11-03) 628****************** 629 630Bug fixes: 631 632* Fix serialization behavior of ``DelimitedList`` (:pr:`319`). 633 Thanks :user:`lee3164` for the PR. 634 635Other changes: 636 637* Test against Python 3.7. 638 6394.1.1 (2018-10-25) 640****************** 641 642Bug fixes: 643 644* Fix bug in ``AIOHTTPParser`` that caused a ``JSONDecode`` error 645 when parsing empty payloads (:issue:`229`). Thanks :user:`explosic4` 646 for reporting and thanks user :user:`kochab` for the PR. 647 6484.1.0 (2018-09-17) 649****************** 650 651Features: 652 653* Add ``webargs.testing`` module, which exposes ``CommonTestCase`` 654 to third-party parser libraries (see comments in :pr:`287`). 655 6564.0.0 (2018-07-15) 657****************** 658 659Features: 660 661* *Backwards-incompatible*: Custom error handlers receive the 662 `marshmallow.Schema` instance as the third argument. Update any 663 functions decorated with `Parser.error_handler` to take a ``schema`` 664 argument, like so: 665 666.. code-block:: python 667 668 # 3.x 669 @parser.error_handler 670 def handle_error(error, req): 671 raise CustomError(error.messages) 672 673 674 # 4.x 675 @parser.error_handler 676 def handle_error(error, req, schema): 677 raise CustomError(error.messages) 678 679 680See `marshmallow-code/marshmallow#840 (comment) <https://github.com/marshmallow-code/marshmallow/issues/840#issuecomment-403481686>`_ 681for more information about this change. 682 683Bug fixes: 684 685* *Backwards-incompatible*: Rename ``webargs.async`` to 686 ``webargs.asyncparser`` to fix compatibility with Python 3.7 687 (:issue:`240`). Thanks :user:`Reskov` for the catch and patch. 688 689 690Other changes: 691 692* *Backwards-incompatible*: Drop support for Python 3.4 (:pr:`243`). Python 2.7 and 693 >=3.5 are supported. 694* *Backwards-incompatible*: Drop support for marshmallow<2.15.0. 695 marshmallow>=2.15.0 and >=3.0.0b12 are officially supported. 696* Use `black <https://github.com/ambv/black>`_ with `pre-commit <https://pre-commit.com/>`_ 697 for code formatting (:pr:`244`). 698 6993.0.2 (2018-07-05) 700****************** 701 702Bug fixes: 703 704* Fix compatibility with marshmallow 3.0.0b12 (:pr:`242`). Thanks :user:`lafrech`. 705 7063.0.1 (2018-06-06) 707****************** 708 709Bug fixes: 710 711* Respect `Parser.DEFAULT_VALIDATION_STATUS` when a `status_code` is not 712 explicitly passed to `ValidationError` (:issue:`180`). Thanks :user:`foresmac` for 713 finding this. 714 715Support: 716 717* Add "Returning HTTP 400 Responses" section to docs (:issue:`180`). 718 7193.0.0 (2018-05-06) 720****************** 721 722Changes: 723 724* *Backwards-incompatible*: Custom error handlers receive the request object as the second 725 argument. Update any functions decorated with ``Parser.error_handler`` to take a `req` argument, like so: 726 727.. code-block:: python 728 729 # 2.x 730 @parser.error_handler 731 def handle_error(error): 732 raise CustomError(error.messages) 733 734 735 # 3.x 736 @parser.error_handler 737 def handle_error(error, req): 738 raise CustomError(error.messages) 739 740* *Backwards-incompatible*: Remove unused ``instance`` and ``kwargs`` arguments of ``argmap2schema``. 741* *Backwards-incompatible*: Remove ``Parser.load`` method (``Parser`` now calls ``Schema.load`` directly). 742 743These changes shouldn't affect most users. However, they might break custom parsers calling these methods. (:pr:`222`) 744 745* Drop support for aiohttp<3.0.0. 746 7472.1.0 (2018-04-01) 748****************** 749 750Features: 751 752* Respect ``data_key`` field argument (in marshmallow 3). Thanks 753 :user:`lafrech`. 754 7552.0.0 (2018-02-08) 756****************** 757 758Changes: 759 760* Drop support for aiohttp<2.0.0. 761* Remove use of deprecated `Request.has_body` attribute in 762 aiohttpparser (:issue:`186`). Thanks :user:`ariddell` for reporting. 763 7641.10.0 (2018-02-08) 765******************* 766 767Features: 768 769* Add support for marshmallow>=3.0.0b7 (:pr:`188`). Thanks 770 :user:`lafrech`. 771 772Deprecations: 773 774* Support for aiohttp<2.0.0 is deprecated and will be removed in webargs 2.0.0. 775 7761.9.0 (2018-02-03) 777****************** 778 779Changes: 780 781* ``HTTPExceptions`` raised with `webargs.flaskparser.abort` will always 782 have the ``data`` attribute, even if no additional keywords arguments 783 are passed (:pr:`184`). Thanks :user:`lafrech`. 784 785Support: 786 787* Fix examples in examples/ directory. 788 7891.8.1 (2017-07-17) 790****************** 791 792Bug fixes: 793 794* Fix behavior of ``AIOHTTPParser.use_args`` when ``as_kwargs=True`` is passed with a ``Schema`` (:issue:`179`). Thanks :user:`Itayazolay`. 795 7961.8.0 (2017-07-16) 797****************** 798 799Features: 800 801* ``AIOHTTPParser`` supports class-based views, i.e. ``aiohttp.web.View`` (:issue:`177`). Thanks :user:`daniel98321`. 802 8031.7.0 (2017-06-03) 804****************** 805 806Features: 807 808* ``AIOHTTPParser.use_args`` and ``AIOHTTPParser.use_kwargs`` work with `async def` coroutines (:issue:`170`). Thanks :user:`zaro`. 809 8101.6.3 (2017-05-18) 811****************** 812 813Support: 814 815* Fix Flask error handling docs in "Framework support" section (:issue:`168`). Thanks :user:`nebularazer`. 816 8171.6.2 (2017-05-16) 818****************** 819 820Bug fixes: 821 822* Fix parsing multiple arguments in ``AIOHTTParser`` (:issue:`165`). Thanks :user:`ariddell` for reporting and thanks :user:`zaro` for reporting. 823 8241.6.1 (2017-04-30) 825****************** 826 827Bug fixes: 828 829* Fix form parsing in aiohttp>=2.0.0. Thanks :user:`DmitriyS` for the PR. 830 8311.6.0 (2017-03-14) 832****************** 833 834Bug fixes: 835 836* Fix compatibility with marshmallow 3.x. 837 838Other changes: 839 840* Drop support for Python 2.6 and 3.3. 841* Support marshmallow>=2.7.0. 842 8431.5.3 (2017-02-04) 844****************** 845 846Bug fixes: 847 848* Port fix from release 1.5.2 to `AsyncParser`. This fixes :issue:`146` for ``AIOHTTPParser``. 849* Handle invalid types passed to ``DelimitedList`` (:issue:`149`). Thanks :user:`psconnect-dev` for reporting. 850 8511.5.2 (2017-01-08) 852****************** 853 854Bug fixes: 855 856* Don't add ``marshmallow.missing`` to ``original_data`` when using ``marshmallow.validates_schema(pass_original=True)`` (:issue:`146`). Thanks :user:`lafrech` for reporting and for the fix. 857 858Other changes: 859 860* Test against Python 3.6. 861 8621.5.1 (2016-11-27) 863****************** 864 865Bug fixes: 866 867* Fix handling missing nested args when ``many=True`` (:issue:`120`, :issue:`145`). Thanks :user:`chavz` and :user:`Bangertm` for reporting. 868* Fix behavior of ``load_from`` in ``AIOHTTPParser``. 869 8701.5.0 (2016-11-22) 871****************** 872 873Features: 874 875* The ``use_args`` and ``use_kwargs`` decorators add a reference to the undecorated function via the ``__wrapped__`` attribute. This is useful for unit-testing purposes (:issue:`144`). Thanks :user:`EFF` for the PR. 876 877Bug fixes: 878 879* If ``load_from`` is specified on a field, first check the field name before checking ``load_from`` (:issue:`118`). Thanks :user:`jasonab` for reporting. 880 8811.4.0 (2016-09-29) 882****************** 883 884Bug fixes: 885 886* Prevent error when rendering validation errors to JSON in Flask (e.g. when using Flask-RESTful) (:issue:`122`). Thanks :user:`frol` for the catch and patch. NOTE: Though this is a bugfix, this is a potentially breaking change for code that needs to access the original ``ValidationError`` object. 887 888.. code-block:: python 889 890 # Before 891 @app.errorhandler(422) 892 def handle_validation_error(err): 893 return jsonify({"errors": err.messages}), 422 894 895 896 # After 897 @app.errorhandler(422) 898 def handle_validation_error(err): 899 # The marshmallow.ValidationError is available on err.exc 900 return jsonify({"errors": err.exc.messages}), 422 901 902 9031.3.4 (2016-06-11) 904****************** 905 906Bug fixes: 907 908* Fix bug in parsing form in Falcon>=1.0. 909 9101.3.3 (2016-05-29) 911****************** 912 913Bug fixes: 914 915* Fix behavior for nullable List fields (:issue:`107`). Thanks :user:`shaicantor` for reporting. 916 9171.3.2 (2016-04-14) 918****************** 919 920Bug fixes: 921 922* Fix passing a schema factory to ``use_kwargs`` (:issue:`103`). Thanks :user:`ksesong` for reporting. 923 9241.3.1 (2016-04-13) 925****************** 926 927Bug fixes: 928 929* Fix memory leak when calling ``parser.parse`` with a ``dict`` in a view (:issue:`101`). Thanks :user:`frankslaughter` for reporting. 930* aiohttpparser: Fix bug in handling bulk-type arguments. 931 932Support: 933 934* Massive refactor of tests (:issue:`98`). 935* Docs: Fix incorrect use_args example in Tornado section (:issue:`100`). Thanks :user:`frankslaughter` for reporting. 936* Docs: Add "Mixing Locations" section (:issue:`90`). Thanks :user:`tuukkamustonen`. 937 9381.3.0 (2016-04-05) 939****************** 940 941Features: 942 943* Add bulk-type arguments support for JSON parsing by passing ``many=True`` to a ``Schema`` (:issue:`81`). Thanks :user:`frol`. 944 945Bug fixes: 946 947* Fix JSON parsing in Flask<=0.9.0. Thanks :user:`brettdh` for the PR. 948* Fix behavior of ``status_code`` argument to ``ValidationError`` (:issue:`85`). This requires **marshmallow>=2.7.0**. Thanks :user:`ParthGandhi` for reporting. 949 950 951Support: 952 953* Docs: Add "Custom Fields" section with example of using a ``Function`` field (:issue:`94`). Thanks :user:`brettdh` for the suggestion. 954 9551.2.0 (2016-01-04) 956****************** 957 958Features: 959 960* Add ``view_args`` request location to ``FlaskParser`` (:issue:`82`). Thanks :user:`oreza` for the suggestion. 961 962Bug fixes: 963 964* Use the value of ``load_from`` as the key for error messages when it is provided (:issue:`83`). Thanks :user:`immerrr` for the catch and patch. 965 9661.1.1 (2015-11-14) 967****************** 968 969Bug fixes: 970 971* aiohttpparser: Fix bug that raised a ``JSONDecodeError`` raised when parsing non-JSON requests using default ``locations`` (:issue:`80`). Thanks :user:`leonidumanskiy` for reporting. 972* Fix parsing JSON requests that have a vendor media type, e.g. ``application/vnd.api+json``. 973 9741.1.0 (2015-11-08) 975****************** 976 977Features: 978 979* ``Parser.parse``, ``Parser.use_args`` and ``Parser.use_kwargs`` can take a Schema factory as the first argument (:issue:`73`). Thanks :user:`DamianHeard` for the suggestion and the PR. 980 981Support: 982 983* Docs: Add "Custom Parsers" section with example of parsing nested querystring arguments (:issue:`74`). Thanks :user:`dwieeb`. 984* Docs: Add "Advanced Usage" page. 985 9861.0.0 (2015-10-19) 987****************** 988 989Features: 990 991* Add ``AIOHTTPParser`` (:issue:`71`). 992* Add ``webargs.async`` module with ``AsyncParser``. 993 994Bug fixes: 995 996* If an empty list is passed to a List argument, it will be parsed as an empty list rather than being excluded from the parsed arguments dict (:issue:`70`). Thanks :user:`mTatcher` for catching this. 997 998Other changes: 999 1000* *Backwards-incompatible*: When decorating resource methods with ``FalconParser.use_args``, the parsed arguments dictionary will be positioned **after** the request and response arguments. 1001* *Backwards-incompatible*: When decorating views with ``DjangoParser.use_args``, the parsed arguments dictionary will be positioned **after** the request argument. 1002* *Backwards-incompatible*: ``Parser.get_request_from_view_args`` gets passed a view function as its first argument. 1003* *Backwards-incompatible*: Remove logging from default error handlers. 1004 10050.18.0 (2015-10-04) 1006******************* 1007 1008Features: 1009 1010* Add ``FalconParser`` (:issue:`63`). 1011* Add ``fields.DelimitedList`` (:issue:`66`). Thanks :user:`jmcarp`. 1012* ``TornadoParser`` will parse json with ``simplejson`` if it is installed. 1013* ``BottleParser`` caches parsed json per-request for improved performance. 1014 1015No breaking changes. Yay! 1016 10170.17.0 (2015-09-29) 1018******************* 1019 1020Features: 1021 1022* ``TornadoParser`` returns unicode strings rather than bytestrings (:issue:`41`). Thanks :user:`thomasboyt` for the suggestion. 1023* Add ``Parser.get_default_request`` and ``Parser.get_request_from_view_args`` hooks to simplify ``Parser`` implementations. 1024* *Backwards-compatible*: ``webargs.core.get_value`` takes a ``Field`` as its last argument. Note: this is technically a breaking change, but this won't affect most users since ``get_value`` is only used internally by ``Parser`` classes. 1025 1026Support: 1027 1028* Add ``examples/annotations_example.py`` (demonstrates using Python 3 function annotations to define request arguments). 1029* Fix examples. Thanks :user:`hyunchel` for catching an error in the Flask error handling docs. 1030 1031 1032Bug fixes: 1033 1034* Correctly pass ``validate`` and ``force_all`` params to ``PyramidParser.use_args``. 1035 10360.16.0 (2015-09-27) 1037******************* 1038 1039The major change in this release is that webargs now depends on `marshmallow <https://marshmallow.readthedocs.io/en/latest/>`_ for defining arguments and validation. 1040 1041Your code will need to be updated to use ``Fields`` rather than ``Args``. 1042 1043.. code-block:: python 1044 1045 # Old API 1046 from webargs import Arg 1047 1048 args = { 1049 "name": Arg(str, required=True), 1050 "password": Arg(str, validate=lambda p: len(p) >= 6), 1051 "display_per_page": Arg(int, default=10), 1052 "nickname": Arg(multiple=True), 1053 "Content-Type": Arg(dest="content_type", location="headers"), 1054 "location": Arg({"city": Arg(str), "state": Arg(str)}), 1055 "meta": Arg(dict), 1056 } 1057 1058 # New API 1059 from webargs import fields 1060 1061 args = { 1062 "name": fields.Str(required=True), 1063 "password": fields.Str(validate=lambda p: len(p) >= 6), 1064 "display_per_page": fields.Int(missing=10), 1065 "nickname": fields.List(fields.Str()), 1066 "content_type": fields.Str(load_from="Content-Type"), 1067 "location": fields.Nested({"city": fields.Str(), "state": fields.Str()}), 1068 "meta": fields.Dict(), 1069 } 1070 1071Features: 1072 1073* Error messages for all arguments are "bundled" (:issue:`58`). 1074 1075Changes: 1076 1077* *Backwards-incompatible*: Replace ``Args`` with marshmallow fields (:issue:`61`). 1078* *Backwards-incompatible*: When using ``use_kwargs``, missing arguments will have the special value ``missing`` rather than ``None``. 1079* ``TornadoParser`` raises a custom ``HTTPError`` with a ``messages`` attribute when validation fails. 1080 1081Bug fixes: 1082 1083* Fix required validation of nested arguments (:issue:`39`, :issue:`51`). These are fixed by virtue of using marshmallow's ``Nested`` field. Thanks :user:`ewang` and :user:`chavz` for reporting. 1084 1085Support: 1086 1087* Updated docs. 1088* Add ``examples/schema_example.py``. 1089* Tested against Python 3.5. 1090 10910.15.0 (2015-08-22) 1092******************* 1093 1094Changes: 1095 1096* If a parsed argument is ``None``, the type conversion function is not called :issue:`54`. Thanks :user:`marcellarius`. 1097 1098Bug fixes: 1099 1100* Fix parsing nested ``Args`` when the argument is missing from the input (:issue:`52`). Thanks :user:`stas`. 1101 11020.14.0 (2015-06-28) 1103******************* 1104 1105Features: 1106 1107* Add parsing of ``matchdict`` to ``PyramidParser``. Thanks :user:`hartror`. 1108 1109Bug fixes: 1110 1111* Fix ``PyramidParser's`` ``use_kwargs`` method (:issue:`42`). Thanks :user:`hartror` for the catch and patch. 1112* Correctly use locations passed to Parser's constructor when using ``use_args`` (:issue:`44`). Thanks :user:`jacebrowning` for the catch and patch. 1113* Fix behavior of ``default`` and ``dest`` argument on nested ``Args`` (:issue:`40` and :issue:`46`). Thanks :user:`stas`. 1114 1115Changes: 1116 1117* A 422 response is returned to the client when a ``ValidationError`` is raised by a parser (:issue:`38`). 1118 11190.13.0 (2015-04-05) 1120******************* 1121 1122Features: 1123 1124* Support for webapp2 via the `webargs.webapp2parser` module. Thanks :user:`Trii`. 1125* Store argument name on ``RequiredArgMissingError``. Thanks :user:`stas`. 1126* Allow error messages for required validation to be overriden. Thanks again :user:`stas`. 1127 1128Removals: 1129 1130* Remove ``source`` parameter from ``Arg``. 1131 1132 11330.12.0 (2015-03-22) 1134******************* 1135 1136Features: 1137 1138* Store argument name on ``ValidationError`` (:issue:`32`). Thanks :user:`alexmic` for the suggestion. Thanks :user:`stas` for the patch. 1139* Allow nesting of dict subtypes. 1140 11410.11.0 (2015-03-01) 1142******************* 1143 1144Changes: 1145 1146* Add ``dest`` parameter to ``Arg`` constructor which determines the key to be added to the parsed arguments dictionary (:issue:`32`). 1147* *Backwards-incompatible*: Rename ``targets`` parameter to ``locations`` in ``Parser`` constructor, ``Parser#parse_arg``, ``Parser#parse``, ``Parser#use_args``, and ``Parser#use_kwargs``. 1148* *Backwards-incompatible*: Rename ``Parser#target_handler`` to ``Parser#location_handler``. 1149 1150Deprecation: 1151 1152* The ``source`` parameter is deprecated in favor of the ``dest`` parameter. 1153 1154Bug fixes: 1155 1156* Fix ``validate`` parameter of ``DjangoParser#use_args``. 1157 11580.10.0 (2014-12-23) 1159******************* 1160 1161* When parsing a nested ``Arg``, filter out extra arguments that are not part of the ``Arg's`` nested ``dict`` (:issue:`28`). Thanks Derrick Gilland for the suggestion. 1162* Fix bug in parsing ``Args`` with both type coercion and ``multiple=True`` (:issue:`30`). Thanks Steven Manuatu for reporting. 1163* Raise ``RequiredArgMissingError`` when a required argument is missing on a request. 1164 11650.9.1 (2014-12-11) 1166****************** 1167 1168* Fix behavior of ``multiple=True`` when nesting Args (:issue:`29`). Thanks Derrick Gilland for reporting. 1169 11700.9.0 (2014-12-08) 1171****************** 1172 1173* Pyramid support thanks to @philtay. 1174* User-friendly error messages when ``Arg`` type conversion/validation fails. Thanks Andriy Yurchuk. 1175* Allow ``use`` argument to be a list of functions. 1176* Allow ``Args`` to be nested within each other, e.g. for nested dict validation. Thanks @saritasa for the suggestion. 1177* *Backwards-incompatible*: Parser will only pass ``ValidationErrors`` to its error handler function, rather than catching all generic Exceptions. 1178* *Backwards-incompatible*: Rename ``Parser.TARGET_MAP`` to ``Parser.__target_map__``. 1179* Add a short-lived cache to the ``Parser`` class that can be used to store processed request data for reuse. 1180* Docs: Add example usage with Flask-RESTful. 1181 11820.8.1 (2014-10-28) 1183****************** 1184 1185* Fix bug in ``TornadoParser`` that raised an error when request body is not a string (e.g when it is a ``Future``). Thanks Josh Carp. 1186 11870.8.0 (2014-10-26) 1188****************** 1189 1190* Fix ``Parser.use_kwargs`` behavior when an ``Arg`` is allowed missing. The ``allow_missing`` attribute is ignored when ``use_kwargs`` is called. 1191* ``default`` may be a callable. 1192* Allow ``ValidationError`` to specify a HTTP status code for the error response. 1193* Improved error logging. 1194* Add ``'query'`` as a valid target name. 1195* Allow a list of validators to be passed to an ``Arg`` or ``Parser.parse``. 1196* A more useful ``__repr__`` for ``Arg``. 1197* Add examples and updated docs. 1198 11990.7.0 (2014-10-18) 1200****************** 1201 1202* Add ``source`` parameter to ``Arg`` constructor. Allows renaming of keys in the parsed arguments dictionary. Thanks Josh Carp. 1203* ``FlaskParser's`` ``handle_error`` method attaches the string representation of validation errors on ``err.data['message']``. The raised exception is stored on ``err.data['exc']``. 1204* Additional keyword arguments passed to ``Arg`` are stored as metadata. 1205 12060.6.2 (2014-10-05) 1207****************** 1208 1209* Fix bug in ``TornadoParser's`` ``handle_error`` method. Thanks Josh Carp. 1210* Add ``error`` parameter to ``Parser`` constructor that allows a custom error message to be used if schema-level validation fails. 1211* Fix bug that raised a ``UnicodeEncodeError`` on Python 2 when an Arg's validator function received non-ASCII input. 1212 12130.6.1 (2014-09-28) 1214****************** 1215 1216* Fix regression with parsing an ``Arg`` with both ``default`` and ``target`` set (see issue #11). 1217 12180.6.0 (2014-09-23) 1219****************** 1220 1221* Add ``validate`` parameter to ``Parser.parse`` and ``Parser.use_args``. Allows validation of the full parsed output. 1222* If ``allow_missing`` is ``True`` on an ``Arg`` for which ``None`` is explicitly passed, the value will still be present in the parsed arguments dictionary. 1223* *Backwards-incompatible*: ``Parser's`` ``parse_*`` methods return ``webargs.core.Missing`` if the value cannot be found on the request. NOTE: ``webargs.core.Missing`` will *not* show up in the final output of ``Parser.parse``. 1224* Fix bug with parsing empty request bodies with ``TornadoParser``. 1225 12260.5.1 (2014-08-30) 1227****************** 1228 1229* Fix behavior of ``Arg's`` ``allow_missing`` parameter when ``multiple=True``. 1230* Fix bug in tornadoparser that caused parsing JSON arguments to fail. 1231 12320.5.0 (2014-07-27) 1233****************** 1234 1235* Fix JSON parsing in Flask parser when Content-Type header contains more than just `application/json`. Thanks Samir Uppaluru for reporting. 1236* *Backwards-incompatible*: The ``use`` parameter to ``Arg`` is called before type conversion occurs. Thanks Eric Wang for the suggestion. 1237* Tested on Tornado>=4.0. 1238 12390.4.0 (2014-05-04) 1240****************** 1241 1242* Custom target handlers can be defined using the ``Parser.target_handler`` decorator. 1243* Error handler can be specified using the ``Parser.error_handler`` decorator. 1244* ``Args`` can define their request target by passing in a ``target`` argument. 1245* *Backwards-incompatible*: ``DEFAULT_TARGETS`` is now a class member of ``Parser``. This allows subclasses to override it. 1246 12470.3.4 (2014-04-27) 1248****************** 1249 1250* Fix bug that caused ``use_args`` to fail on class-based views in Flask. 1251* Add ``allow_missing`` parameter to ``Arg``. 1252 12530.3.3 (2014-03-20) 1254****************** 1255 1256* Awesome contributions from the open-source community! 1257* Add ``use_kwargs`` decorator. Thanks @venuatu. 1258* Tornado support thanks to @jvrsantacruz. 1259* Tested on Python 3.4. 1260 1261 12620.3.2 (2014-03-04) 1263****************** 1264 1265* Fix bug with parsing JSON in Flask and Bottle. 1266 12670.3.1 (2014-03-03) 1268****************** 1269 1270* Remove print statements in core.py. Oops. 1271 12720.3.0 (2014-03-02) 1273****************** 1274 1275* Add support for repeated parameters (#1). 1276* *Backwards-incompatible*: All `parse_*` methods take `arg` as their fourth argument. 1277* Add ``error_handler`` param to ``Parser``. 1278 12790.2.0 (2014-02-26) 1280****************** 1281 1282* Bottle support. 1283* Add ``targets`` param to ``Parser``. Allows setting default targets. 1284* Add ``files`` target. 1285 12860.1.0 (2014-02-16) 1287****************** 1288 1289* First release. 1290* Parses JSON, querystring, forms, headers, and cookies. 1291* Support for Flask and Django. 1292