Biosustain Potion Versions Save

Flask-Potion is a RESTful API framework for Flask and SQLAlchemy, Peewee or MongoEngine

v0.16.0

5 years ago

Breaking Changes

  • The timezone is now always included with fields.DateTimeString and defaults to UTC with native datetime objects. (Thanks @albertodonato)

Features

  • The sort_attribute meta class attribute of a resource can be used to change the default pagination sort order, which otherwise is id_attribute ascending. Descending order is supported. (Thanks @albertodonato and @luord)
class SpamResource(Resource):
    class Meta:
        model = Spam
        sort_attribute = 'name', True

Bugfixes

  • Fix field.Object(pattern_properties={}) pattern definition
  • Fix JSONSchema of patchable fields. (Thanks @bjornt)

v0.15.1

5 years ago

Features

  • Allow setting custom error message for PotionException
  • Allow setting success_code argument with route decorator for a custom HTTP status code

Bugfixes

  • Fix schema reference for cross resource fields.Inline

v0.14.0

7 years ago

Features

  • Improve debug error messages on IntegrityError in SQLAlchemy

Bugfixes

  • Fix IntegrityError in SQLAlchemy on update, delete not being handled properly

  • Use ID column for stable sort defaults in SQLAlchemy

    This resolves issues with pagination when sorting by a non-unique column.

v0.13.0

7 years ago

Breaking changes

  • Fixes Api.decorators not being applied to "/schema"

    This means if you have an authenticated API your "/schema" endpoint is no longer available to unauthenticated users.

Features

  • Adds POTION_DECORATE_SCHEMA_ENDPOINTS configuration option

    Setting this option to False makes the "/schema" endpoint and "/{resource_name}/schema" endpoints available in an Api protected using Api.decorators.

  • Adds support for user:$id and user:$uri needs with Flask-Principal

Bugfixes

  • Fixes TypeError when applying PATCH to some SQLAlchemy native values
  • Fixes various inconsistencies in the JSON schemas

v0.12.6

7 years ago

Bugfixes

  • Adds dependencies for proper validation of fields.DateTimeString and fields.Uri

v0.12.4

8 years ago

Bugfixes

  • Fixes an issue that prevented natural keys from being used with filters

v0.12.3

8 years ago

Features

  • Filters are now inherited (e.g. Email and Uri work like String because they inherits from it)
  • Added filters for DateString, DateTimeString (Thanks, @boydgreenfield)
  • Implemented ItemUri.convert(). This means you can now specify filters for the "$uri" field. For more info, see below. (Thanks, @boydgreenfield)

Bugfixes

  • Fixes specifying custom filters using Meta.filters

Enabling filtering by "$uri" in a resource:

        class Meta:
            filters = {
                '$uri': {
                    None: filters.EqualFilter,
                    'eq': filters.EqualFilter,
                    'ne': filters.NotEqualFilter,
                    'in': filters.InFilter
                },
                '*': True
            }

Note that filters needs to correspond to the manager implementation you are using, e.g. flask_potion.contrib.alchemy.filters. If you want to enable the filter in multiple resources, you can use a Meta mixin.

v0.12.2

8 years ago

Features

  • Adds fields.UUID field for UUID strings in canonical form
  • Support for PostgreSQL-dialect UUID columns in the SQLAlchemyManager

(Thanks, @shipperizer for both features)

Bugfixes

  • id_converter is now always inferred from id_field_class unless it is specified manually.

v0.12.1

8 years ago

Bugfixes

  • Fixes pagination headers in peewee manager

v0.12.0

8 years ago

Features

  • Refactored logic for inferring the id attribute and its field class type

  • Support for decimal.Decimal used for Numeric fields by PostgreSQL drivers (Thanks, @brunsgaard)

  • Updated the configuration of fields when used with a FieldSet:

    The io attribute on fields can now have 'c' (create) and 'u' (update) in addition to 'r' and 'w'. This allows for e.g fields that can only be written once on create 'cr' or are generated by the server but can then be updated 'ru'.