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 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441
|
Changelog
---------
3.26.1 (2025-02-03)
*******************
Bug fixes:
- Typing: Fix type annotations for `class Meta <marshmallow.Schema.Meta>` options (:issue:`2804`).
Thanks :user:`lawrence-law` for reporting.
Other changes:
- Remove default value for the ``data`` param of `Nested._deserialize <marshmallow.fields.Nested._deserialize>` (:issue:`2802`).
Thanks :user:`gbenson` for reporting.
3.26.0 (2025-01-22)
*******************
Features:
- Typing: Add type annotations and improved documentation for `class Meta <marshmallow.Schema.Meta>` options (:pr:`2760`).
- Typing: Improve type coverage of `marshmallow.Schema.SchemaMeta` (:pr:`2761`).
- Typing: `marshmallow.Schema.loads` parameter allows `bytes` and `bytesarray` (:pr:`2769`).
Bug fixes:
- Respect ``data_key`` when schema validators raise a `ValidationError <marshmallow.exceptions.ValidationError>`
with a ``field_name`` argument (:issue:`2170`). Thanks :user:`matejsp` for reporting.
- Correctly handle multiple `@post_load <marshmallow.post_load>` methods where one method appends to
the data and another passes ``pass_original=True`` (:issue:`1755`).
Thanks :user:`ghostwheel42` for reporting.
- ``URL`` fields now properly validate ``file`` paths (:issue:`2249`).
Thanks :user:`0xDEC0DE` for reporting and fixing.
Documentation:
- Add :doc:`upgrading guides <upgrading>` for 3.24 and 3.26 (:pr:`2780`).
- Various documentation improvements (:pr:`2757`, :pr:`2759`, :pr:`2765`, :pr:`2774`, :pr:`2778`, :pr:`2783`, :pr:`2796`).
Deprecations:
- The ``ordered`` `class Meta <marshmallow.Schema.Meta>` option is deprecated (:issue:`2146`, :pr:`2762`).
Field order is already preserved by default. Set `marshmallow.Schema.dict_class` to `collections.OrderedDict`
to maintain the previous behavior.
3.25.1 (2025-01-11)
*******************
Bug fixes:
- Typing: Fix type annotations for `Tuple <marshmallow.fields.Tuple>`,
`Boolean <marshmallow.fields.Boolean>`, and `Pluck <marshmallow.fields.Pluck>`
constructors (:pr:`2756`).
- Typing: Fix overload for `marshmallow.class_registry.get_class` (:pr:`2756`).
Documentation:
- Various documentation improvements (:pr:`2746`, :pr:`2747`, :pr:`2748`, :pr:`2749`, :pr:`2750`, :pr:`2751`).
3.25.0 (2025-01-09)
*******************
Features:
- Typing: Improve type annotations for ``SchemaMeta.get_declared_fields`` (:pr:`2742`).
Bug fixes:
- Typing: Relax type annotation for ``Schema.opts`` to allow subclasses to define their own
options classes (:pr:`2744`).
Other changes:
- Restore ``marshmallow.base.SchemaABC`` for backwards-compatibility (:issue:`2743`).
Note that this class is deprecated and will be removed in marshmallow 4.
Use `marshmallow.schema.Schema` as a base class for type-checking instead.
3.24.2 (2025-01-08)
*******************
Changes:
- Don't override ``__new__`` to avoid breaking usages of `inspect.signature` with
`Field <marshmallow.fields.Field>` classes.
This allows marshmallow-sqlalchemy users to upgrade marshmallow without
upgrading to marshmallow-sqlalchemy>=1.1.1.
Documentation:
- Add top-level API back to docs (:issue:`2739`).
Thanks :user:`llucax` for reporting.
3.24.1 (2025-01-06)
*******************
Bug fixes:
- Typing: Fix typing for `class_registry.get_class <marshmallow.class_registry.get_class>` (:pr:`2735`).
3.24.0 (2025-01-06)
*******************
Features:
- Typing: Improve typings in `marshmallow.fields` (:pr:`2723`).
- Typing: Replace type comments with inline typings (:pr:`2718`).
Bug fixes:
- Typing: Fix type hint for ``nested`` parameter of `Nested <marshmallow.fields.Nested>`.
Deprecations:
- Custom validators should raise a `ValidationError <marshmallow.exceptions.ValidationError>` for invalid values.
Returning `False`` is no longer supported .
- Deprecate ``context`` parameter of `Schema <marshmallow.schema.Schema>` (:issue:`1826`).
Use `contextVars.ContextVar` to pass context data instead.
- `Field <marshmallow.fields.Field>`, `Mapping <marshmallow.fields.Mapping>`,
and `Number <marshmallow.fields.Number>` should no longer be used as fields within schemas.
Use their subclasses instead.
3.23.3 (2025-01-03)
*******************
Bug fixes:
- Typing: Fix typing for `Schema.from_dict <marshmallow.schema.Schema.from_dict>` (:issue:`1653`).
Thanks :user:`SteadBytes` for reporting.
Support:
- Documentation: Various documentation cleanups, including more concise docs in the `marshmallow.fields` API reference (:issue:`2307`).
Thanks :user:`AbdealiLoKo` for reporting.
3.23.2 (2024-12-18)
*******************
Bug fixes:
- Improve type hint formatting for ``Field``, ``Nested``, and ``Function`` fields
to resolve PyCharm warnings (:issue:`2268`).
Thanks :user:`Fares-Abubaker` for reporting and fixing.
3.23.1 (2024-11-01)
*******************
Support:
- Document ``absolute`` parameter of ``URL`` field (:pr:`2327`).
- Documentation: Remove (outdated) minimum Python 3 minor version in
documentation and README (:pr:`2323`).
3.23.0 (2024-10-17)
*******************
Features:
- Typing: replace "type" with specific metaclass for ``Schema`` and ``Field``.
Other changes:
- Officially support Python 3.13 (:pr:`2319`).
- Drop support for Python 3.8 (:pr:`2318`).
3.22.0 (2024-08-20)
*******************
Features:
- Add ``many`` Meta option to ``Schema`` so it expects a collection by default (:issue:`2270`).
Thanks :user:`himalczyk` for reporting and :user:`deckar01` for the PR.
- Refactor hooks (:pr:`2279`).
Thanks :user:`deckar01` for the PR.
3.21.3 (2024-06-05)
*******************
Bug fixes:
- Fix memory leak that prevented schema instances from getting GC'd (:pr:`2277`).
Thanks :user:`mrcljx` for the PR.
3.21.2 (2024-05-01)
*******************
Bug fixes:
- Allow timestamp 0 in ``fields.DateTime`` (:issue:`2133`).
Thanks :user:`flydzen` for reporting.
3.21.1 (2024-03-04)
*******************
Bug fixes:
- Fix error message when field is declared as a class and not an instance (:issue:`2245`).
Thanks :user:`travnick` for reporting.
3.21.0 (2024-02-26)
*******************
Bug fixes:
- Fix validation of ``URL`` fields to allow missing user field,
per NWG RFC 3986 (:issue:`2232`). Thanks :user:`ddennerline3` for reporting
and :user:`deckar01` for the PR.
Other changes:
- *Backwards-incompatible*: ``__version__``, ``__parsed_version__``, and ``__version_info__``
attributes are deprecated (:issue:`2227`). Use feature detection or
``importlib.metadata.version("marshmallow")`` instead.
3.20.2 (2024-01-09)
*******************
Bug fixes:
- Fix ``Nested`` field type hint for lambda ``Schema`` types (:pr:`2164`).
Thanks :user:`somethingnew2-0` for the PR.
Other changes:
- Officially support Python 3.12 (:pr:`2188`).
Thanks :user:`hugovk` for the PR.
3.20.1 (2023-07-20)
*******************
Bug fixes:
- Fix call to ``get_declared_fields``: pass ``dict_cls`` again (:issue:`2152`).
Thanks :user:`Cheaterman` for reporting.
3.20.0 (2023-07-20)
*******************
Features:
- Add ``absolute`` parameter to ``URL`` validator and ``Url`` field (:pr:`2123`).
Thanks :user:`sirosen` for the PR.
- Use Abstract Base Classes to define ``FieldABC`` and ``SchemaABC``
(:issue:`1449`). Thanks :user:`aditkumar72` for the PR.
- Use `OrderedSet` as default `set_class`. Schemas are now ordered by default.
(:issue:`1744`)
Bug fixes:
- Handle ``OSError`` and ``OverflowError`` in ``utils.from_timestamp`` (:pr:`2102`).
Thanks :user:`TheBigRoomXXL` for the PR.
- Fix the default inheritance of nested partial schemas (:issue:`2149`).
Thanks :user:`matejsp` for reporting.
Other changes:
- Officially support Python 3.11 (:pr:`2067`).
- Drop support for Python 3.7 (:pr:`2135`).
3.19.0 (2022-11-11)
*******************
Features:
- Add ``timestamp`` and ``timestamp_ms`` formats to ``fields.DateTime``
(:issue:`612`).
Thanks :user:`vgavro` for the suggestion and thanks :user:`vanHoi` for
the PR.
3.18.0 (2022-09-15)
*******************
Features:
- Add ``Enum`` field (:pr:`2017`) and (:pr:`2044`).
Bug fixes:
- Fix typing in ``Field._serialize`` signature (:pr:`2046`).
3.17.1 (2022-08-22)
*******************
Bug fixes:
- Add return type to ``fields.Email.__init__`` (:pr:`2018`).
Thanks :user:`kkirsche` for the PR.
- Add missing type hint to IPInterface __init__ (:pr:`2036`).
3.17.0 (2022-06-26)
*******************
Features:
- Support serialization as float in ``TimeDelta`` field (:pr:`1998`).
Thanks :user:`marcosatti` for the PR.
- Add ``messages_dict`` property to ``ValidationError`` to facilitate type checking
(:pr:`1976`).
Thanks :user:`sirosen` for the PR.
3.16.0 (2022-05-29)
*******************
Features:
- Raise ``ValueError`` if an invalid value is passed to the ``unknown``
argument (:issue:`1721`, :issue:`1732`).
Thanks :user:`sirosen` for the PR.
Other changes:
- Set lower bound for ``packaging`` requirement (:issue:`1957`).
Thanks :user:`MatthewNicolTR` for reporting and thanks :user:`sirosen` for the PR.
- Improve warning messages by passing ``stacklevel`` (:pr:`1986`).
Thanks :user:`tirkarthi` for the PR.
3.15.0 (2022-03-12)
*******************
Features:
- Allow passing a ``dict`` to ``fields.Nested`` (:pr:`1935`).
Thanks :user:`sirosen` for the PR.
Other changes:
- Address distutils deprecation warning in Python 3.10 (:pr:`1903`).
Thanks :user:`kkirsche` for the PR.
- Add py310 to black target-version (:pr:`1921`).
- Drop support for Python 3.6 (:pr:`1923`).
- Use postponed evaluation of annotations (:pr:`1932`).
Thanks :user:`Isira-Seneviratne` for the PR.
3.14.1 (2021-11-13)
*******************
Bug fixes:
- Fix publishing type hints per `PEP-561 <https://www.python.org/dev/peps/pep-0561/>`_
(:pr:`1905`). Thanks :user:`bwindsor` for the catch and patch.
3.14.0 (2021-10-17)
*******************
Bug fixes:
- Fix ``fields.TimeDelta`` serialization precision (:issue:`1865`).
Thanks :user:`yarsanich` for reporting.
Other changes:
- Fix type-hints for ``data`` arg in ``Schema.validate`` to accept
list of dictionaries (:issue:`1790`, :pr:`1868`).
Thanks :user:`yourun-proger` for PR.
- Improve warning when passing metadata as keyword arguments (:pr:`1882`).
Thanks :user:`traherom` for the PR.
- Don't build universal wheels. We don't support Python 2 anymore.
(:issue:`1860`) Thanks :user:`YKdvd` for reporting.
- Make the build reproducible (:pr:`1862`).
- Drop support for Python 3.5 (:pr:`1863`).
- Test against Python 3.10 (:pr:`1888`).
3.13.0 (2021-07-21)
*******************
Features:
- Replace ``missing``/``default`` field parameters with
``load_default``/``dump_default`` (:pr:`1742`).
Thanks :user:`sirosen` for the PR.
Deprecations:
- The use of ``missing``/``default`` field parameters is deprecated and will be
removed in marshmallow 4. ``load_default``/``dump_default`` should be used
instead.
3.12.2 (2021-07-06)
*******************
Bug fixes:
- Don't expose ``Field``\s as ``Schema`` attributes. This reverts a change
introduced in 3.12.0 that causes issues when field names conflict with
``Schema`` attributes or methods. ``Fields``\s are still accessible on a
``Schema`` instance through the ``fields`` attribute. (:pr:`1843`)
3.12.1 (2021-05-10)
*******************
Bug fixes:
- Fix bug that raised an ``AttributeError`` when instantiating a
``Schema`` with a field named ``parent`` (:issue:`1808`).
Thanks :user:`flying-sheep` for reporting and helping with the fix.
3.12.0 (2021-05-09)
*******************
Features:
- Add ``validate.And`` (:issue:`1768`).
Thanks :user:`rugleb` for the suggestion.
- Add type annotations to ``marshmallow.decorators`` (:issue:`1788`, :pr:`1789`).
Thanks :user:`michaeldimchuk` for the PR.
- Let ``Field``\s be accessed by name as ``Schema`` attributes (:pr:`1631`).
Other changes:
- Improve types in ``marshmallow.validate`` (:pr:`1786`).
- Make ``marshmallow.validate.Validator`` an abstract base class (:pr:`1786`).
- Remove unnecessary list cast (:pr:`1785`).
3.11.1 (2021-03-29)
*******************
Bug fixes:
- Fix treatment of dotted keys when ``unknown=INCLUDE`` (:issue:`1506`).
Thanks :user:`rbu` for reporting and thanks :user:`sirosen` for the fix (:pr:`1745`).
3.11.0 (2021-03-28)
*******************
Features:
- Add ``fields.IPInterface``, ``fields.IPv4Interface``, and
``IPv6Interface`` (:issue:`1733`). Thanks :user:`madeinoz67`
for the suggestion and the PR.
- Raise ``AttributeError`` for missing methods when using ``fields.Method`` (:pr:`1675`).
Thanks :user:`lassandroan`.
Other changes:
- Remove unnecessary ``hasattr`` and ``getattr`` checks in ``Field`` (:pr:`1770`).
3.10.0 (2020-12-19)
*******************
Deprecations:
- Passing field metadata via keyword arguments is deprecated and will be
removed in marshmallow 4 (:issue:`1350`). Use the explicit ``metadata=...``
argument instead. Thanks :user:`sirosen`.
3.9.1 (2020-11-07)
******************
Bug fixes:
- Cast to mapping type in ``Mapping.serialize`` and ``Mapping.deserialize``
(:pr:`1685`).
- Fix bug letting ``Dict`` pass invalid dict on deserialization when no key or
value ``Field`` is specified (:pr:`1685`).
3.9.0 (2020-10-31)
******************
Features:
- Add ``format`` argument to ``fields.Time`` and ``timeformat`` ``class Meta`` option (:issue:`686`).
Thanks :user:`BennyAlex` for the suggestion and thanks :user:`infinityxxx` for the PR.
Other changes:
- Remove usage of implicit ``typing.Optional`` (:issue:`1663`).
Thanks :user:`nadega` for the PR.
3.8.0 (2020-09-16)
******************
Features:
- Add ``fields.IP``, ``fields.IPv4``Â and ``fields.IPv6`` (:pr:`1485`). Thanks
:user:`mgetka` for the PR.
Bug fixes:
- Fix typing in ``AwareDateTime`` (:pr:`1658`). Thanks :user:`adithyabsk` for
reporting.
3.7.1 (2020-07-20)
******************
Bug fixes:
- ``fields.Boolean`` correctly serializes non-hashable types (:pr:`1633`).
Thanks :user:`jun0jang` for the PR.
3.7.0 (2020-07-08)
******************
Deprecations:
- ``marshmallow.pprint`` is deprecated and will be removed in marshmallow 4 (:issue:`1588`).
Support:
- Document ``default_error_messages`` on field classes (:pr:`1619`). Thanks :user:`weeix`.
Bug fixes:
- Fix passing ``only`` and ``exclude`` to ``Nested`` with an ordered ``Schema`` (:pr:`1627`).
Thanks :user:`juannorris` for the PR.
3.6.1 (2020-06-02)
******************
No code changes--only docs and contributor-facing updates in this release.
Support:
- Documentation: improve custom fields example (:issue:`1538`).
Thanks :user:`pablospizzamiglio` for reporting the problem with the
old example and thanks :user:`Resinderate` for the PR.
- Documentation: Split up API reference into multiple pages and
add summary tables (:pr:`1587`). Thanks :user:`EpicWink` for the PR.
3.6.0 (2020-05-08)
******************
Features:
- Add ``validate.ContainsNoneOf`` (:issue:`1528`).
Thanks :user:`Resinderate` for the suggestion and the PR.
3.5.2 (2020-04-30)
******************
Bug fixes:
- Fix typing in ``class_registry`` (:pr:`1574`). Thanks :user:`mahenzon`.
3.5.1 (2020-03-05)
******************
Bug fixes:
- Includes bug fix from 2.21.0.
3.5.0 (2020-02-19)
******************
Bug fixes:
- Fix list of nullable nested fields ``List(Nested(Field, allow_none=True)``
(:issue:`1497`). Because this fix reverts an optimization introduced to
speed-up serialization and deserialization of lists of nested fields, a
negative impact on performance in this specific case is expected.
3.4.0 (2020-02-02)
******************
Features:
- Improve type coverage (:issue:`1479`). Thanks :user:`Reskov`.
Bug fixes:
- Fix typing for ``data`` param of ``Schema.load`` and ``ValidationError`` (:issue:`1492`).
Thanks :user:`mehdigmira` for reporting and thanks :user:`dfirst` for the PR.
Other changes:
- Remove unnecessary typecasts (:pr:`1500`). Thanks :user:`hukkinj1`.
- Remove useless ``_serialize`` override in ``UUID`` field (:pr:`1489`).
3.3.0 (2019-12-05)
******************
Features:
- ``fields.Nested`` may take a callable that returns a schema instance.
Use this to resolve order-of-declaration issues when schemas nest each other (:issue:`1146`).
.. code-block:: python
# <3.3
class AlbumSchema(Schema):
title = fields.Str()
artist = fields.Nested("ArtistSchema", only=("name",))
class ArtistSchema(Schema):
name = fields.Str()
albums = fields.List(fields.Nested(AlbumSchema))
# >=3.3
class AlbumSchema(Schema):
title = fields.Str()
artist = fields.Nested(lambda: ArtistSchema(only=("name",)))
class ArtistSchema(Schema):
name = fields.Str()
albums = fields.List(fields.Nested(AlbumSchema))
Deprecations:
- Passing the string ``"self"`` to ``fields.Nested`` is deprecated.
Use a callable instead.
.. code-block:: python
from marshmallow import Schema, fields
# <3.3
class PersonSchema(Schema):
partner = fields.Nested("self", exclude=("partner",))
friends = fields.List(fields.Nested("self"))
# >=3.3
class PersonSchema(Schema):
partner = fields.Nested(lambda: PersonSchema(exclude=("partner")))
friends = fields.List(fields.Nested(lambda: PersonSchema()))
Other changes:
- Fix typing for ``Number._format_num`` (:pr:`1466`). Thanks :user:`hukkinj1`.
- Make mypy stricter and remove dead code (:pr:`1467`). Thanks again, :user:`hukkinj1`.
3.2.2 (2019-11-04)
******************
Bug fixes:
- Don't load fields for which ``load_only`` and ``dump_only`` are both ``True`` (:pr:`1448`).
- Fix types in ``marshmallow.validate`` (:pr:`1446`).
Support:
- Test against Python 3.8 (:pr:`1431`).
3.2.1 (2019-09-30)
******************
Bug fixes:
- Fix typing for ``Schema.dump[s]`` (:pr:`1416`).
3.2.0 (2019-09-17)
******************
Features:
- Add type annotations to ``marshmallow.schema`` and ``marshmallow.validate`` (:pr:`1407`, :issue:`663`).
Bug fixes:
- Fix compatibility with Python < 3.5.3 (:issue:`1409`). Thanks :user:`lukaszdudek-silvair` for reporting.
Refactoring:
- Remove unnecessary ``BaseSchema`` superclass (:pr:`1406`).
3.1.1 (2019-09-16)
******************
Bug fixes:
- Restore inheritance hierarchy of ``Number`` fields (:pr:`1403`).
``fields.Integer`` and ``fields.Decimal`` inherit from ``fields.Number``.
- Fix bug that raised an uncaught error when a nested schema instance had an unpickleable object in its context (:issue:`1404`).
Thanks :user:`metheoryt` for reporting.
3.1.0 (2019-09-15)
******************
Features:
- Add more type annotations (:issue:`663`).
Type information is distributed per `PEP 561 <https://www.python.org/dev/peps/pep-0561/>`_ .
Thanks :user:`fuhrysteve` for helping with this.
Bug fixes:
- Includes bug fix from 2.20.5.
3.0.5 (2019-09-12)
******************
Bug fixes:
- Fix bug that raised an uncaught error when passing both a schema instance and ``only`` to ``Nested`` (:pr:`1395`).
This bug also affected passing a schema instance to ``fields.Pluck``.
3.0.4 (2019-09-11)
******************
Bug fixes:
- Fix propagating dot-delimited ``only`` and ``exclude`` parameters to nested schema instances (:issue:`1384`).
- Includes bug fix from 2.20.4 (:issue:`1160`).
3.0.3 (2019-09-04)
******************
Bug fixes:
- Handle when ``data_key`` is an empty string (:issue:`1378`).
Thanks :user:`jtrakk` for reporting.
3.0.2 (2019-09-04)
******************
Bug fixes:
- Includes bug fix from 2.20.3 (:pr:`1376`).
- Fix incorrect ``super()`` call in ``SchemaMeta.__init__`` (:pr:`1362`).
3.0.1 (2019-08-21)
******************
Bug fixes:
- Fix bug when nesting ``fields.DateTime`` within ``fields.List`` or ``fields.Tuple`` (:issue:`1357`).
This bug was introduced in 3.0.0rc9. Thanks :user:`zblz` for reporting.
3.0.0 (2019-08-18)
******************
Features:
- Optimize ``List(Nested(...))`` (:issue:`779`).
- Minor performance improvements and cleanup (:pr:`1328`).
- Add ``Schema.from_dict`` (:issue:`1312`).
Deprecations/Removals:
- ``Field.fail`` is deprecated. Use ``Field.make_error`` instead.
- Remove UUID validation from ``fields.UUID``, for consistency with other fields (:issue:`1132`).
Support:
- Various docs improvements (:pr:`1329`).
3.0.0rc9 (2019-07-31)
*********************
Features:
- *Backwards-incompatible*: Validation does not occur on serialization (:issue:`1132`).
This significantly improves serialization performance.
- *Backwards-incompatible*: ``DateTime`` does not affect timezone information
on serialization and deserialization (:issue:`1234`, :pr:`1278`).
- Add ``NaiveDateTime`` and ``AwareDateTime`` to enforce timezone awareness
(:issue:`1234`, :pr:`1287`).
- *Backwards-incompatible*: ``List`` does not wrap single values in a list on
serialization (:pr:`1307`).
- *Backwards-incompatible*: ``Schema.handle_error`` receives ``many`` and ``partial`` as keyword arguments (:pr:`1321`).
- Use ``raise from`` more uniformly to improve stack traces (:pr:`1313`).
- Rename ``Nested.__schema`` to ``Nested._schema`` to prevent name mangling (:issue:`1289`).
- Performance improvements (:pr:`1309`).
Deprecations/Removals:
- ``LocalDateTime`` is removed (:issue:`1234`).
- ``marshmallow.utils.utc`` is removed. Use ``datetime.timezone.utc`` instead.
Bug fixes:
- Fix behavior of ``List(Nested("self"))`` (`#779 (comment) <https://github.com/marshmallow-code/marshmallow/issues/779#issuecomment-396354987>`_).
Support:
- Document usage of ``validate.Regexp``'s usage ``re.search`` (:issue:`1285`). Thanks :user:`macdonaldezra`.
3.0.0rc8 (2019-07-04)
*********************
Features:
- Propagate ``only`` and ``exclude`` parameters to ``Nested`` fields
within ``List`` and ``Dict`` (:issue:`779`, :issue:`946`).
- Use ``email.utils.parsedate_to_datetime`` instead of conditionally
using dateutil for parsing RFC dates (:pr:`1246`).
- Use internal util functions instead of conditionally using dateutil
for parsing ISO 8601 datetimes, dates and times. Timezone info is now
correctly deserialized whether or not dateutil is installed. (:pr:`1265`)
- Improve error messages for ``validate.Range``.
- Use ``raise from error`` for better stack traces (:pr:`1254`). Thanks
:user:`fuhrysteve`.
- python-dateutil is no longer used. This resolves the inconsistent behavior
based on the presence of python-dateutil (:issue:`497`, :issue:`1234`).
Bug fixes:
- Fix method resolution for ``__init__`` method of ``fields.Email`` and
``fields.URL`` (:issue:`1268`). Thanks :user:`dursk` for the catch and patch.
- Includes bug fixes from 2.19.4 and 2.19.5.
Other changes:
- *Backwards-incompatible*: Rename ``fields.List.container`` to ``fields.List.inner``,
``fields.Dict.key_container`` to ``fields.Dict.key_field``, and
``fields.Dict.value_container`` to ``fields.Dict.value_field``.
- Switch to Azure Pipelines for CI (:issue:`1261`).
3.0.0rc7 (2019-06-15)
*********************
Features:
- *Backwards-incompatible*: ``many`` is passed as a keyword argument to methods decorated with
``pre_load``, ``post_load``, ``pre_dump``, ``post_dump``,
and ``validates_schema``. ``partial`` is passed as a keyword argument to
methods decorated with ``pre_load``, ``post_load`` and ``validates_schema``.
``**kwargs`` should be added to all decorated methods.
- Add ``min_inclusive`` and ``max_exclusive`` parameters to
``validate.Range`` (:issue:`1221`). Thanks :user:`kdop` for the PR.
Bug fixes:
- Fix propagation of ``partial`` to ``Nested`` containers (part of :issue:`779`).
- Includes bug fix from 2.19.3.
Other changes:
- *Backwards-incompatible*: Use keyword-only arguments (:issue:`1216`).
3.0.0rc6 (2019-05-05)
*********************
Support:
- *Backwards-incompatible*: Remove support for Python 2 (:issue:`1120`).
Only Python>=3.5 is supported.
Thank you :user:`rooterkyberian` for the suggestion and the PR.
- *Backwards-incompatible*: Remove special-casing in ``fields.List`` and
``fields.Tuple`` for accessing nested attributes (:pr:`1188`).
Use ``fields.List(fields.Pluck(...))`` instead.
- Add ``python_requires`` to ``setup.py`` (:pr:`1194`).
Thanks :user:`hugovk`.
- Upgrade syntax with ``pyupgrade`` in pre-commit (:pr:`1195`). Thanks
again :user:`hugovk`.
3.0.0rc5 (2019-03-30)
*********************
Features:
- Allow input value to be included in error messages
for a number of fields (:pr:`1129`). Thanks :user:`hdoupe` for the PR.
- Improve default error messages for ``OneOf`` and ``ContainsOnly``
(:issue:`885`). Thanks :user:`mcgfeller` for the suggestion
and :user:`maxalbert` for the PR.
Deprecations/Removals:
- Remove ``fields.FormattedString`` (:issue:`1141`). Use
``fields.Function`` or ``fields.Method`` instead.
Bug fixes:
- Includes bug fix from 2.19.2.
3.0.0rc4 (2019-02-08)
*********************
Features:
- Add ``fields.Tuple`` (:issue:`1103`) Thanks :user:`zblz` for the PR.
- Add ``fields.Mapping``, which makes it easier to support other
mapping types (e.g. ``OrderedDict``) (:issue:`1092`).
Thank :user:`sayanarijit` for the suggestion and the PR.
3.0.0rc3 (2019-01-13)
*********************
Features:
- Make the error messages for "unknown fields" and "invalid data type"
configurable (:issue:`852`). Thanks :user:`Dunstrom` for the PR.
- ``fields.Boolean`` parses ``"yes"``/``"no"`` values (:pr:`1081`).
Thanks :user:`r1b`.
Other changes:
- *Backwards-incompatible with previous 3.x versions*: Change ordering
of ``keys`` and ``values`` arguments to ``fields.Dict``.
- Remove unused code in ``marshmallow.utils``: ``is_indexable_but_not_string``,
``float_to_decimal``, ``decimal_to_fixed``, ``from_iso`` (:pr:`1088`).
- Remove unused ``marshmallow.compat.string_types``.
Bug fixes:
- Includes bug fix from 2.18.0.
3.0.0rc2 (2019-01-03)
*********************
Features:
- Add ``register`` *class Meta* option to allow bypassing marshmallow's
internal class registry when memory usage is critical (:issue:`660`).
Bug fixes:
- Fix serializing dict-like objects with properties (:issue:`1060`).
Thanks :user:`taion` for the fix.
- Fix populating ``ValidationError.valid_data`` for ``List`` and
``Dict`` fields (:issue:`766`).
Other changes:
- Add ``marshmallow.__version_info__`` (:pr:`1074`).
- Remove the ``marshmallow.marshalling`` internal module (:pr:`1070`).
- A ``ValueError`` is raised when the ``missing`` parameter is passed
for required fields (:issue:`1040`).
- Extra keyword arguments passed to ``ValidationError`` in validators
are no longer passed to the final ``ValidationError`` raised upon
validation completion (:issue:`996`).
3.0.0rc1 (2018-11-29)
*********************
Features:
- *Backwards-incompatible*: Rework ``ValidationError`` API.
It now expects a single field name, and error structures are merged
in the final ``ValidationError`` raised when validation completes.
This allows schema-level validators to raise errors for individual
fields (:issue:`441`). Thanks :user:`maximkulkin` for
writing the original ``merge_errors`` implementation in :pr:`442` and thanks
:user:`lafrech` for completing the implementation in :pr:`1026`.
Bug fixes:
- Fix ``TypeError`` when serializing ``None`` with ``Pluck`` (:pr:`1049`).
Thanks :user:`toffan` for the catch and patch.
3.0.0b20 (2018-11-01)
*********************
Bug fixes:
- Includes bug fixes from 2.16.2 and 2.16.3.
3.0.0b19 (2018-10-24)
*********************
Features:
- Support partial loading of nested fields (:pr:`438`). Thanks
:user:`arbor-dwatson` for the PR. *Note*: Subclasses of ``fields.Nested``
now take an additional ``partial`` parameter in the ``_deserialize``
method.
Bug fixes:
- Restore ``Schema.TYPE_MAPPING``, which was removed in 3.0.0b17 (:issue:`1012`).
Other changes:
- *Backwards-incompatible*: ``_serialize`` and ``_deserialize`` methods of
all ``fields.Field`` subclasses must accept ``**kwargs`` (:pr:`1007`).
3.0.0b18 (2018-10-15)
*********************
Bug fixes:
- Fix ``Date`` deserialization when using custom format (:issue:`1001`). Thanks
:user:`Ondkloss` for reporting.
Deprecations/Removals:
- ``prefix`` parameter or ``Schema`` class is removed (:issue:`991`). The same
can be achieved using a ``@post_dump`` method.
3.0.0b17 (2018-10-13)
*********************
Features:
- Add ``format`` option to ``Date`` field (:pr:`869`).
- *Backwards-incompatible*: Rename ``DateTime``'s ``dateformat`` Meta option
to ``datetimeformat``. ``dateformat`` now applies to ``Date`` (:pr:`869`).
Thanks :user:`knagra` for implementing these changes.
- Enforce ISO 8601 when deserializing date and time (:issue:`899`).
Thanks :user:`dushr` for the report and the work on the PR.
- *Backwards-incompatible*: Raise ``ValueError`` on ``Schema`` instantiation in
case of ``attribute`` or ``data_key`` collision (:pr:`992`).
Bug fixes:
- Fix inconsistencies in field inference by refactoring the inference feature
into a dedicated field (:issue:`809`). Thanks :user:`taion` for the PR.
- When ``unknown`` is not passed to ``Nested``, default to nested ``Schema``
``unknown`` meta option rather than ``RAISE`` (:pr:`963`).
Thanks :user:`vgavro` for the PR.
- Fix loading behavior of ``fields.Pluck`` (:pr:`990`).
- Includes bug fix from 2.16.0.
3.0.0b16 (2018-09-20)
*********************
Bug fixes:
- Fix ``root`` attribute for nested container fields
on inheriting schemas (:issue:`956`). Thanks :user:`bmcbu`
for reporting.
3.0.0b15 (2018-09-18)
*********************
Bug fixes:
- Raise ``ValidationError`` instead of ``TypeError`` when non-iterable types are
validated with ``many=True`` (:issue:`851`).
- ``many=True`` no longer iterates over ``str`` and ``collections.abc.Mapping`` objects and instead
raises a ``ValidationError`` with ``{'_schema': ['Invalid input type.']}`` (:issue:`930`).
- Return ``[]`` as ``ValidationError.valid_data`` instead of ``{}`` when
``many=True`` (:issue:`907`).
Thanks :user:`tuukkamustonen` for implementing these changes.
3.0.0b14 (2018-09-15)
*********************
Features:
- Add ``fields.Pluck`` for serializing a single field from a nested object
(:issue:`800`). Thanks :user:`timc13` for the feedback and :user:`deckar01`
for the implementation.
- *Backwards-incompatible*: Passing a string argument as ``only`` to
``fields.Nested`` is no longer supported. Use ``fields.Pluck`` instead
(:issue:`800`).
- Raise a ``StringNotCollectionError`` if ``only`` or ``exclude`` is
passed as a string to ``fields.Nested`` (:pr:`931`).
- *Backwards-incompatible*: ``Float`` takes an ``allow_nan`` parameter to
explicitly allow serializing and deserializing special values (``nan``,
``inf`` and ``-inf``). ``allow_nan`` defaults to ``False``.
Other changes:
- *Backwards-incompatible*: ``Nested`` field now defaults to ``unknown=RAISE``
instead of ``EXCLUDE``. This harmonizes behavior with ``Schema`` that
already defaults to ``RAISE`` (:issue:`908`). Thanks :user:`tuukkamustonen`.
- Tested against Python 3.7.
3.0.0b13 (2018-08-04)
*********************
Bug fixes:
- Errors reported by a schema-level validator for a field in a ``Nested`` field
are stored under corresponding field name, not ``_schema`` key (:pr:`862`).
- Includes bug fix from 2.15.4.
Other changes:
- *Backwards-incompatible*: The ``unknown`` option now defaults to ``RAISE``
(`#524 (comment) <https://github.com/marshmallow-code/marshmallow/issues/524#issuecomment-397165731>`_,
:issue:`851`).
- *Backwards-incompatible*: When a schema error is raised with a ``dict`` as
payload, the ``dict`` overwrites any existing error list. Before this change,
it would be appended to the list.
- Raise a `StringNotCollectionError` if ``only`` or ``exclude`` is
passed as a string (:issue:`316`). Thanks :user:`paulocheque` for
reporting.
3.0.0b12 (2018-07-04)
*********************
Features:
- The behavior to apply when encountering unknown fields while deserializing
can be controlled with the ``unknown`` option (:issue:`524`,
:issue:`747`, :issue:`127`).
It makes it possible to either "include", "exclude", or "raise".
Thanks :user:`tuukkamustonen` for the suggestion and thanks
:user:`ramnes` for the PR.
.. warning::
The default for ``unknown`` will be changed to ``RAISE`` in the
next release.
Other changes:
- *Backwards-incompatible*: Pre/Post-processors MUST return modified data.
Returning ``None`` does not imply data were mutated (:issue:`347`). Thanks
:user:`tdevelioglu` for reporting.
- *Backwards-incompatible*: ``only`` and ``exclude`` are bound by
declared and additional fields. A ``ValueError`` is raised if invalid
fields are passed (:issue:`636`). Thanks :user:`jan-23` for reporting.
Thanks :user:`ikilledthecat` and :user:`deckar01` for the PRs.
- Format code using pre-commit (:pr:`855`).
Deprecations/Removals:
- ``ValidationError.fields`` is removed (:issue:`840`). Access field
instances from ``Schema.fields``.
3.0.0b11 (2018-05-20)
*********************
Features:
- Clean up code for schema hooks (:pr:`814`). Thanks :user:`taion`.
- Minor performance improvement from simplifying ``utils.get_value`` (:pr:`811`). Thanks again :user:`taion`.
- Add ``require_tld`` argument to ``fields.URL`` (:issue:`749`). Thanks
:user:`DenerKup` for reporting and thanks :user:`surik00` for the PR.
- ``fields.UUID`` deserializes ``bytes`` strings using ``UUID(bytes=b'...')`` (:pr:`625`).
Thanks :user:`JeffBerger` for the suggestion and the PR.
Bug fixes:
- Fields nested within ``Dict`` correctly inherit context from their
parent schema (:issue:`820`). Thanks :user:`RosanneZe` for reporting
and :user:`deckar01` for the PR.
- Includes bug fix from 2.15.3.
3.0.0b10 (2018-05-10)
*********************
Bug fixes:
- Includes bugfixes from 2.15.2.
3.0.0b9 (2018-04-25)
********************
Features:
- *Backwards-incompatible*: ``missing`` and ``default`` values are
passed in deserialized form (:issue:`378`). Thanks :user:`chadrik` for
the suggestion and thanks :user:`lafrech` for the PR.
Bug fixes:
- Includes the bugfix from 2.15.1.
3.0.0b8 (2018-03-24)
********************
Features:
- *Backwards-incompatible*: Add ``data_key`` parameter to fields for
specifying the key in the input and output data dict. This
parameter replaces both ``load_from`` and ``dump_to`` (:issue:`717`).
Thanks :user:`lafrech`.
- *Backwards-incompatible*: When ``pass_original=True`` is passed to one
of the decorators and a collection is being (de)serialized, the
``original_data`` argument will be a single object unless
``pass_many=True`` is also passed to the decorator (:issue:`315`,
:issue:`743`). Thanks :user:`stj` for the PR.
- *Backwards-incompatible*: Don't recursively check nested required
fields when the ``Nested`` field's key is missing (:issue:`319`). This
reverts :pr:`235`. Thanks :user:`chekunkov` reporting and thanks
:user:`lafrech` for the PR.
- *Backwards-incompatible*: Change error message collection for ``Dict`` field (:issue:`730`). Note:
this is backwards-incompatible with previous 3.0.0bX versions.
Thanks :user:`shabble` for the report and thanks :user:`lafrech` for the PR.
3.0.0b7 (2018-02-03)
********************
Features:
- *Backwards-incompatible*: Schemas are always strict (:issue:`377`).
The ``strict`` parameter is removed.
- *Backwards-incompatible*: ``Schema().load`` and ``Schema().dump`` return ``data`` instead of a
``(data, errors)`` tuple (:issue:`598`).
- *Backwards-incompatible*: ``Schema().load(None)`` raises a
``ValidationError`` (:issue:`511`).
See :ref:`upgrading_3_0` for a guide on updating your code.
Thanks :user:`lafrech` for implementing these changes.
Special thanks to :user:`MichalKononenko`, :user:`douglas-treadwell`, and
:user:`maximkulkin` for the discussions on these changes.
Other changes:
- *Backwards-incompatible*: Field name is not checked when ``load_from``
is specified (:pr:`714`). Thanks :user:`lafrech`.
Support:
- Add `Code of Conduct <https://marshmallow.readthedocs.io/en/dev/code_of_conduct.html>`_.
3.0.0b6 (2018-01-02)
********************
Bug fixes:
- Fixes ``ValidationError.valid_data`` when a nested field contains errors
(:issue:`710`). This bug was introduced in 3.0.0b3. Thanks
:user:`lafrech`.
Other changes:
- *Backwards-incompatible*: ``Email`` and ``URL`` fields don't validate
on serialization (:issue:`608`). This makes them more consistent with the other
fields and improves serialization performance. Thanks again :user:`lafrech`.
- ``validate.URL`` requires square brackets around IPv6 URLs (:issue:`707`). Thanks :user:`harlov`.
3.0.0b5 (2017-12-30)
********************
Features:
- Add support for structured dictionaries by providing values and keys arguments to the
``Dict`` field's constructor. This mirrors the ``List``
field's ability to validate its items (:issue:`483`). Thanks :user:`deckar01`.
Other changes:
- *Backwards-incompatible*: ``utils.from_iso`` is deprecated in favor of
``utils.from_iso_datetime`` (:issue:`694`). Thanks :user:`sklarsa`.
3.0.0b4 (2017-10-23)
********************
Features:
- Add support for millisecond, minute, hour, and week precisions to
``fields.TimeDelta`` (:issue:`537`). Thanks :user:`Fedalto` for the
suggestion and the PR.
- Includes features from release 2.14.0.
Support:
- Copyright year in docs uses ``CHANGELOG.rst``'s modified date for
reproducible builds (:issue:`679`). Thanks :user:`bmwiedemann`.
- Test against Python 3.6 in tox. Thanks :user:`Fedalto`.
- Fix typo in exception message (:issue:`659`). Thanks :user:`wonderbeyond`
for reporting and thanks :user:`yoichi` for the PR.
3.0.0b3 (2017-08-20)
********************
Features:
- Add ``valid_data`` attribute to ``ValidationError``.
- Add ``strict`` parameter to ``Integer`` (:issue:`667`). Thanks
:user:`yoichi`.
Deprecations/Removals:
- Deprecate ``json_module`` option in favor of ``render_module`` (:issue:`364`, :issue:`130`). Thanks :user:`justanr` for the suggestion.
Bug fixes:
- Includes bug fixes from releases 2.13.5 and 2.13.6.
- *Backwards-incompatible*: ``Number`` fields don't accept booleans as valid input (:issue:`623`). Thanks :user:`tuukkamustonen` for the suggestion and thanks :user:`rowillia` for the PR.
Support:
- Add benchmark script. Thanks :user:`rowillia`.
3.0.0b2 (2017-03-19)
********************
Features:
- Add ``truthy`` and ``falsy`` params to ``fields.Boolean`` (:issue:`580`). Thanks :user:`zwack` for the PR. Note: This is potentially a breaking change if your code passes the `default` parameter positionally. Pass `default` as a keyword argument instead, e.g. ``fields.Boolean(default=True)``.
Other changes:
- *Backwards-incompatible*: ``validate.ContainsOnly`` allows empty and duplicate values (:issue:`516`, :issue:`603`). Thanks :user:`maximkulkin` for the suggestion and thanks :user:`lafrech` for the PR.
Bug fixes:
- Includes bug fixes from release 2.13.4.
3.0.0b1 (2017-03-10)
********************
Features:
- ``fields.Nested`` respects ``only='field'`` when deserializing (:issue:`307`). Thanks :user:`erlingbo` for the suggestion and the PR.
- ``fields.Boolean`` parses ``"on"``/``"off"`` (:issue:`580`). Thanks :user:`marcellarius` for the suggestion.
Other changes:
- Includes changes from release 2.13.2.
- *Backwards-incompatible*: ``skip_on_field_errors`` defaults to ``True`` for ``validates_schema`` (:issue:`352`).
3.0.0a1 (2017-02-26)
********************
Features:
- ``dump_only`` and ``load_only`` for ``Function`` and ``Method`` are set based on ``serialize`` and ``deserialize`` arguments (:issue:`328`).
Other changes:
- *Backwards-incompatible*: ``fields.Method`` and ``fields.Function`` no longer swallow ``AttributeErrors`` (:issue:`395`). Thanks :user:`bereal` for the suggestion.
- *Backwards-incompatible*: ``validators.Length`` is no longer a subclass of ``validators.Range`` (:issue:`458`). Thanks :user:`deckar01` for the catch and patch.
- *Backwards-incompatible*: ``utils.get_func_args`` no longer returns bound arguments. This is consistent with the behavior of ``inspect.signature``. This change prevents a DeprecationWarning on Python 3.5 (:issue:`415`, :issue:`479`). Thanks :user:`deckar01` for the PR.
- *Backwards-incompatible*: Change the signature of ``utils.get_value`` and ``Schema.get_attribute`` for consistency with Python builtins (e.g. ``getattr``) (:issue:`341`). Thanks :user:`stas` for reporting and thanks :user:`deckar01` for the PR.
- *Backwards-incompatible*: Don't unconditionally call callable attributes (:issue:`430`, reverts :issue:`242`). Thanks :user:`mirko` for the suggestion.
- Drop support for Python 2.6 and 3.3.
Deprecation/Removals:
- Remove ``__error_handler__``, ``__accessor__``, ``@Schema.error_handler``, and ``@Schema.accessor``. Override ``Schema.handle_error`` and ``Schema.get_attribute`` instead.
- Remove ``func`` parameter of ``fields.Function``. Remove ``method_name`` parameter of ``fields.Method`` (issue:`325`). Use the ``serialize`` parameter instead.
- Remove ``extra`` parameter from ``Schema``. Use a ``@post_dump`` method to add additional data.
2.21.0 (2020-03-05)
*******************
Bug fixes:
- Don't match string-ending newlines in ``URL`` and ``Email`` fields
(:issue:`1522`). Thanks :user:`nbanmp` for the PR.
Other changes:
- Drop support for Python 3.4 (:pr:`1525`).
2.20.5 (2019-09-15)
*******************
Bug fixes:
- Fix behavior when a non-list collection is passed to the ``validate`` argument of ``fields.Email`` and ``fields.URL`` (:issue:`1400`).
2.20.4 (2019-09-11)
*******************
Bug fixes:
- Respect the ``many`` value on ``Schema`` instances passed to ``Nested`` (:issue:`1160`).
Thanks :user:`Kamforka` for reporting.
2.20.3 (2019-09-04)
*******************
Bug fixes:
- Don't swallow ``TypeError`` exceptions raised by ``Field._bind_to_schema`` or ``Schema.on_bind_field`` (:pr:`1376`).
2.20.2 (2019-08-20)
*******************
Bug fixes:
- Prevent warning about importing from ``collections`` on Python 3.7
(:pr:`1354`). Thanks :user:`nicktimko` for the PR.
2.20.1 (2019-08-13)
*******************
Bug fixes:
- Fix bug that raised ``TypeError`` when invalid data type is
passed to a nested schema with ``@validates`` (:issue:`1342`).
2.20.0 (2019-08-10)
*******************
Bug fixes:
- Fix deprecated functions' compatibility with Python 2 (:issue:`1337`).
Thanks :user:`airstandley` for the catch and patch.
- Fix error message consistency for invalid input types on nested fields (:issue:`1303`).
This is a backport of the fix in :pr:`857`. Thanks :user:`cristi23` for the
thorough bug report and the PR.
Deprecation/Removals:
- Python 2.6 is no longer officially supported (:issue:`1274`).
2.19.5 (2019-06-18)
*******************
Bug fixes:
- Fix deserializing ISO8601-formatted datetimes with less than 6-digit
miroseconds (:issue:`1251`). Thanks :user:`diego-plan9` for reporting.
2.19.4 (2019-06-16)
*******************
Bug fixes:
- Microseconds no longer gets lost when deserializing datetimes without dateutil
installed (:issue:`1147`).
2.19.3 (2019-06-15)
*******************
Bug fixes:
- Fix bug where nested fields in ``Meta.exclude`` would not work on
multiple instantiations (:issue:`1212`). Thanks :user:`MHannila` for
reporting.
2.19.2 (2019-03-30)
*******************
Bug fixes:
- Handle ``OverflowError`` when (de)serializing large integers with
``fields.Float`` (:pr:`1177`). Thanks :user:`brycedrennan` for the PR.
2.19.1 (2019-03-16)
*******************
Bug fixes:
- Fix bug where ``Nested(many=True)`` would skip first element when
serializing a generator (:issue:`1163`). Thanks :user:`khvn26` for the
catch and patch.
2.19.0 (2019-03-07)
*******************
Deprecation/Removal:
- A ``RemovedInMarshmallow3`` warning is raised when using
``fields.FormattedString``. Use ``fields.Method`` or ``fields.Function``
instead (:issue:`1141`).
2.18.1 (2019-02-15)
*******************
Bug fixes:
- A ``ChangedInMarshmallow3Warning`` is no longer raised when
``strict=False`` (:issue:`1108`). Thanks :user:`Aegdesil` for
reporting.
2.18.0 (2019-01-13)
*******************
Features:
- Add warnings for functions in ``marshmallow.utils`` that are removed in
marshmallow 3.
Bug fixes:
- Copying ``missing`` with ``copy.copy`` or ``copy.deepcopy`` will not
duplicate it (:pr:`1099`).
2.17.0 (2018-12-26)
*******************
Features:
- Add ``marshmallow.__version_info__`` (:pr:`1074`).
- Add warnings for API that is deprecated or changed to help users
prepare for marshmallow 3 (:pr:`1075`).
2.16.3 (2018-11-01)
*******************
Bug fixes:
- Prevent memory leak when dynamically creating classes with ``type()``
(:issue:`732`). Thanks :user:`asmodehn` for writing the tests to
reproduce this issue.
2.16.2 (2018-10-30)
*******************
Bug fixes:
- Prevent warning about importing from ``collections`` on Python 3.7
(:issue:`1027`). Thanks :user:`nkonin` for reporting and
:user:`jmargeta` for the PR.
2.16.1 (2018-10-17)
*******************
Bug fixes:
- Remove spurious warning about implicit collection handling
(:issue:`998`). Thanks :user:`lalvarezguillen` for reporting.
2.16.0 (2018-10-10)
*******************
Bug fixes:
- Allow username without password in basic auth part of the url in
``fields.Url`` (:pr:`982`). Thanks user:`alefnula` for the PR.
Other changes:
- Drop support for Python 3.3 (:pr:`987`).
2.15.6 (2018-09-20)
*******************
Bug fixes:
- Prevent ``TypeError`` when a non-collection is passed to a ``Schema`` with ``many=True``.
Instead, raise ``ValidationError`` with ``{'_schema': ['Invalid input type.']}`` (:issue:`906`).
- Fix ``root`` attribute for nested container fields on list
on inheriting schemas (:issue:`956`). Thanks :user:`bmcbu`
for reporting.
These fixes were backported from 3.0.0b15 and 3.0.0b16.
2.15.5 (2018-09-15)
*******************
Bug fixes:
- Handle empty SQLAlchemy lazy lists gracefully when dumping (:issue:`948`).
Thanks :user:`vke-code` for the catch and :user:`YuriHeupa` for the patch.
2.15.4 (2018-08-04)
*******************
Bug fixes:
- Respect ``load_from`` when reporting errors for ``@validates('field_name')``
(:issue:`748`). Thanks :user:`m-novikov` for the catch and patch.
2.15.3 (2018-05-20)
*******************
Bug fixes:
- Fix passing ``only`` as a string to ``nested`` when the passed field
defines ``dump_to`` (:issue:`800`, :issue:`822`). Thanks
:user:`deckar01` for the catch and patch.
2.15.2 (2018-05-10)
*******************
Bug fixes:
- Fix a race condition in validation when concurrent threads use the
same ``Schema`` instance (:issue:`783`). Thanks :user:`yupeng0921` and
:user:`lafrech` for the fix.
- Fix serialization behavior of
``fields.List(fields.Integer(as_string=True))`` (:issue:`788`). Thanks
:user:`cactus` for reporting and :user:`lafrech` for the fix.
- Fix behavior of ``exclude`` parameter when passed from parent to
nested schemas (:issue:`728`). Thanks :user:`timc13` for reporting and
:user:`deckar01` for the fix.
2.15.1 (2018-04-25)
*******************
Bug fixes:
- :cve:`CVE-2018-17175`: Fix behavior when an empty list is passed as the ``only`` argument
(:issue:`772`). Thanks :user:`deckar01` for reporting and thanks
:user:`lafrech` for the fix.
2.15.0 (2017-12-02)
*******************
Bug fixes:
- Handle ``UnicodeDecodeError`` when deserializing ``bytes`` with a
``String`` field (:issue:`650`). Thanks :user:`dan-blanchard` for the
suggestion and thanks :user:`4lissonsilveira` for the PR.
2.14.0 (2017-10-23)
*******************
Features:
- Add ``require_tld`` parameter to ``validate.URL`` (:issue:`664`).
Thanks :user:`sduthil` for the suggestion and the PR.
2.13.6 (2017-08-16)
*******************
Bug fixes:
- Fix serialization of types that implement `__getitem__`
(:issue:`669`). Thanks :user:`MichalKononenko`.
2.13.5 (2017-04-12)
*******************
Bug fixes:
- Fix validation of iso8601-formatted dates (:issue:`556`). Thanks :user:`lafrech` for reporting.
2.13.4 (2017-03-19)
*******************
Bug fixes:
- Fix symmetry of serialization and deserialization behavior when passing a dot-delimited path to the ``attribute`` parameter of fields (:issue:`450`). Thanks :user:`itajaja` for reporting.
2.13.3 (2017-03-11)
*******************
Bug fixes:
- Restore backwards-compatibility of ``SchemaOpts`` constructor (:issue:`597`). Thanks :user:`Wesmania` for reporting and thanks :user:`frol` for the fix.
2.13.2 (2017-03-10)
*******************
Bug fixes:
- Fix inheritance of ``ordered`` option when ``Schema`` subclasses define ``class Meta`` (:issue:`593`). Thanks :user:`frol`.
Support:
- Update contributing docs.
2.13.1 (2017-03-04)
*******************
Bug fixes:
- Fix sorting on Schema subclasses when ``ordered=True`` (:issue:`592`). Thanks :user:`frol`.
2.13.0 (2017-02-18)
*******************
Features:
- Minor optimizations (:issue:`577`). Thanks :user:`rowillia` for the PR.
2.12.2 (2017-01-30)
*******************
Bug fixes:
- Unbound fields return `None` rather returning the field itself. This fixes a corner case introduced in :issue:`572`. Thanks :user:`touilleMan` for reporting and :user:`YuriHeupa` for the fix.
2.12.1 (2017-01-23)
*******************
Bug fixes:
- Fix behavior when a ``Nested`` field is composed within a ``List`` field (:issue:`572`). Thanks :user:`avish` for reporting and :user:`YuriHeupa` for the PR.
2.12.0 (2017-01-22)
*******************
Features:
- Allow passing nested attributes (e.g. ``'child.field'``) to the ``dump_only`` and ``load_only`` parameters of ``Schema`` (:issue:`572`). Thanks :user:`YuriHeupa` for the PR.
- Add ``schemes`` parameter to ``fields.URL`` (:issue:`574`). Thanks :user:`mosquito` for the PR.
2.11.1 (2017-01-08)
*******************
Bug fixes:
- Allow ``strict`` class Meta option to be overridden by constructor (:issue:`550`). Thanks :user:`douglas-treadwell` for reporting and thanks :user:`podhmo` for the PR.
2.11.0 (2017-01-08)
*******************
Features:
- Import ``marshmallow.fields`` in ``marshmallow/__init__.py`` to save an import when importing the ``marshmallow`` module (:issue:`557`). Thanks :user:`mindojo-victor`.
Support:
- Documentation: Improve example in "Validating Original Input Data" (:issue:`558`). Thanks :user:`altaurog`.
- Test against Python 3.6.
2.10.5 (2016-12-19)
*******************
Bug fixes:
- Reset user-defined kwargs passed to ``ValidationError`` on each ``Schema.load`` call (:issue:`565`). Thanks :user:`jbasko` for the catch and patch.
Support:
- Tests: Fix redefinition of ``test_utils.test_get_value()`` (:issue:`562`). Thanks :user:`nelfin`.
2.10.4 (2016-11-18)
*******************
Bug fixes:
- `Function` field works with callables that use Python 3 type annotations (:issue:`540`). Thanks :user:`martinstein` for reporting and thanks :user:`sabinem`, :user:`lafrech`, and :user:`maximkulkin` for the work on the PR.
2.10.3 (2016-10-02)
*******************
Bug fixes:
- Fix behavior for serializing missing data with ``Number`` fields when ``as_string=True`` is passed (:issue:`538`). Thanks :user:`jessemyers` for reporting.
2.10.2 (2016-09-25)
*******************
Bug fixes:
- Use fixed-point notation rather than engineering notation when serializing with ``Decimal`` (:issue:`534`). Thanks :user:`gdub`.
- Fix UUID validation on serialization and deserialization of ``uuid.UUID`` objects (:issue:`532`). Thanks :user:`pauljz`.
2.10.1 (2016-09-14)
*******************
Bug fixes:
- Fix behavior when using ``validate.Equal(False)`` (:issue:`484`). Thanks :user:`pktangyue` for reporting and thanks :user:`tuukkamustonen` for the fix.
- Fix ``strict`` behavior when errors are raised in ``pre_dump``/``post_dump`` processors (:issue:`521`). Thanks :user:`tvuotila` for the catch and patch.
- Fix validation of nested fields on dumping (:issue:`528`). Thanks again :user:`tvuotila`.
2.10.0 (2016-09-05)
*******************
Features:
- Errors raised by pre/post-load/dump methods will be added to a schema's errors dictionary (:issue:`472`). Thanks :user:`dbertouille` for the suggestion and for the PR.
2.9.1 (2016-07-21)
******************
Bug fixes:
- Fix serialization of ``datetime.time`` objects with microseconds (:issue:`464`). Thanks :user:`Tim-Erwin` for reporting and thanks :user:`vuonghv` for the fix.
- Make ``@validates`` consistent with field validator behavior: if validation fails, the field will not be included in the deserialized output (:issue:`391`). Thanks :user:`martinstein` for reporting and thanks :user:`vuonghv` for the fix.
2.9.0 (2016-07-06)
******************
- ``Decimal`` field coerces input values to a string before deserializing to a `decimal.Decimal` object in order to avoid transformation of float values under 12 significant digits (:issue:`434`, :issue:`435`). Thanks :user:`davidthornton` for the PR.
2.8.0 (2016-06-23)
******************
Features:
- Allow ``only`` and ``exclude`` parameters to take nested fields, using dot-delimited syntax (e.g. ``only=['blog.author.email']``) (:issue:`402`). Thanks :user:`Tim-Erwin` and :user:`deckar01` for the discussion and implementation.
Support:
- Update tasks.py for compatibility with invoke>=0.13.0. Thanks :user:`deckar01`.
2.7.3 (2016-05-05)
******************
- Make ``field.parent`` and ``field.name`` accessible to ``on_bind_field`` (:issue:`449`). Thanks :user:`immerrr`.
2.7.2 (2016-04-27)
******************
No code changes in this release. This is a reupload in order to distribute an sdist for the last hotfix release. See :issue:`443`.
Support:
- Update license entry in setup.py to fix RPM distributions (:issue:`433`). Thanks :user:`rrajaravi` for reporting.
2.7.1 (2016-04-08)
******************
Bug fixes:
- Only add Schemas to class registry if a class name is provided. This allows Schemas to be
constructed dynamically using the ``type`` constructor without getting added to the class registry (which is useful for saving memory).
2.7.0 (2016-04-04)
******************
Features:
- Make context available to ``Nested`` field's ``on_bind_field`` method (:issue:`408`). Thanks :user:`immerrr` for the PR.
- Pass through user ``ValidationError`` kwargs (:issue:`418`). Thanks :user:`russelldavies` for helping implement this.
Other changes:
- Remove unused attributes ``root``, ``parent``, and ``name`` from ``SchemaABC`` (:issue:`410`). Thanks :user:`Tim-Erwin` for the PR.
2.6.1 (2016-03-17)
******************
Bug fixes:
- Respect ``load_from`` when reporting errors for nested required fields (:issue:`414`). Thanks :user:`yumike`.
2.6.0 (2016-02-01)
******************
Features:
- Add ``partial`` argument to ``Schema.validate`` (:issue:`379`). Thanks :user:`tdevelioglu` for the PR.
- Add ``equal`` argument to ``validate.Length``. Thanks :user:`daniloakamine`.
- Collect all validation errors for each item deserialized by a ``List`` field (:issue:`345`). Thanks :user:`maximkulkin` for the report and the PR.
2.5.0 (2016-01-16)
******************
Features:
- Allow a tuple of field names to be passed as the ``partial`` argument to ``Schema.load`` (:issue:`369`). Thanks :user:`tdevelioglu` for the PR.
- Add ``schemes`` argument to ``validate.URL`` (:issue:`356`).
2.4.2 (2015-12-08)
******************
Bug fixes:
- Prevent duplicate error messages when validating nested collections (:issue:`360`). Thanks :user:`alexmorken` for the catch and patch.
2.4.1 (2015-12-07)
******************
Bug fixes:
- Serializing an iterator will not drop the first item (:issue:`343`, :issue:`353`). Thanks :user:`jmcarp` for the patch. Thanks :user:`edgarallang` and :user:`jmcarp` for reporting.
2.4.0 (2015-12-06)
******************
Features:
- Add ``skip_on_field_errors`` parameter to ``validates_schema`` (:issue:`323`). Thanks :user:`jjvattamattom` for the suggestion and :user:`d-sutherland` for the PR.
Bug fixes:
- Fix ``FormattedString`` serialization (:issue:`348`). Thanks :user:`acaird` for reporting.
- Fix ``@validates`` behavior when used when ``attribute`` is specified and ``strict=True`` (:issue:`350`). Thanks :user:`density` for reporting.
2.3.0 (2015-11-22)
******************
Features:
- Add ``dump_to`` parameter to fields (:issue:`310`). Thanks :user:`ShayanArmanPercolate` for the suggestion. Thanks :user:`franciscod` and :user:`ewang` for the PRs.
- The ``deserialize`` function passed to ``fields.Function`` can optionally receive a ``context`` argument (:issue:`324`). Thanks :user:`DamianHeard`.
- The ``serialize`` function passed to ``fields.Function`` is optional (:issue:`325`). Thanks again :user:`DamianHeard`.
- The ``serialize`` function passed to ``fields.Method`` is optional (:issue:`329`). Thanks :user:`justanr`.
Deprecation/Removal:
- The ``func`` argument of ``fields.Function`` has been renamed to ``serialize``.
- The ``method_name`` argument of ``fields.Method`` has been renamed to ``serialize``.
``func`` and ``method_name`` are still present for backwards-compatibility, but they will both be removed in marshmallow 3.0.
2.2.1 (2015-11-11)
******************
Bug fixes:
- Skip field validators for fields that aren't included in ``only`` (:issue:`320`). Thanks :user:`carlos-alberto` for reporting and :user:`eprikazc` for the PR.
2.2.0 (2015-10-26)
******************
Features:
- Add support for partial deserialization with the ``partial`` argument to ``Schema`` and ``Schema.load`` (:issue:`290`). Thanks :user:`taion`.
Deprecation/Removals:
- ``Query`` and ``QuerySelect`` fields are removed.
- Passing of strings to ``required`` and ``allow_none`` is removed. Pass the ``error_messages`` argument instead.
Support:
- Add example of Schema inheritance in docs (:issue:`225`). Thanks :user:`martinstein` for the suggestion and :user:`juanrossi` for the PR.
- Add "Customizing Error Messages" section to custom fields docs.
2.1.3 (2015-10-18)
******************
Bug fixes:
- Fix serialization of collections for which ``iter`` will modify position, e.g. Pymongo cursors (:issue:`303`). Thanks :user:`Mise` for the catch and patch.
2.1.2 (2015-10-14)
******************
Bug fixes:
- Fix passing data to schema validator when using ``@validates_schema(many=True)`` (:issue:`297`). Thanks :user:`d-sutherland` for reporting.
- Fix usage of ``@validates`` with a nested field when ``many=True`` (:issue:`298`). Thanks :user:`nelfin` for the catch and patch.
2.1.1 (2015-10-07)
******************
Bug fixes:
- ``Constant`` field deserializes to its value regardless of whether its field name is present in input data (:issue:`291`). Thanks :user:`fayazkhan` for reporting.
2.1.0 (2015-09-30)
******************
Features:
- Add ``Dict`` field for arbitrary mapping data (:issue:`251`). Thanks :user:`dwieeb` for adding this and :user:`Dowwie` for the suggestion.
- Add ``Field.root`` property, which references the field's Schema.
Deprecation/Removals:
- The ``extra`` param of ``Schema`` is deprecated. Add extra data in a ``post_load`` method instead.
- ``UnmarshallingError`` and ``MarshallingError`` are removed.
Bug fixes:
- Fix storing multiple schema-level validation errors (:issue:`287`). Thanks :user:`evgeny-sureev` for the patch.
- If ``missing=None`` on a field, ``allow_none`` will be set to ``True``.
Other changes:
- A ``List's`` inner field will have the list field set as its parent. Use ``root`` to access the ``Schema``.
2.0.0 (2015-09-25)
******************
Features:
- Make error messages configurable at the class level and instance level (``Field.default_error_messages`` attribute and ``error_messages`` parameter, respectively).
Deprecation/Removals:
- Remove ``make_object``. Use a ``post_load`` method instead (:issue:`277`).
- Remove the ``error`` parameter and attribute of ``Field``.
- Passing string arguments to ``required`` and ``allow_none`` is deprecated. Pass the ``error_messages`` argument instead. **This API will be removed in version 2.2**.
- Remove ``Arbitrary``, ``Fixed``, and ``Price`` fields (:issue:`86`). Use ``Decimal`` instead.
- Remove ``Select`` / ``Enum`` fields (:issue:`135`). Use the ``OneOf`` validator instead.
Bug fixes:
- Fix error format for ``Nested`` fields when ``many=True``. Thanks :user:`alexmorken`.
- ``pre_dump`` methods are invoked before implicit field creation. Thanks :user:`makmanalp` for reporting.
- Return correct "required" error message for ``Nested`` field.
- The ``only`` argument passed to a ``Schema`` is bounded by the ``fields`` option (:issue:`183`). Thanks :user:`lustdante` for the suggestion.
Changes from 2.0.0rc2:
- ``error_handler`` and ``accessor`` options are replaced with the ``handle_error`` and ``get_attribute`` methods :issue:`284`.
- Remove ``marshmallow.compat.plain_function`` since it is no longer used.
- Non-collection values are invalid input for ``List`` field (:issue:`231`). Thanks :user:`density` for reporting.
- Bug fix: Prevent infinite loop when validating a required, self-nested field. Thanks :user:`Bachmann1234` for the fix.
2.0.0rc2 (2015-09-16)
*********************
Deprecation/Removals:
- ``make_object`` is deprecated. Use a ``post_load`` method instead (:issue:`277`). **This method will be removed in the final 2.0 release**.
- ``Schema.accessor`` and ``Schema.error_handler`` decorators are deprecated. Define the ``accessor`` and ``error_handler`` class Meta options instead.
Bug fixes:
- Allow non-field names to be passed to ``ValidationError`` (:issue:`273`). Thanks :user:`evgeny-sureev` for the catch and patch.
Changes from 2.0.0rc1:
- The ``raw`` parameter of the ``pre_*``, ``post_*``, ``validates_schema`` decorators was renamed to ``pass_many`` (:issue:`276`).
- Add ``pass_original`` parameter to ``post_load`` and ``post_dump`` (:issue:`216`).
- Methods decorated with the ``pre_*``, ``post_*``, and ``validates_*`` decorators must be instance methods. Class methods and instance methods are not supported at this time.
2.0.0rc1 (2015-09-13)
*********************
Features:
- *Backwards-incompatible*: ``fields.Field._deserialize`` now takes ``attr`` and ``data`` as arguments (:issue:`172`). Thanks :user:`alexmic` and :user:`kevinastone` for the suggestion.
- Allow a ``Field's`` ``attribute`` to be modified during deserialization (:issue:`266`). Thanks :user:`floqqi`.
- Allow partially-valid data to be returned for ``Nested`` fields (:issue:`269`). Thanks :user:`jomag` for the suggestion.
- Add ``Schema.on_bind_field`` hook which allows a ``Schema`` to modify its fields when they are bound.
- Stricter validation of string, boolean, and number fields (:issue:`231`). Thanks :user:`touilleMan` for the suggestion.
- Improve consistency of error messages.
Deprecation/Removals:
- ``Schema.validator``, ``Schema.preprocessor``, and ``Schema.data_handler`` are removed. Use ``validates_schema``, ``pre_load``, and ``post_dump`` instead.
- ``QuerySelect`` and ``QuerySelectList`` are deprecated (:issue:`227`). **These fields will be removed in version 2.1.**
- ``utils.get_callable_name`` is removed.
Bug fixes:
- If a date format string is passed to a ``DateTime`` field, it is always used for deserialization (:issue:`248`). Thanks :user:`bartaelterman` and :user:`praveen-p`.
Support:
- Documentation: Add "Using Context" section to "Extending Schemas" page (:issue:`224`).
- Include tests and docs in release tarballs (:issue:`201`).
- Test against Python 3.5.
2.0.0b5 (2015-08-23)
********************
Features:
- If a field corresponds to a callable attribute, it will be called upon serialization. Thanks :user:`alexmorken`.
- Add ``load_only`` and ``dump_only`` ``class Meta`` options. Thanks :user:`kelvinhammond`.
- If a ``Nested`` field is required, recursively validate any required fields in the nested schema (:issue:`235`). Thanks :user:`max-orhai`.
- Improve error message if a list of dicts is not passed to a ``Nested`` field for which ``many=True``. Thanks again :user:`max-orhai`.
Bug fixes:
- ``make_object`` is only called after all validators and postprocessors have finished (:issue:`253`). Thanks :user:`sunsongxp` for reporting.
- If an invalid type is passed to ``Schema`` and ``strict=False``, store a ``_schema`` error in the errors dict rather than raise an exception (:issue:`261`). Thanks :user:`density` for reporting.
Other changes:
- ``make_object`` is only called when input data are completely valid (:issue:`243`). Thanks :user:`kissgyorgy` for reporting.
- Change default error messages for ``URL`` and ``Email`` validators so that they don't include user input (:issue:`255`).
- ``Email`` validator permits email addresses with non-ASCII characters, as per RFC 6530 (:issue:`221`). Thanks :user:`lextoumbourou` for reporting and :user:`mwstobo` for sending the patch.
2.0.0b4 (2015-07-07)
********************
Features:
- ``List`` field respects the ``attribute`` argument of the inner field. Thanks :user:`jmcarp`.
- The ``container`` field ``List`` field has access to its parent ``Schema`` via its ``parent`` attribute. Thanks again :user:`jmcarp`.
Deprecation/Removals:
- Legacy validator functions have been removed (:issue:`73`). Use the class-based validators in ``marshmallow.validate`` instead.
Bug fixes:
- ``fields.Nested`` correctly serializes nested ``sets`` (:issue:`233`). Thanks :user:`traut`.
Changes from 2.0.0b3:
- If ``load_from`` is used on deserialization, the value of ``load_from`` is used as the key in the errors dict (:issue:`232`). Thanks :user:`alexmorken`.
2.0.0b3 (2015-06-14)
*********************
Features:
- Add ``marshmallow.validates_schema`` decorator for defining schema-level validators (:issue:`116`).
- Add ``marshmallow.validates`` decorator for defining field validators as Schema methods (:issue:`116`). Thanks :user:`philtay`.
- Performance improvements.
- Defining ``__marshallable__`` on complex objects is no longer necessary.
- Add ``fields.Constant``. Thanks :user:`kevinastone`.
Deprecation/Removals:
- Remove ``skip_missing`` class Meta option. By default, missing inputs are excluded from serialized output (:issue:`211`).
- Remove optional ``context`` parameter that gets passed to methods for ``Method`` fields.
- ``Schema.validator`` is deprecated. Use ``marshmallow.validates_schema`` instead.
- ``utils.get_func_name`` is removed. Use ``utils.get_callable_name`` instead.
Bug fixes:
- Fix serializing values from keyed tuple types (regression of :issue:`28`). Thanks :user:`makmanalp` for reporting.
Other changes:
- Remove unnecessary call to ``utils.get_value`` for ``Function`` and ``Method`` fields (:issue:`208`). Thanks :user:`jmcarp`.
- Serializing a collection without passing ``many=True`` will not result in an error. Be very careful to pass the ``many`` argument when necessary.
Support:
- Documentation: Update Flask and Peewee examples. Update Quickstart.
Changes from 2.0.0b2:
- ``Boolean`` field serializes ``None`` to ``None``, for consistency with other fields (:issue:`213`). Thanks :user:`cmanallen` for reporting.
- Bug fix: ``load_only`` fields do not get validated during serialization.
- Implicit passing of original, raw data to Schema validators is removed. Use ``@marshmallow.validates_schema(pass_original=True)`` instead.
2.0.0b2 (2015-05-03)
********************
Features:
- Add useful ``__repr__`` methods to validators (:issue:`204`). Thanks :user:`philtay`.
- *Backwards-incompatible*: By default, ``NaN``, ``Infinity``, and ``-Infinity`` are invalid values for ``fields.Decimal``. Pass ``allow_nan=True`` to allow these values. Thanks :user:`philtay`.
Changes from 2.0.0b1:
- Fix serialization of ``None`` for ``Time``, ``TimeDelta``, and ``Date`` fields (a regression introduced in 2.0.0a1).
Includes bug fixes from 1.2.6.
2.0.0b1 (2015-04-26)
********************
Features:
- Errored fields will not appear in (de)serialized output dictionaries (:issue:`153`, :issue:`202`).
- Instantiate ``OPTIONS_CLASS`` in ``SchemaMeta``. This makes ``Schema.opts`` available in metaclass methods. It also causes validation to occur earlier (upon ``Schema`` class declaration rather than instantiation).
- Add ``SchemaMeta.get_declared_fields`` class method to support adding additional declared fields.
Deprecation/Removals:
- Remove ``allow_null`` parameter of ``fields.Nested`` (:issue:`203`).
Changes from 2.0.0a1:
- Fix serialization of `None` for ``fields.Email``.
2.0.0a1 (2015-04-25)
********************
Features:
- *Backwards-incompatible*: When ``many=True``, the errors dictionary returned by ``dump`` and ``load`` will be keyed on the indices of invalid items in the (de)serialized collection (:issue:`75`). Add ``index_errors=False`` on a Schema's ``class Meta`` options to disable this behavior.
- *Backwards-incompatible*: By default, fields will raise a ValidationError if the input is ``None``. The ``allow_none`` parameter can override this behavior.
- *Backwards-incompatible*: A ``Field's`` ``default`` parameter is only used if explicitly set and the field's value is missing in the input to `Schema.dump`. If not set, the key will not be present in the serialized output for missing values . This is the behavior for *all* fields. ``fields.Str`` no longer defaults to ``''``, ``fields.Int`` no longer defaults to ``0``, etc. (:issue:`199`). Thanks :user:`jmcarp` for the feedback.
- In ``strict`` mode, a ``ValidationError`` is raised. Error messages are accessed via the ``ValidationError's`` ``messages`` attribute (:issue:`128`).
- Add ``allow_none`` parameter to ``fields.Field``. If ``False`` (the default), validation fails when the field's value is ``None`` (:issue:`76`, :issue:`111`). If ``allow_none`` is ``True``, ``None`` is considered valid and will deserialize to ``None``.
- Schema-level validators can store error messages for multiple fields (:issue:`118`). Thanks :user:`ksesong` for the suggestion.
- Add ``pre_load``, ``post_load``, ``pre_dump``, and ``post_dump`` Schema method decorators for defining pre- and post- processing routines (:issue:`153`, :issue:`179`). Thanks :user:`davidism`, :user:`taion`, and :user:`jmcarp` for the suggestions and feedback. Thanks :user:`taion` for the implementation.
- Error message for ``required`` validation is configurable. (:issue:`78`). Thanks :user:`svenstaro` for the suggestion. Thanks :user:`0xDCA` for the implementation.
- Add ``load_from`` parameter to fields (:issue:`125`). Thanks :user:`hakjoon`.
- Add ``load_only`` and ``dump_only`` parameters to fields (:issue:`61`, :issue:`87`). Thanks :user:`philtay`.
- Add `missing` parameter to fields (:issue:`115`). Thanks :user:`philtay`.
- Schema validators can take an optional ``raw_data`` argument which contains raw input data, incl. data not specified in the schema (:issue:`127`). Thanks :user:`ryanlowe0`.
- Add ``validate.OneOf`` (:issue:`135`) and ``validate.ContainsOnly`` (:issue:`149`) validators. Thanks :user:`philtay`.
- Error messages for validators can be interpolated with `{input}` and other values (depending on the validator).
- ``fields.TimeDelta`` always serializes to an integer value in order to avoid rounding errors (:issue:`105`). Thanks :user:`philtay`.
- Add ``include`` class Meta option to support field names which are Python keywords (:issue:`139`). Thanks :user:`nickretallack` for the suggestion.
- ``exclude`` parameter is respected when used together with ``only`` parameter (:issue:`165`). Thanks :user:`lustdante` for the catch and patch.
- ``fields.List`` works as expected with generators and sets (:issue:`185`). Thanks :user:`sergey-aganezov-jr`.
Deprecation/Removals:
- ``MarshallingError`` and ``UnmarshallingError`` error are deprecated in favor of a single ``ValidationError`` (:issue:`160`).
- ``context`` argument passed to Method fields is deprecated. Use ``self.context`` instead (:issue:`184`).
- Remove ``ForcedError``.
- Remove support for generator functions that yield validators (:issue:`74`). Plain generators of validators are still supported.
- The ``Select/Enum`` field is deprecated in favor of using ``validate.OneOf`` validator (:issue:`135`).
- Remove legacy, pre-1.0 API (``Schema.data`` and ``Schema.errors`` properties) (:issue:`73`).
- Remove ``null`` value.
Other changes:
- ``Marshaller``, ``Unmarshaller`` were moved to ``marshmallow.marshalling``. These should be considered private API (:issue:`129`).
- Make ``allow_null=True`` the default for ``Nested`` fields. This will make ``None`` serialize to ``None`` rather than a dictionary with empty values (:issue:`132`). Thanks :user:`nickrellack` for the suggestion.
1.2.6 (2015-05-03)
******************
Bug fixes:
- Fix validation error message for ``fields.Decimal``.
- Allow error message for ``fields.Boolean`` to be customized with the ``error`` parameter (like other fields).
1.2.5 (2015-04-25)
******************
Bug fixes:
- Fix validation of invalid types passed to a ``Nested`` field when ``many=True`` (:issue:`188`). Thanks :user:`juanrossi` for reporting.
Support:
- Fix pep8 dev dependency for flake8. Thanks :user:`taion`.
1.2.4 (2015-03-22)
******************
Bug fixes:
- Fix behavior of ``as_string`` on ``fields.Integer`` (:issue:`173`). Thanks :user:`taion` for the catch and patch.
Other changes:
- Remove dead code from ``fields.Field``. Thanks :user:`taion`.
Support:
- Correction to ``_postprocess`` method in docs. Thanks again :user:`taion`.
1.2.3 (2015-03-15)
******************
Bug fixes:
- Fix inheritance of ``ordered`` class Meta option (:issue:`162`). Thanks :user:`stephenfin` for reporting.
1.2.2 (2015-02-23)
******************
Bug fixes:
- Fix behavior of ``skip_missing`` and ``accessor`` options when ``many=True`` (:issue:`137`). Thanks :user:`3rdcycle`.
- Fix bug that could cause an ``AttributeError`` when nesting schemas with schema-level validators (:issue:`144`). Thanks :user:`vovanbo` for reporting.
1.2.1 (2015-01-11)
******************
Bug fixes:
- A ``Schema's`` ``error_handler``--if defined--will execute if ``Schema.validate`` returns validation errors (:issue:`121`).
- Deserializing `None` returns `None` rather than raising an ``AttributeError`` (:issue:`123`). Thanks :user:`RealSalmon` for the catch and patch.
1.2.0 (2014-12-22)
******************
Features:
- Add ``QuerySelect`` and ``QuerySelectList`` fields (:issue:`84`).
- Convert validators in ``marshmallow.validate`` into class-based callables to make them easier to use when declaring fields (:issue:`85`).
- Add ``Decimal`` field which is safe to use when dealing with precise numbers (:issue:`86`).
Thanks :user:`philtay` for these contributions.
Bug fixes:
- ``Date`` fields correctly deserializes to a ``datetime.date`` object when ``python-dateutil`` is not installed (:issue:`79`). Thanks :user:`malexer` for the catch and patch.
- Fix bug that raised an ``AttributeError`` when using a class-based validator.
- Fix ``as_string`` behavior of Number fields when serializing to default value.
- Deserializing ``None`` or the empty string with either a ``DateTime``, ``Date``, ``Time`` or ``TimeDelta`` results in the correct unmarshalling errors (:issue:`96`). Thanks :user:`svenstaro` for reporting and helping with this.
- Fix error handling when deserializing invalid UUIDs (:issue:`106`). Thanks :user:`vesauimonen` for the catch and patch.
- ``Schema.loads`` correctly defaults to use the value of ``self.many`` rather than defaulting to ``False`` (:issue:`108`). Thanks :user:`davidism` for the catch and patch.
- Validators, data handlers, and preprocessors are no longer shared between schema subclasses (:issue:`88`). Thanks :user:`amikholap` for reporting.
- Fix error handling when passing a ``dict`` or ``list`` to a ``ValidationError`` (:issue:`110`). Thanks :user:`ksesong` for reporting.
Deprecation:
- The validator functions in the ``validate`` module are deprecated in favor of the class-based validators (:issue:`85`).
- The ``Arbitrary``, ``Price``, and ``Fixed`` fields are deprecated in favor of the ``Decimal`` field (:issue:`86`).
Support:
- Update docs theme.
- Update contributing docs (:issue:`77`).
- Fix namespacing example in "Extending Schema" docs. Thanks :user:`Ch00k`.
- Exclude virtualenv directories from syntax checking (:issue:`99`). Thanks :user:`svenstaro`.
1.1.0 (2014-12-02)
******************
Features:
- Add ``Schema.validate`` method which validates input data against a schema. Similar to ``Schema.load``, but does not call ``make_object`` and only returns the errors dictionary.
- Add several validation functions to the ``validate`` module. Thanks :user:`philtay`.
- Store field name and instance on exceptions raised in ``strict`` mode.
Bug fixes:
- Fix serializing dictionaries when field names are methods of ``dict`` (e.g. ``"items"``). Thanks :user:`rozenm` for reporting.
- If a Nested field is passed ``many=True``, ``None`` serializes to an empty list. Thanks :user:`nickretallack` for reporting.
- Fix behavior of ``many`` argument passed to ``dump`` and ``load``. Thanks :user:`svenstaro` for reporting and helping with this.
- Fix ``skip_missing`` behavior for ``String`` and ``List`` fields. Thanks :user:`malexer` for reporting.
- Fix compatibility with python-dateutil 2.3.
- More consistent error messages across ``DateTime``, ``TimeDelta``, ``Date``, and ``Time`` fields.
Support:
- Update Flask and Peewee examples.
1.0.1 (2014-11-18)
******************
Hotfix release.
- Ensure that errors dictionary is correctly cleared on each call to ``Schema.dump`` and ``Schema.load``.
1.0.0 (2014-11-16)
******************
Adds new features, speed improvements, better error handling, and updated documentation.
- Add ``skip_missing`` ``class Meta`` option.
- A field's ``default`` may be a callable.
- Allow accessor function to be configured via the ``Schema.accessor`` decorator or the ``__accessor__`` class member.
- ``URL`` and ``Email`` fields are validated upon serialization.
- ``dump`` and ``load`` can receive the ``many`` argument.
- Move a number of utility functions from fields.py to utils.py.
- More useful ``repr`` for ``Field`` classes.
- If a field's default is ``fields.missing`` and its serialized value is ``None``, it will not be included in the final serialized result.
- Schema.dumps no longer coerces its result to a binary string on Python 3.
- *Backwards-incompatible*: Schema output is no longer an ``OrderedDict`` by default. If you want ordered field output, you must explicitly set the ``ordered`` option to ``True``.
- *Backwards-incompatible*: ``error`` parameter of the ``Field`` constructor is deprecated. Raise a ``ValidationError`` instead.
- Expanded test coverage.
- Updated docs.
1.0.0-a (2014-10-19)
********************
Major reworking and simplification of the public API, centered around support for deserialization, improved validation, and a less stateful ``Schema`` class.
* Rename ``Serializer`` to ``Schema``.
* Support for deserialization.
* Use the ``Schema.dump`` and ``Schema.load`` methods for serializing and deserializing, respectively.
* *Backwards-incompatible*: Remove ``Serializer.json`` and ``Serializer.to_json``. Use ``Schema.dumps`` instead.
* Reworked fields interface.
* *Backwards-incompatible*: ``Field`` classes implement ``_serialize`` and ``_deserialize`` methods. ``serialize`` and ``deserialize`` comprise the public API for a ``Field``. ``Field.format`` and ``Field.output`` have been removed.
* Add ``exceptions.ForcedError`` which allows errors to be raised during serialization (instead of storing errors in the ``errors`` dict).
* *Backwards-incompatible*: ``DateTime`` field serializes to ISO8601 format by default (instead of RFC822).
* *Backwards-incompatible*: Remove ``Serializer.factory`` method. It is no longer necessary with the ``dump`` method.
* *Backwards-incompatible*: Allow nesting a serializer within itself recursively. Use ``exclude`` or ``only`` to prevent infinite recursion.
* *Backwards-incompatible*: Multiple errors can be stored for a single field. The errors dictionary returned by ``load`` and ``dump`` have lists of error messages keyed by field name.
* Remove ``validated`` decorator. Validation occurs within ``Field`` methods.
* ``Function`` field raises a ``ValueError`` if an uncallable object is passed to its constructor.
* ``Nested`` fields inherit context from their parent.
* Add ``Schema.preprocessor`` and ``Schema.validator`` decorators for registering preprocessing and schema-level validation functions respectively.
* Custom error messages can be specified by raising a ``ValidationError`` within a validation function.
* Extra keyword arguments passed to a Field are stored as metadata.
* Fix ordering of field output.
* Fix behavior of the ``required`` parameter on ``Nested`` fields.
* Fix serializing keyed tuple types (e.g. ``namedtuple``) with ``class Meta`` options.
* Fix default value for ``Fixed`` and ``Price`` fields.
* Fix serialization of binary strings.
* ``Schemas`` can inherit fields from non-``Schema`` base classes (e.g. mixins). Also, fields are inherited according to the MRO (rather than recursing over base classes). Thanks :user:`jmcarp`.
* Add ``Str``, ``Bool``, and ``Int`` field class aliases.
0.7.0 (2014-06-22)
******************
* Add ``Serializer.error_handler`` decorator that registers a custom error handler.
* Add ``Serializer.data_handler`` decorator that registers data post-processing callbacks.
* *Backwards-incompatible*: ``process_data`` method is deprecated. Use the ``data_handler`` decorator instead.
* Fix bug that raised error when passing ``extra`` data together with ``many=True``. Thanks :user:`buttsicles` for reporting.
* If ``required=True`` validation is violated for a given ``Field``, it will raise an error message that is different from the message specified by the ``error`` argument. Thanks :user:`asteinlein`.
* More generic error message raised when required field is missing.
* ``validated`` decorator should only wrap a ``Field`` class's ``output`` method.
0.6.0 (2014-06-03)
******************
* Fix bug in serializing keyed tuple types, e.g. ``namedtuple`` and ``KeyedTuple``.
* Nested field can load a serializer by its class name as a string. This makes it easier to implement 2-way nesting.
* Make ``Serializer.data`` override-able.
0.5.5 (2014-05-02)
******************
* Add ``Serializer.factory`` for creating a factory function that returns a Serializer instance.
* ``MarshallingError`` stores its underlying exception as an instance variable. This is useful for inspecting errors.
* ``fields.Select`` is aliased to ``fields.Enum``.
* Add ``fields.__all__`` and ``marshmallow.__all__`` so that the modules can be more easily extended.
* Expose ``Serializer.OPTIONS_CLASS`` as a class variable so that options defaults can be overridden.
* Add ``Serializer.process_data`` hook that allows subclasses to manipulate the final output data.
0.5.4 (2014-04-17)
******************
* Add ``json_module`` class Meta option.
* Add ``required`` option to fields . Thanks :user:`DeaconDesperado`.
* Tested on Python 3.4 and PyPy.
0.5.3 (2014-03-02)
******************
* Fix ``Integer`` field default. It is now ``0`` instead of ``0.0``. Thanks :user:`kalasjocke`.
* Add ``context`` param to ``Serializer``. Allows accessing arbitrary objects in ``Function`` and ``Method`` fields.
* ``Function`` and ``Method`` fields raise ``MarshallingError`` if their argument is uncallable.
0.5.2 (2014-02-10)
******************
* Enable custom field validation via the ``validate`` parameter.
* Add ``utils.from_rfc`` for parsing RFC datestring to Python datetime object.
0.5.1 (2014-02-02)
******************
* Avoid unnecessary attribute access in ``utils.to_marshallable_type`` for improved performance.
* Fix RFC822 formatting for localized datetimes.
0.5.0 (2013-12-29)
******************
* Can customize validation error messages by passing the ``error`` parameter to a field.
* *Backwards-incompatible*: Rename ``fields.NumberField`` -> ``fields.Number``.
* Add ``fields.Select``. Thanks :user:`ecarreras`.
* Support nesting a Serializer within itself by passing ``"self"`` into ``fields.Nested`` (only up to depth=1).
* *Backwards-incompatible*: No implicit serializing of collections. Must set ``many=True`` if serializing to a list. This ensures that marshmallow handles singular objects correctly, even if they are iterable.
* If Nested field ``only`` parameter is a field name, only return a single value for the nested object (instead of a dict) or a flat list of values.
* Improved performance and stability.
0.4.1 (2013-12-01)
******************
* An object's ``__marshallable__`` method, if defined, takes precedence over ``__getitem__``.
* Generator expressions can be passed to a serializer.
* Better support for serializing list-like collections (e.g. ORM querysets).
* Other minor bugfixes.
0.4.0 (2013-11-24)
******************
* Add ``additional`` `class Meta` option.
* Add ``dateformat`` `class Meta` option.
* Support for serializing UUID, date, time, and timedelta objects.
* Remove ``Serializer.to_data`` method. Just use ``Serialize.data`` property.
* String field defaults to empty string instead of ``None``.
* *Backwards-incompatible*: ``isoformat`` and ``rfcformat`` functions moved to utils.py.
* *Backwards-incompatible*: Validation functions moved to validate.py.
* *Backwards-incompatible*: Remove types.py.
* Reorder parameters to ``DateTime`` field (first parameter is dateformat).
* Ensure that ``to_json`` returns bytestrings.
* Fix bug with including an object property in ``fields`` Meta option.
* Fix bug with passing ``None`` to a serializer.
0.3.1 (2013-11-16)
******************
* Fix bug with serializing dictionaries.
* Fix error raised when serializing empty list.
* Add ``only`` and ``exclude`` parameters to Serializer constructor.
* Add ``strict`` parameter and option: causes Serializer to raise an error if invalid data are passed in, rather than storing errors.
* Updated Flask + SQLA example in docs.
0.3.0 (2013-11-14)
******************
* Declaring Serializers just got easier. The ``class Meta`` paradigm allows you to specify fields more concisely. Can specify ``fields`` and ``exclude`` options.
* Allow date formats to be changed by passing ``format`` parameter to ``DateTime`` field constructor. Can either be ``"rfc"`` (default), ``"iso"``, or a date format string.
* More useful error message when declaring fields as classes (instead of an instance, which is the correct usage).
* Rename ``MarshallingException`` -> ``MarshallingError``.
* Rename ``marshmallow.core`` -> ``marshmallow.serializer``.
0.2.1 (2013-11-12)
******************
* Allow prefixing field names.
* Fix storing errors on Nested Serializers.
* Python 2.6 support.
0.2.0 (2013-11-11)
******************
* Field-level validation.
* Add ``fields.Method``.
* Add ``fields.Function``.
* Allow binding of extra data to a serialized object by passing the ``extra`` param when initializing a ``Serializer``.
* Add ``relative`` parameter to ``fields.Url`` that allows for relative URLs.
0.1.0 (2013-11-10)
******************
* First release.
|