Changelog
=========

Here you can see the full list of changes between each Flask-Restless release.
Version 1.0.0 saw a major overhaul of Flask-Restless to make it compliant with
JSON API, so changes from prior versions may not be relevant to more recent
versions.

Numbers following a pound sign (#) refer to `GitHub issues`_.

.. _GitHub issues: https://github.com/jfinkels/flask-restless/issues

Version 1.0.0b2-dev
-------------------

*This is a beta release; these changes will appear in the 1.0.0 release.*

Not yet released.

- Changes serialization/deserialization to class-based implementation instead
  of a function-based implementation. This also adds support for serialization
  of heterogeneous collections.
- :issue:`7`: allows filtering before function evaluation.
- :issue:`49`: deserializers now expect a complete JSON API document.
- :issue:`200`: be smarter about determining the ``collection_name`` for
  polymorphic models defined with single-table inheritance.
- :issue:`253`: don't assign to callable attributes of models.
- :issue:`481,488`: added negation (``not``) operator for search.
- :issue:`492`: support JSON API recommended "simple" filtering.
- :issue:`508`: flush the session before postprocessors, and commit after.
- :issue:`536`: adds support for single-table inheritance.
- :issue:`546`: adds support for joined table inheritance.

Version 1.0.0b1
---------------

*This is a beta release; these changes will appear in the 1.0.0 release.*

Released on April 2, 2016.

- :issue:`255`: adds support for filtering by PostgreSQL network operators.
- :issue:`257`: ensures additional attributes specified by the user actually exist on
  the model.
- :issue:`363` (partial solution): don't use ``COUNT`` on requests that don't require
  pagination.
- :issue:`404`: **Major overhaul of Flask-Restless to support JSON API**.
- Increases minimum version requirement for ``python-dateutil`` to be strictly
  greater than 2.2 to avoid parsing bug.
- :issue:`331,415`: documents the importance of URL encoding when using the ``like``
  operator to filter results.
- :issue:`376`: add a ``not_like`` operator for filter objects.
- :issue:`431`: adds a ``url_prefix`` keyword argument to the :class:`APIManager`
  constructor, so one can specify a URL prefix once for all created APIs.
- :issue:`449`: roll back the session on any SQLAlchemy error, not just a few.
- :issue:`432,462`: alias relation names when sorting by multiple attributes on a
  relationship.
- :issue:`436,453`: use ``__table__.name`` instead of ``__tablename__`` to infer the
  collection name for the SQLAlchemy model.
- :issue:`440,475`: uses the serialization function provided at the time of invoking
  :meth:`APIManager.create_api` to serialize each resource correctly, depending
  on its type.
- :issue:`474`: include license files in built wheel for distribution.
- :issue:`501`: allows empty string for `url_prefix` keyword argument to
  :meth:`APIManager.create_api`.
- :issue:`476`: use the primary key provided at the time of invoking
  :meth:`APIManager.create_api` to build resource urls in responses.

Older versions
--------------

.. note::

   As of version 0.13.0, Flask-Restless supports Python 2.6, 2.7, and 3. Before
   that, it supported Python 2.5, 2.6, and 2.7.

.. note::

   As of version 0.6, Flask-Restless supports both pure SQLAlchemy and
   Flask-SQLAlchemy models. Before that, it supported only Elixir models.

Version 0.17.0
~~~~~~~~~~~~~~

Released on February 17, 2015.

- Corrects bug to allow delayed initialization of multiple Flask applications.
- :issue:`167`: allows custom serialization/deserialization functions.
- :issue:`198`: allows arbitrary Boolean expressions in search query filters.
- :issue:`226`: allows creating APIs before initializing the Flask application object.
- :issue:`274`: adds the :func:`url_for` function for computing URLs from models.
- :issue:`379`: improves datetime parsing in search requests.
- :issue:`398`: fixes bug where DELETE_SINGLE processors were not actually used.
- :issue:`400`: disallows excluding a primary key on a :http:method:`POST` request.

Version 0.16.0
~~~~~~~~~~~~~~

Released on February 3, 2015.

- :issue:`237`: allows bulk delete of model instances via the ``allow_delete_many``
  keyword argument.
- :issue:`313,389`: :meth:`APIManager.init_app` now can be correctly used to
  initialize multiple Flask applications.
- :issue:`327,391`: allows ordering searches by fields on related instances.
- :issue:`353`: allows search queries to specify ``group_by`` directives.
- :issue:`365`: allows preprocessors to specify return values on :http:method:`get`
  requests.
- :issue:`385`: makes the `include_methods` keywords argument respect model properties.

Version 0.15.1
~~~~~~~~~~~~~~

Released on January 2, 2015.

- :issue:`367`: catch :exc:`IntegrityError`, :exc:`DataError`, and
  :exc:`ProgrammingError` exceptions in all view methods.
- :issue:`374`: import :class:`sqlalchemy.Column` from :mod:`sqlalchemy` directly,
  instead of :mod:`sqlalchemy.sql.schema`

Version 0.15.0
~~~~~~~~~~~~~~

Released on October 30, 2014.

- :issue:`320`: detect settable hybrid properties instead of raising an exception.
- :issue:`350`: allows exclude/include columns to be specified as SQLAlchemy column
  objects in addition to strings.
- :issue:`356`: rollback the SQLAlchemy session on a failed :http:method:`patch`
  request.
- :issue:`368`: adds missing documentation on using custom queries (see
  :ref:`customqueries`)

Version 0.14.2
~~~~~~~~~~~~~~

Released on September 2, 2014.

- :issue:`351,355`: fixes bug in getting related models from a model with hybrid
  properties.

Version 0.14.1
~~~~~~~~~~~~~~

Released on August 26, 2014.

- :issue:`210`: lists some related projects in the documentation.
- :issue:`347`: adds automated build testing for PyPy 3.
- :issue:`354`: renames ``is_deleted`` to ``was_deleted`` when providing keyword
  arguments to postprocessor for :http:method:`delete` method in order to match
  documentation.

Version 0.14.0
~~~~~~~~~~~~~~

Released on August 12, 2014.

- Fixes bug where primary key specified by user was not being checked in some
  :http:method:`post` requests and some search queries.
- :issue:`223`: documents CORS example.
- :issue:`280`: don't expose raw SQL in responses on database errors.
- :issue:`299`: show error message if search query tests for ``NULL`` using comparison
  operators.
- :issue:`315`: check for query object being ``None``.
- :issue:`324`: :http:method:`delete` should only return :http:statuscode:`204` if
  something is actuall deleted.
- :issue:`325`: support ``null`` inside ``has`` search operators.
- :issue:`328`: enable automatic testing for Python 3.4.
- :issue:`333`: enforce limit in :func:`helpers.count`.
- :issue:`338`: catch validation exceptions when attempting to update relations.
- :issue:`339`: use user-specified primary key on :http:method:`patch` requests.
- :issue:`344`: correctly encodes Unicode fields in responses.

Version 0.13.1
~~~~~~~~~~~~~~

Released on April 21, 2014.

- :issue:`304`: fixes mimerender bug due to how Python 3.4 handles decorators.

Version 0.13.0
~~~~~~~~~~~~~~

Released on April 6, 2014.

- Allows universal preprocessors or postprocessors; see :ref:`universal`.
- Allows specifying which primary key to use when creating endpoint URLs.
- Requires SQLAlchemy version 0.8 or greater.
- :issue:`17`: use Flask's :attr:`flask.Request.json` to parse incoming JSON requests.
- :issue:`29`: replace custom ``jsonify_status_code`` function with built-in support
  for ``return jsonify(), status_code`` style return statements (new in Flask
  0.9).
- :issue:`51`: Use `mimerender <http://mimerender.readthedocs.org>`_ to render
  dictionaries to JSON format.
- :issue:`247`: adds support for making :http:method:`post` requests to dictionary-like
  association proxies.
- :issue:`249`: returns :http:statuscode:`404` if a search reveals no matching results.
- :issue:`254`: returns :http:statuscode:`404` if no related field exists for a request
  with a related field in the URL.
- :issue:`256`: makes search parameters available to postprocessors for
  :http:method:`get` and :http:method:`patch` requests that access multiple
  resources.
- :issue:`263`: Adds Python 3.3 support; drops Python 2.5 support.
- :issue:`267`: Adds compatibility for legacy Microsoft Internet Explorer versions 8
  and 9.
- :issue:`270`: allows the ``query`` attribute on models to be a callable.
- :issue:`282`: order responses by primary key if no order is specified.
- :issue:`284`: catch ``DataError`` and ``ProgrammingError`` exceptions when bad data
  are sent to the server.
- :issue:`286`: speed up paginated responses by using optimized count() function.
- :issue:`293`: allows :class:`sqlalchemy.Time` fields in JSON responses.

Version 0.12.1
~~~~~~~~~~~~~~

Released on December 1, 2013.

- :issue:`222`: on :http:method:`post` and :http:method:`patch` requests, recurse into
  nested relations to get or create instances of related models.
- :issue:`246`: adds `pysqlite <https://pypi.python.org/pypi/pysqlite>`_ to test
  requirements.
- :issue:`260`: return a single object when making a :http:method:`get` request to a
  relation sub-URL.
- :issue:`264`: all methods now execute postprocessors after setting headers.
- :issue:`265`: convert strings to dates in related models when making
  :http:method:`post` requests.

Version 0.12.0
~~~~~~~~~~~~~~

Released on August 8, 2013.

- :issue:`188`: provides metadata as well as normal data in JSONP responses.
- :issue:`193`: allows :http:method:`delete` requests to related instances.
- :issue:`215`: removes Python 2.5 tests from Travis configuration.
- :issue:`216`: don't resolve Query objects until pagination function.
- :issue:`217`: adds missing indices in format string.
- :issue:`220`: fix bug when checking attributes on a hybrid property.
- :issue:`227`: allows client to request that the server use the current date
  and/or time when setting the value of a field.
- :issue:`228` (as well as :issue:`212,218,231`): fixes issue due to a module
  removed from Flask version 0.10.

Version 0.11.0
~~~~~~~~~~~~~~

Released on May 18, 2013.

- Requests that require a body but don't have ``Content-Type:
  application/json`` will cause a :http:statuscode:`415` response.
- Responses now have ``Content-Type: application/json``.
- :issue:`180`: allow more expressive ``has`` and ``any`` searches.
- :issue:`195`: convert UUID objects to strings when converting an instance of a model
  to a dictionary.
- :issue:`202`: allow setting hybrid properties with expressions and setters.
- :issue:`203`: adds the ``include_methods`` keyword argument to
  :meth:`APIManager.create_api`, which allows JSON responses to include the
  result of calling arbitrary methods of instances of models.
- :issue:`204`, 205: allow parameters in ``Content-Type`` header.

Version 0.10.1
~~~~~~~~~~~~~~

Released on May 8, 2013.

- :issue:`115`: change ``assertEqual()`` methods to ``assert`` statements in tests.
- :issue:`184,186`: Switch to `nose <http://nose.readthedocs.org>`_ for testing.
- :issue:`197`: documents technique for adding filters in processors when there are
  none initially.

Version 0.10.0
~~~~~~~~~~~~~~

Released on April 30, 2013.

- :issue:`2`: adds basic :http:method:`get` access to one level of relationship depth
  for models.
- :issue:`113`: interpret empty strings for date fields as ``None`` objects.
- :issue:`115`: use Python's built-in assert statements for testing
- :issue:`128`: allow disjunctions when filtering search queries.
- :issue:`130`: documentation and examples now more clearly show search examples.
- :issue:`135`: added support for hybrid properties.
- :issue:`139`: remove custom code for authentication in favor of user-defined pre- and
  postprocessors (this supercedes the fix from :issue:`154`).
- :issue:`141`: relax requirement for version of `python-dateutil
  <http://labix.org/python-dateutil>`_ to be not equal to 2.0 if using Python
  version 2.6 or 2.7.
- :issue:`146`: preprocessors now really execute before other code.
- :issue:`148`: adds support for SQLAlchemy `association proxies <http://docs.sqlalchemy.org/en/latest/orm/extensions/associationproxy.html>`_.
- :issue:`154` (*this fix is irrelevant due to :issue:`139`*): authentication function now may
  raise an exception instead of just returning a Boolean.
- :issue:`157`: :http:method:`post` requests now receive a response containing all
  fields of the created instance.
- :issue:`162`: allow pre- and postprocessors to indicate that no change has occurred.
- :issue:`164,172,173`: :http:method:`patch` requests update fields on related
  instances.
- :issue:`165`: fixed bug in automatic exposing of URLs for related instances.
- :issue:`170`: respond with correct HTTP status codes when a query for a single
  instance results in none or multiple instances.
- :issue:`174`: allow dynamically loaded relationships for automatically exposed URLs
  of related instances.
- :issue:`176`: get model attribute instead of column name when getting name of primary
  key.
- :issue:`182`: allow :http:method:`post` requests that set hybrid properties.
- :issue:`152`: adds some basic server-side logging for exceptions raised by views.

Version 0.9.3
~~~~~~~~~~~~~

Released on February 4, 2013.

- Fixes incompatibility with Python 2.5 try/except syntax.
- :issue:`116`: handle requests which raise :exc:`~sqlalchemy.exc.IntegrityError`.

Version 0.9.2
~~~~~~~~~~~~~

Released on February 4, 2013.

- :issue:`82,134,136`: added request pre- and postprocessors.
- :issue:`120`: adds support for JSON-P callbacks in :http:method:`get` requests.

Version 0.9.1
~~~~~~~~~~~~~

Released on January 17, 2013.

- :issue:`126`: fix documentation build failure due to bug in a dependency.
- :issue:`127`: added "ilike" query operator.

Version 0.9.0
~~~~~~~~~~~~~

Released on January 16, 2013.

- Removed ability to provide a :class:`~sqlalchemy.orm.session.Session` class
  when initializing :class:`APIManager`; provide an instance of the class
  instead.
- Changes some dynamically loaded relationships used for testing and in
  examples to be many-to-one instead of the incorrect one-to-many. Versions of
  SQLAlchemy after 0.8.0b2 raise an exception when the latter is used.
- :issue:`105`: added ability to set a list of related model instances on a model.
- :issue:`107`: server responds with an error code when a :http:method:`patch` or
  :http:method:`post` request specifies a field which does not exist on the
  model.
- :issue:`108`: dynamically loaded relationships should now be rendered correctly by
  the :func:`views._to_dict` function regardless of whether they are a list or
  a single object.
- :issue:`109`: use `sphinxcontrib-issuetracker`_ to render links to GitHub issues in
  documentation.
- :issue:`110`: enable ``results_per_page`` query parameter for clients, and added
  ``max_results_per_page`` keyword argument to :meth:`APIManager.create_api`.
- :issue:`114`: fix bug where string representations of integers were converted to
  integers.
- :issue:`117`: allow adding related instances on :http:method:`patch` requests for
  one-to-one relationships.
- :issue:`123`: :http:method:`patch` requests to instances which do not exist result in
  a :http:statuscode:`404` response.

.. _sphinxcontrib-issuetracker: https://sphinxcontrib-issuetracker.readthedocs.org/en/latest

Version 0.8.0
~~~~~~~~~~~~~

Released on November 19, 2012.

- :issue:`94`: :func:`views._to_dict` should return a single object instead of a list
  when resolving dynamically loaded many-to-one relationships.
- :issue:`104`: added ``num_results`` key to paginated JSON responses.

Version 0.7.0
~~~~~~~~~~~~~

Released on October 9, 2012.

- Added working ``include`` and ``exclude`` functionality to the
  :func:`views._to_dict` function.
- Added ``exclude_columns`` keyword argument to :meth:`APIManager.create_api`.
- :issue:`79`: attempted to access attribute of ``None`` in constructor of
  :class:`APIManager`.
- :issue:`83`: allow :http:method:`post` requests with one-to-one related instances.
- :issue:`86`: allow specifying include and exclude for related models.
- :issue:`91`: correctly handle :http:method:`post` requests to nullable
  :class:`~sqlalchemy.DateTime` columns.
- :issue:`93`: Added a ``total_pages`` mapping to the JSON response.
- :issue:`98`: :http:method:`get` requests to the function evaluation endpoint should
  not have a data payload.
- :issue:`101`: ``exclude`` in :func:`views._to_dict` function now correctly excludes
  requested fields from the returned dictionary.

Version 0.6
~~~~~~~~~~~

Released on June 20, 2012.

- Added support for accessing model instances via arbitrary primary keys,
  instead of requiring an integer column named ``id``.
- Added example which uses curl as a client.
- Added support for pagination of responses.
- Fixed issue due to symbolic link from :file:`README` to :file:`README.md`
  when running ``pip bundle foobar Flask-Restless``.
- Separated API blueprint creation from registration, using
  :meth:`APIManager.create_api` and :meth:`APIManager.create_api_blueprint`.
- Added support for pure SQLAlchemy in addition to Flask-SQLAlchemy.
- :issue:`74`: Added ``post_form_preprocessor`` keyword argument to
  :meth:`APIManager.create_api`.
- :issue:`77`: validation errors are now correctly handled on :http:method:`PATCH`
  requests.

Version 0.5
~~~~~~~~~~~

Released on April 10, 2012.

- Dual-licensed under GNU AGPLv3+ and 3-clause BSD license.
- Added capturing of exceptions raised during field validation.
- Added :file:`examples/separate_endpoints.py`, showing how to create separate
  API endpoints for a single model.
- Added ``include_columns`` keyword argument to
  :meth:`~flask_restless.APIManager.create_api` method to allow users to
  specify which columns of the model are exposed in the API.
- Replaced Elixir with Flask-SQLAlchemy. Flask-Restless now only supports
  Flask-SQLAlchemy.

Version 0.4
~~~~~~~~~~~

Released on March 29, 2012.

- Added Python 2.5 and Python 2.6 support.
- Allow users to specify which HTTP methods for a particular API will require
  authentication and how that authentication will take place.
- Created base classes for test cases.
- Moved the ``evaluate_functions`` function out of the
  :mod:`flask_restless.search` module and corrected documentation about how
  function evaluation works.
- Added `allow_functions` keyword argument to
  :meth:`~flask_restless.APIManager.create_api`.
- Fixed bug where we weren't allowing PUT requests in
  :meth:`~flask_restless.manager.APIManager.create_api`.
- Added ``collection_name`` keyword argument to
  :meth:`~flask_restless.APIManager.create_api` to allow user provided names in
  URLs.
- Added ``allow_patch_many`` keyword argument to
  :meth:`~flask_restless.APIManager.create_api` to allow enabling or disabling
  the PATCH many functionality.
- Disable the PATCH many functionality by default.

Version 0.3
~~~~~~~~~~~

Released on March 4, 2012.

- Initial release in Flask extension format.
