Releases: biosustain/potion
v0.16.0
Breaking Changes
- The timezone is now always included with
fields.DateTimeStringand defaults to UTC with native datetime objects. (Thanks @albertodonato)
Features
- The
sort_attributemeta class attribute of a resource can be used to change the default pagination sort order, which otherwise isid_attributeascending. 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
Features
- Allow setting custom error message for
PotionException - Allow setting
success_codeargument with route decorator for a custom HTTP status code
Bugfixes
- Fix schema reference for cross resource
fields.Inline
v0.14.0
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
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
Falsemakes 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
Bugfixes
- Adds dependencies for proper validation of
fields.DateTimeStringandfields.Uri
v0.12.4
Bugfixes
- Fixes an issue that prevented natural keys from being used with filters
v0.12.3
Features
- Filters are now inherited (e.g.
EmailandUriwork likeStringbecause 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
Features
- Adds
fields.UUIDfield for UUID strings in canonical form - Support for PostgreSQL-dialect UUID columns in the SQLAlchemyManager
(Thanks, @shipperizer for both features)
Bugfixes
id_converteris now always inferred fromid_field_classunless it is specified manually.
v0.12.1
Bugfixes
- Fixes pagination headers in peewee manager
v0.12.0
Features
-
Refactored logic for inferring the id attribute and its field class type
-
Support for
decimal.Decimalused for Numeric fields by PostgreSQL drivers (Thanks, @brunsgaard) -
Updated the configuration of fields when used with a
FieldSet:The
ioattribute 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'.