Eve Changelog¶
Here you can see the full list of changes between each Eve release.
Version 0.5¶
Released on 12 Jan, 2015.
- New: Operations Log (http://python-eve.org/features#operations-log.)
- New: GeoJSON (http://python-eve.org/features.html#geojson) (Juan Madurga.)
- New: Internal Resources (http://python-eve.org/features#internal-resources) (Magdas Adrian.)
- New: Support for multiple origins when using CORS (Josh Villbrandt, #532.)
- New: Regexes are stripped out of HATEOAS urls when present. You now get
games/<game_id>/imageswhere previously you would getgames/<regex('[a-f0-9]{24}'):game_id>/images). Closes #466. - New:
JSON_SORT_KEYSenables JSON key sorting (Matt Creenan). - New: Add the current query string to the self link for responses with multiple documents. Closes #464 (Jen Montes).
- New: When document versioning is on, add
?version=<version_num>to HATEOAS self links. Also adds pagination links for?version=alland?version=diffsrequests when the number exceeds the max results. Partially addresses #475 (Jen Montes). - New:
QUERY_WHEREallows to set the query parameter key for filters. Defaults towhere. - New:
QUERY_SORTallows to set the query parameter key for sorting. Defaults tosort. - New:
QUERY_PAGEallows to set the query parameter key for pagination. Defaults topage. - New:
QUERY_PROJECTIONallows to set the query parameter key for projections. Defaults toprojection. - New:
QUERY_MAX_RESULTSallows to set the query parameter key for max results. Defaults tomax_results. - New:
QUERY_EMBEDDEDallows to set the query parameter key embedded documents. Defaults toembedded. - New: Fire
on_fetchedevents forversion=allrequests (Jen Montes). - New: Support for CORS
Access-Control-Expose-Headers(Christian Henke). - New:
post_internal()can be used for intenral post calls. This method is not rate limited, authentication is not checked and pre-request events are not raised (Magdas Adrian). - New:
put_internal()can be used for intenral PUT calls. This method is not rate limited, authentication is not checked and pre-request events are not raised (Kevin Funk). - New:
patch_internal()can be used for intenral PATCH calls. This method is not rate limited, authentication is not checked and pre-request events are not raised (Kevin Funk). - New:
delete_internal()can be used for intenral DELETE calls. This method is not rate limited, authentication is not checked and pre-request events are not raised (Kevin Funk). - New: Add an option to
_internalmethods to skip payload validation (Olivier Poitrey). - New: Comma delimited sort syntax in queries. The MongoDB data layer now also
supports queries like
?sort=lastname,-age. Addresses #443. - New: Add extra 4xx response codes for proper handling. Only
405Method not allowed,406Not acceptable,409Conflict, and410Gone have been added to the list (Kurt Doherty). - New: Add serializers for integer and float types (Grisha K.)
- New: dev-requirements.txt added to the repo.
- New: Embedding of documents by references located in any subdocuments. For
example, query
embedded={"user.friends":1}will return a document with “user” and all his “friends” embedded, but only ifuseris a subdocument andfriendsis a list of references (Dmitry Anoshin). - New: Allow mongoengine to work properly with cursor counts (Johan Bloemberg)
- New:
ALLOW_UNKNOWNallows unknown fields to be read, not only written as before. Closes #397 and #250. - New:
VALIDATION_ERROR_STATUSallows setting of the HTTP status code to use for validation errors. Defaults to422(Olivier Poitrey). - New: Support for sub-document projections. Fixes #182 (Olivier Poitrey).
- New: Return
409 Conflicton pymongoDuplicateKeyErrorforPOSTrequests, as already happens withPUTrequests (Matt Creenan, #537.) - Change:
DELETEreturns204 NoContenton a successful delete. - Change: SERVER_NAME removed as it is not needed anymore.
- Change: URL_PROTOCOL removed as it is not needed anymore.
- Change: HATEOAS links are now relative to the API root. Closes #398 #401.
- Change: If-Modified-Since has been disabled on resource (collections)
endpoints. Same functionality is available with a
?where={"_udpated": {"$gt": "<RFC1123 date>"}}request. The OpLog also allows retrieving detailed changes happened at any endpoint, deleted documents included. Closes #334. - Change: etags are now persisted with the documents. This ensures that etags are consistent across queries, even when projection queries are issued. Please note that etags will only be stored along with new documents created and/or edited via API methods (POST/PUT/PATCH). Documents inserted by other means and those stored with v0.4 and below will keep working as previously: their etags will be computed on-the-fly and you will get still be getting inconsistent etags when projection queries are issued. Closes #369.
- Change: XML item, meta and link nodes are now ordered. Closes #441.
- Change:
putmethod signature forMediaStoragebase class has been updated.filemameis now optional. Closes #414. - Change: CORS behavior to be compatible with browsers (Chrome). Eve is now echoing back the contents of the Origin header if said content is whitelisted in X_DOMAINS. This also safer as it avoids exposing internal server configuration. Closes #408. This commit was carefully handcrafed on a flight to EuroPython 2014.
- Change: Specify a range of dependant package versions. #379 (James Stewart).
- Change: Cerberus 0.8 is now required.
- Change: pymongo v2.7.2 is now required.
- Change: simplejson v3.6.5 is now required.
- Change: update
dev-requirements.txtto most recent tools available. - Fix: add
README.rsttoMANIFEST.in(Niall Donegan.) - Fix:
LICENSEvariable insetup.pyshould be “shortstring”. Closes #540 (Niall Donegan.) - Fix:
PATCHon fields with original value ofNone(Marcus Cobden, #534). - Fix: Fix impossible version ranges in setup.py (Marcus Cobden, #531.)
- Fix: Bug with expanding lists of roles, compromising authorization (Mikael Berg, #527)
- Fix:
PATCHon subdocument fields does not overwrite the whole subdocument anymore. Closes #519. - Fix: Added support for validation on field attribute with type list (Jorge Morales).
- Fix: Fix a serialization bug with integer and float when value is 0 (Olivier Poitrey).
- Fix: Custom ID fields tutorial: if custom ID fields are being used, then MongoDB/Eve won’t be able to create them automatically as it does with the ObjectId default type. Closes #511.
- Fix: Dependencies with default values were reported as missing if omitted. Closes #353.
- Fix: Dependencies always fails on PATCH if dependent field isn’t part of the update. #363.
- Fix: client projections work when
allow_unknownis active. Closes #497. - Fix: datasource projections are active when
allow_unknownis active. closes #497. - Fix: Properly serialize nullable floats and integers. Closes #469.
- Fix:
_mongotize()turns non-ObjectId strings (but not unicode) into ObjectIds. Closes #508 (Or Neeman). - Fix: Fix validation of read-only fields inside dicts. Closes #474 (Arnau Orriols).
- Fix: Parent and collection links follow the scheme described in #475 (Jen Montes).
- Fix: Ignore read-only fields in
PATCHrequests when their values aren’t changed compared to the stored document. Closes #479. - Fix: Allow
EVE_SETTINGSenvvar to be used exclusively. Previously, a settings file in the working directory was always required. Closes #461. - Fix: exception when trying to set nullable media field to null (Daniel Lytkin)
- Fix: Add missing
$optionsand$listMongoDB operators to the allowed list (Jaroslav Semančík). - Fix: Get document when it is missing embedded media. In case you try to embedd a document which has media fields and that document has been deleted, you would get an error (Petr Jašek).
- Fix: fix additional lookup regex in RESTful Account Management tutorial (Ashley Roach).
- Fix:
utils.weak_datealways returns a RFC-1123 date (Petr Jašek). - Fix: Can’t embed a ressource with a custom _id (non ObjectId). Closes #427.
- Fix: Do not follow DATE_FORMAT for HTTP headers. Closes #429 (Olivier Poitrey).
- Fix: Fix app initialization with resource level versioning #409 (Sebastián Magrí).
- Fix: KeyError when trying to use embedding on a field that is missing from document. It was fixed earlier in #319, but came back again after new embedding mechanism (Daniel Lytkin).
- Fix: Support for list of strings as default value for fields (hansotronic).
- Fix: Media fields are now properly returned even in embedded documents. Closes #305.
- Fix: auth in domain configuration can be either a callable or a class instance (Gino Zhang).
- Fix: Schema definition: a default value of [] for a list causes IndexError. Closes #417.
- Fix: Close file handles in setup.py (Harro van der Klauw)
- Fix: Querying a collection should always return pagination information (even when no data is being returned). Closes #415.
- Fix: Recursively validate the whole query string.
- Fix: If the data layer supports a list of allowed query operators, take them into consideration when validating a query string. Closes #388.
- Fix: Abort with 400 if unsupported query operators are used. Closes #387.
- Fix: Return the error if a blacklisted MongoDB operator is used in a query (debug mode).
- Fix: Invalid sort syntax raises 500 instead of 400. Addresses #378.
- Fix: Fix serialization when type is missing in schema. #404 (Jaroslav Semančík).
- Fix: When PUTting or PATCHing media fields, they would not be properly replaced as needed (Stanislav Heller).
- Fix:
test_get_sort_disabledoccasional failure. - Fix: A POST with an empty array leads to a server crash. Now returns a 400 error isntead and ensure the server won’t crash in case of mongo invalid operations (Olivier Poitrey).
- Fix: PATCH and PUT don’t respect flask.abort() in a pre-update event. Closes #395 (Christopher Larsen).
- Fix: Validating keyschema rules would cause a TypeError since 0.4. Closes nicolaiarocci/cerberus#48.
- Fix: Crash if client projection is not a dict #390 (Olivier Poitrey).
- Fix: Server crash in case of invalid “where” syntax #386 (Olivier Poitrey).
Version 0.4¶
Released on 20 June, 2014.
- [new] You can now start the app without any resource defined and use
app.register_resourcelater as needed (Petr Jašek). - [new] Data layer is now usable outside request context, for example within a Celery task where there’s no request context (Petr Jašek).
- [new][change] Add pagination info to get results whatever the HATEOAS status. Closes #355 (Olivier Poitrey).
- [new] Ensure all errors return a parseable body (JSON or XML). Closes #365 (Olivier Poitrey).
- [new] Apply sub-request route’s params to the created document if matching
the schema, e.g. a POST on
/people/1234…/invoiceswill set thecontact_idfield to 1234… so created invoice is automatically associated with the parent resource (Olivier Poitrey). - [new] Allow some more HTTP errors (403 and 404) to be thrown from db hooks (Olivier Poitrey).
- [new]
ALLOWED_READ_ROLES. A list of allowed roles for resource endpoints with GET and OPTIONS methods (Olivier Poitrey). - [new]
ALLOWED_WRITE_ROLES. A list of allowed roles for resource endpoints with POST, PUT and DELETE methods (Olivier Poitrey). - [new]
ALLOWED_ITEM_READ_ROLES. A list of allowed roles for item endpoints with GET and OPTIONS methods (Olivier Poitrey). - [new]
ALLOWED_ITEM_WRITE_ROLES. A list of allowed roles for item endpoints with PUT, PATCH and DELETE methods (Olivier Poitrey). - [new] ‘dependencies’ validation rule.
- [new] ‘keyschema’ validation rule.
- [new] ‘regex’ validation rule.
- [new] ‘set’ as a core data type.
- [new] ‘min’ and ‘max’ now apply to floats and numbers too.
- [new] File Storage.
EXTENDED_MEDIA_INFOallows a list of meta fields (file properties) to forward from the file upload driver (Ben Demaree). - [new] Python 3.4 is now supported.
- [new] Support for default values in documents with more than one level of data (Javier Gonel).
- [new] Ability to send entire document in write responses.
BANDWITH_SAVERaka Coherence Mode (Josh Villbrandt). - [new]
on_pre_<METHOD>events expose the lookup dictionary which allows for setting up dynamic database lookups on both resource and item endpoints. - [new] Return a 400 response on pymongo DuplicateKeyError, with exception message if debug mode is on (boosh).
- [new] PyPy officially supported and tested (Javier Gonel).
- [new] tox support (Javier Gonel).
- [new] Post database events (Javier Gonel). Addresses #272.
- [new] Versioned Documents (Josh Villbrandt). Closes #224.
- [new] Python trove classifiers added to setup.py.
- [new] Client projections are also honored at item endpoints.
- [new] validate that ID_FIELD is not set as a resource
auth_field. Addresses #266. - [new]
URL_PROTOCOLdefines the HTTP protocol used when building HATEOAS links. Defaults to''for relative paths (Junior Vidotti). - [new]
on_delete_itemandon_deleted_itemis raised on DELETE requests sent to document endpoints. Addresses #232. - [new]
on_delete_resourceandon_deleted_resourceis raised on DELETE requests sent to resource endpoints. Addresses #232. - [new]
on_updateis raised on PATCH requests, when a document is about to be updated on the database. Addresses #232. - [new]
on_replaceis raised on PUT requests, when a document is about to be replaced on the database. Addresses #232. - [new]
authconstructor argument accepts either a class instance or a callable. Closes #248. - [change] Cerberus 0.7.2 is now required.
- [change] Jinja2 2.7.3 is now required.
- [change] Werkzeug 0.9.6 is now required.
- [change] simplejson 3.5.2 is now required.
- [change] itsdangerous 0.24 is now required. Addresses #378.
- [change] Events 0.2.1 is now required.
- [change] MarkupSafe 0.23 is now required.
- [change] For bulk and non-bulk inserts, response status now always either 201
when everything was ok or 400 when something went wrong. For bulk inserts, if
at least one document doesn’t validate, the whole request is rejected, and
none of the documents are inserted into the database. Additionnaly, this
commit adopts the same response format as collections: responses are always
a dict with a
_statusfield at its root and an eventual_errorobject if_statusisERRto comply with #366. Documents status are stored in the_itemsfield (Olivier Poitrey). - [change] Callbacks get whole json response on
on_fetched. This allows for callbacks functions to alter the whole payload, even when HATEOAS is enabled and_itemsand_linksmetafields are present. - [change]
on_insertis not raised anymore on PUT requests (replaced by above mentionedon_replace). - [change]
auth.request_auth_valueis no more. Yay. See below. - [change]
auth.set_request_auth_value()allows to set theauth_fieldvalue for the current request. - [change]
auth.get_request_auth_value()allows to retrieve theauth_fieldvalue for the current request. - [change]
on_update(ed)andon_replace(ed)callbacks now receive both the original document and the updates (Jaroslav Semančík). - [change] Review event names (Javier Gonel).
- [fix] return 500 instead of 404 if CORS is enabled. Closes #381.
- [fix] Crash on GET requests on resource endpoints when ID_FIELD is missing on one or more documents. Closes #351.
- [fix] Cannot change a nullable objectid type field to contain null. Closes #341.
- [fix] HATEOAS links as business unit values even when regexes are configured for the endpoint.
- [fix] Documentation improvements (Jen Montes).
- [fix] KeyError exception was raised when field specified in schema as embeddable was missing in a particular document (Jaroslav Semančík).
- [fix] Tests on HEAD requests would very occasionally fail. See #316.
- [change] PyMongo 2.7.1 is now required.
- [fix] Automatic fields such as
DATE_CREATDandDATE_CREATEDare correctly handled in client projections (Josh Villbrandt). Closes #282. - [fix] Make codebase compliant with latest PEP8/flake8 release (Javier Gonel).
- [fix] If you had a media field, and set datasource projection to 0 for that field, the media would not be deleted. Closes #284.
- [fix] tests cleanup (Javier Gonel).
- [fix] tests now run on any system without needing to set
ulimitto a higher value (Javier Gonel). - [fix] media files: don’t try to delete a field that does not exist (Taylor Brown).
- [fix] Occasional KeyError while building
_mediahelper dict. See #271 (Alexander Hendorf). - [fix]
If-Modified-Sincemisbehaviour when a datasource filter is set. Closes #258. - [fix] Trouble serializing list of dicts. Closes #265 and #244.
- [fix]
HATEOASitem links are now coherent actual endpoint URL even when natural immutable keys are used in URLs (Junior Vidotti). Closes #256. - [fix] Replaced
ID_FIELDbyitem_lookup_fieldon self link. item_lookup_field will default toID_FIELDif blank.
Version 0.3¶
Released on 14 February, 2014.
- [fix] Serialization of sub-documents (Hannes Tiede). Closes #244.
- [new]
X_MAX_AGEallows to configure CORS Access-Control-Max-Age (David Buchmann). - [fix]
GETwithIf-Modified-Sinceon list endpoint returns incorrect 304 if resource is empty. Closes #243. - [change]
POSTwill return201 Createdif at least one document was accepted for insertion;200 OKotherwise (meaning the request was accepted and processed). It is still client’s responsability to parse the response payload to check if any document did not pass validation. Addresses #201 #202 #215. - [new]
numberdata type. Allows both integers and floats as field values. - [fix] Using primary keys other than _id. Closes #237.
- [fix] Add tests for
PUTwhen User Restricted Resource Access is active. - [fix] Auth field not set if resource level authentication is set. Fixes #231.
- [fix] RateLimit check was occasionally failing and returning a 429 (John Deng).
- [change] Jinja2 2.7.2 is now required.
- [new] media files (images, pdf, etc.) can be uploaded as
mediadocument fields. When a document is requested, eventual media files will be returned as Base64 strings. Upload is done viaPOST,PUTandPATCHusing themultipart/data-formcontent-type. For optmized performance, by default files are stored in GridFS, however customMediaStorageclasses can be provided to support alternative storage systems. Clients and API maintainers can exploit the projections feature to include/exclude media fields from requests. For example, a request like/url/<id>?projection={"image": 0}will return the document without the image field. Also, while setting a resourcedatasourceit is possible to explicitly exclude media fields from standard responses (clients will need to explicitly add them to the payload with?projection={"image": 1}). - [new]
mediatype for schema fields. - [new]
mediaapplication argument. Allows to specify a media storage class to be used to store media files. Defaults toGridFSMediaStorage. - [new]
GridFSMediaStorageclass. Stores files into GridFS. - [new]
MediaStorageclass provides a standardized API for storing files, along with a set of default behaviors that all other storage systems can inherit or override as necessary. - [new]
filedata type support and validation for resource schema. - [new]
multipart/form-datacontent-type is now supported for requests. - [fix] Field exclusion (
?projection={"fieldname": 0}) now supported in client projections. Remember, mixing field inclusion and exclusion is still not supported by MongoDB. - [fix]
URL_PREFIXandAPI_VERSIONare correctly reported in HATOEAS links. - [fix]
DELETEon sub-resources should only delete documents referenced by the parent. Closes #212. - [fix]
DELETEon a resource endpoint honors User-Restricted Resource Access. Closes #213. - [new]
JSONallows to enable/disable JSON responses. Defaults toTrue(JSON enabled). - [new]
XMLallows to enable/disable XML responses. Defaults toTrue(XML enabled). - [fix] XML properly honors
_LINKSand_ITEMSsettings. - [fix] return all document fields when resource schema is empty.
- [new] pytest.ini for pytest support.
- [fix] All tests should now run with nose and pytest. Closes #209.
- [new]
query_objectid_as_stringresource setting. Defaults toFalse. Addresses #207. - [new]
ETAGallows to customize the etag field. Defaults to_etag. - [change]
etagis now_etagin all default response payloads (see above). - [change]
STATUSdefaults to ‘_status’. - [change]
ISSUESdefaults to ‘_issues’. - [change]
DATE_CREATEDdefaults to ‘_created’. Upgrade existing collections by runningdb.<collection>.update({}, { $rename: { "created": "_created" } }, { multi: true })in the mongo shell. If an index exists on the field, drop it and create a new one using the new field name. - [change]
LAST_UPDATEDdefaults to ‘_updated’. Upgrade existing collections by runningdb.<collection>.update({}, { $rename: { "updated": "_updated" } }, { multi: true })in the mongo shell. If an index exists on the field, drop it and create a new one usung the new field name. - [change] Exclude
etagfrom both response payload and headers if concurrency control is disabled (IF_MATCH=False). Closes #205. - [fix] Custom
ID_FIELDwould fail on update/insert methods. Fixes #203 (Jaroslav Semančík). - [change] GET: when If-Modified-Since header is present, either no documents
(304) or all documents (200) are sent per the HTTP spec. Original behavior
can be achieved with:
/resource?where={"updated":{"$gt":"if-modified-since-date"}}(Josh Villbrandt). - [change] Validation errors are now reported as a dictionary with offending fields as keys and issues descriptions as values.
- [change] Cerberus v0.6 is now required.
Version 0.2¶
Released on 30 November, 2013.
- [new] Sub-Resources. It is now possible to configure endpoints such as:
/companies/<company_id>/invoices. Also, the corresponding item endpoints, such as/companies/<company_id>/invoices/<invoice_id>, are available. All CRUD operations on these endpoints are allowed. Closes 156. - [new]
resource_titleallows to customize the endpoint title (HATEOAS). - [new][dev]
extracursor property, when present, will be added toGETresponses (with same key). This feature can be used by Eve extensions to inject proprietary data into the response stream (Petr Jašek). - [new]
IF_MATCHallows to disable checks for ETag matches on edit, replace and delete requests. If disabled, requests without an If-Match header will be honored without returning a 403 error. Defaults to True (enabled by default). - [new]
LINKSallows to customize the links field. Default to ‘_links’. - [new]
ITEMSallows to customize the items field. Default to ‘_items’. - [new]
STATUSallows to customize the status field. Default to ‘status’. - [new]
ISSUESallows to customize the issues field. Default to ‘issues’. - [new] Handling custom ID fields tutorial.
- [new] A new
json_encoderinitialization argument is available. It allows to pass custom JSONEncoder or eve.io.BaseJSONEncoder to the Eve instance. - [new] A new
url_convertersinitialization argument is available. It allows to pass custom Flask url converters to the Eve constructor. - [new] ID_FIELD fields can now be of arbitrary types, not only ObjectIds. Thanks to Kelvin Hammond for contributing to this one. Closes #136.
- [new]
pre_<method>andpre_<method>_<resource>event hooks are now available. They are raised when a request is received and before processing it. The resource involved and the Flask request object are returned to the callback function (dccrazyboy). - [new]
embedded_fieldsactivates default Embedded Resource Serialization on a list of selected document fields. Eventual embedding requests by clients will be processed along with default embedding. In order for default embedding to work, the field must be defined as embeddable, and embedding must be active for the resource (with help from Christoph Witzany). - [new]
default_sortoption added to thedatasourceresource setting. It allows to set default sorting for the endpoint. Default sorting will be overriden by a client request that happens to include a?sortargument within the query string (with help from Christoph Witzany). - [new] You can now choose to provide custom settings as a Python dictionary.
- [new] New method
Eve.register_resource()for registering new resource after initialization of Eve object. This is needed for simpler initialization API of all ORM/ODM extensions (Stanislav Heller). - [change] Rely on Flask endpoints to map urls to resources.
- [change] For better consistency with new
pre_<method>hooks,on_<method>event hooks have been renamed toon_post_<method>. - [change] Custom authentication classes can now be set at endpoint level. When set, an endpoint-level auth class will override the eventual global level auth class. Authentication docs have been updated (and greatly revised) accordingly. Closes #89.
- [change] JSON encoding is now handled at the DataLayer level allowing for specialized, granular, data-aware encoding. Also, since the JSON encoder is now a class attribute, extensions can replace the pre-defined data layer encoder with their own implementation. Closes #102.
- [fix] HMAC example and docs updated to align with new hmac in Python 2.7.3, which is only accepting bytes string. Closes #199.
- [fix] Properly escape leaf values in XML responses (Florian Rathgeber).
- [fix] A read-only field with a default value would trigger a validation error on POST and PUT methods.
Version 0.1.1¶
Released on October 31th, 2013.
Enhancements¶
- DELETE now uses the original document ID_FIELD when issuing the delete command to the underlying data layer (Xavi Cubillas).
- Embedded Resource Serialization also available at item endpoints
(
/invoices/<id>/?embedded={'person':1}), collection(used when setting up a data relation, see Embedded Resource Serialization) has been renamed toresourcein order to avoid confusion between the Eve schema and underlying MongoDB collections.- Nested endpoints. Endpoints with deep paths like
/contacts/overseascan now function in conjuction with top-level endpoints (/contacts). Endpoints are completely independent: each can allow item lookups (/contacts/<id>andcontacts/overseas/<id>) and different access methods. Previously, while you could have complex urls, you could not get nested endpoints to work properly. - PyMongo 2.6.3 is now supported.
- item-id wrappers have been removed from POST/PATCH/PUT requests and
responses. Requests for single document insertion/edition are now performed
by just submitting the relevant document. Bulk insert requests are performed
by submitting a list of documents. The response to bulk requests is a list
itself in which every list item contains the state of the corresponding
request document. Please note that this is a breaking change. Also be aware
that when the request content-type is
x-www-form-urlencoded, single document insert is performed. Closes #139. - ObjectId are properly serialized on POST/PATCH/PUT methods.
- Queries on ObjectId and datetime values in nested documents.
auth.user_idrenamed toauth.request_auth_valuefor better consistency with theauth_fieldsetting. Closes #132 (Ryan Shea).- Same behavior as Flask, SERVER_NAME now defaults to None. It allows much easier development on distant machine that may changes IP (Ronan Delacroix).
Fixes¶
- CORS support was not available for
additional_lookupurls (Petr Jašek.) - ‘default’ field values that could be assimilated to
None(0, None, “”) would be ignored. - POST and PUT would fail with 400 if there was no auth class while
auth_fieldwas set for a resource. - Fix order of string arguments in exception message in flaskapp.validate_schema() (Roy Smith).
Version 0.1¶
Released on September 30th, 2013.
New Features¶
PUTmethod for completely replace a document while keeping the same unique identifier. Closes #96.- Embedded Resource Serialization. If a document field is referencing a document in another resource, clients can request the referenced document to be embedded within the requested document (Bryan Cattle). Closes #68.
- “No trailing slash” URLs are now supported. Closes #118.
- HATEOAS is now optional and can be disabled both at global and resource level.
X-HTTP-Method-Overridesupported for all HTTP Methods. Closes #95.
Enhancements¶
- HTTP method is now passed into
authenticate()andcheck_auth()(Ken Carpenter). Closes #90 . - Cleanup and hardening of User-Restricted Resource Access Edit (Bryan Cattle).
- Account Management tutorial updated to reflect the event hooks naming update introduced in v0.0.9.
- Some more Python 3 refactoring (Dong Wei Ming).
- Events 0.2.0 is now supported.
- PyMongo 2.6.2 is now supported.
- Cerberus 0.4.0 is now supported.
Fixes¶
- Item
GETon documents with non-existent ‘created’ field (because stored outside of API context) were not returning a default value for the field. - Edits on documents with non-existent ‘created’ or ‘updated’ fields
(because stored outside of the API context) were returning
412 Precondition Failed. Closes #123. on_insertis raised when aPUT(replace action) is about to be performed. Closes #120.- Installation on Windows with Python 3 was returning encoding errors.
- Fixed #99: malformed XML render when href includes forbidden URI/URL chars.
- Fixed a bug introduced with 0.0.9 and Python 3 support. Filters (
?where) on datetime values were not working when running on Python 2.x. - Fixed some typos and minor grammatical errors all across the documentation (Ken Carpenter, Jean Boussier, Kracekumar, Francisco Corrales Morales).
Version 0.0.9¶
Released on August 29, 2013
- PyMongo 2.6 is now supported.
FILTERSboolean replaced byALLOWED_FILTERSlist which allows for explicit whitelisting of filter-enabled fields (Bryan Cattle). Closes #78.- Custom user ids for User-Restricted Resource Access, allowing for more flexibility and token revocation with token-based authentication. Closes #73.
AUTH_USERNAME_FIELDrenamed toAUTH_FIELD.auth_username_fieldrenamed toauth_field.- BasicAuth and subclasses now support
user_idproperty. - Updated the event hooks naming system to be more robuts and consistent. Closes #80.
- To emphasize the fact that they are tied to a method, all
on_<method>hooks now have<method>in uppercase. on_gettinghook renamed toon_fetch_resource.on_getting_<resource>hook renamed toon_fetch_resource_<resource>on_getting_itemhook renamed toon_fetch_item.on_getting_item_<item_title>hook renamed toon_fetch_item_<item_title>.on_postinghook renamed toon_insert.- Datasource projections always include automatic fields (
ID_FIELD,LAST_UPDATED,DATE_CREATED). Closes #85. - Public HTTP methods now override auth_username_field Edit. Closes #70 (Bryan Cattle).
- Response date fields are now using GMT instead of UTC. Closes #83.
- Handle the case of ‘additional_lookup’ field being an integer. If this is the case you can omit the ‘url’ key, as it will be ignored, and the integer value correctly parsed.
- More informative HTTP error messages. Some more informative error messages have been added for HTTP 400/3/12 and 500 errors. The error messages only show if DEBUG==True (Bryan Cattle).
on_getting(resource, documents)is nowon_getting_resource(resource, documents);on_getting_<resource>(documents) is now known as ``on_getting_resource_<resource>(documents)(Ryan Shea).- Added a new event hook:
on_getting_item_<title>(_id, document)(Ryan Shea). - Allow
auth_username_fieldto be set toID_FIELD(Bryan Cattle). - Python 3.3 is now supported.
- Flask 0.10.1 is now supported.
- Werkzeug 0.9.4 is now supported.
- Copyright finally updated to 2013.
Version 0.0.8¶
Released on July 25th 2013.
- Only run RateLimiting tests if redis-py is installed and redis-server is running.
- CORS
Access-Control-Allow-Headersheader support (Garrin Kimmell). - CORS
OPTIONSsupport for resource and items endpoints (Garrin Kimmell). floatis now available as a data-type in the schema definition ruleset.nullablefield schema rule is now available. IfTruethe field value can be set to null. Defaults toFalse.- v0.3.0 of Cerberus is now a requirement.
on_getting,on_getting_<resource>andon_getting_itemevent hooks. These events are raised when documents have just been read from the database and are about to be sent to the client. Registered callback functions can eventually manipulate the documents as needed. Please be aware thatlast_modifiedandetagheaders will always be consistent with the state of the documents on the database (they won’t be updated to reflect changes eventually applied by the callback functions). Closes #65.- Documentation fix:
AUTH_USERFIELD_NAMErenamed toAUTH_USERNAME_FIELD(Julien Barbot). - Responses to GET requests for resource endpoints now include a
lastitem in the _links dictionary. The value is a link to the last page available. The item itself is only provided if pagination is enabled and the page being requested isn’t the last one. Closes #62. - It is now possible to set the MongoDB write concern level at both global
(
MONGO_WRITE_CONCERN) and endpoint (mongo_write_concern) levels. The value is a dictionary with all valid MongoDB write_concern settings (w, wtimeout, j and fsync) as keys.{'w': 1}is the default, which is also MongoDB’s default setting. TestMininalclass added to the test suite. This will allow to start the building of the tests for an application based on Eve, by subclassing the TestMinimal class (Daniele Pizzolli).
Version 0.0.7¶
Released on June 18th 2013.
- Pinned Werkzeug requirement to v0.8.3 to avoid issues with the latest release which breaks backward compatibility (actually a Flask 0.9 requirements issue, which backtracked to Eve).
- Support for Rate Limiting on all HTTP methods. Closes #58. Please note: to successfully execute the tests in ‘eve.tests.methods.ratelimit.py`, a running redis server is needed.
utils.request_methodinternal helper function added, which allowed for some nice code cleanup (DRY).- Setting the default ‘field’ value would not happen if a ‘data_relation’ was nested deeper than the first schema level. Fixes #60.
- Support for
EXTRA_RESPONSE_FIELDS. It is now possible to configure a list of additonal document fields that should be provided with POST responses. Normally only automatically handled fields (ID_FIELD,LAST_UPDATED,DATE_CREATED,etag) are included in POST payloads.EXTRA_RESPONSE_FIELDSis a global setting that will apply to all resource endpoint . Defaults to[], effectively disabling the feature.extra_response_fieldsis a local resource setting and will overrideEXTRA_RESPONSE_FIELDSwhen present. on_postingandon_posting_<resource>event hooks.on_postingandon_posting_<resource>events are raised when documents are about to be stored. Among other things this allows callback functions to arbitrarily update the documents being inserted.on_posting(resource, documents)is raised on every successful POST whileon_posting_<resource>(documents)is only raised when <resource> is being updated. In both circumstances events will be raised only if at least one document passed validation and is going to be inserted.- Flask native
request.jsonis now used when decoding request payloads. - resource argument added to Authorization classes. The
check_auth()method of all classes in theeve.authpackage (BasicAuth,HMACAuth,TokenAuth) now supports the resource argument. This allows subclasses to eventually build their custom authorization logic around the resource being accessed. MONGO_QUERY_BLACKLISToption added. Allows to blacklist mongo query operators that should not be allowed in resource queries (?where=). Defaults to [‘$where’, ‘$regex’]. Mongo Javascript operators are disabled by default as they might be used as vectors for injection attacks. Javascript queries also tend to be slow and generally can be easily replaced with the (very rich) Mongo query dialect.MONGO_HOSTdefaults to ‘localhost’.MONGO_PORTdefaults to 27017.- Support alternative hosts/ports for the test suite (Paul Doucet).
Version 0.0.6¶
Released on May 13th 2013.
- Content-Type header now properly parsed when additional arguments are included (Ondrej Slinták).
- Only fields defined in the resource schema are now returned from the database. Closes #52.
- Default
SERVER_NAMEis now set to127.0.0.1:5000. auth_username_fieldis honored even when there is no query in the request (Thomas Sileo).- Pagination links in XML payloads are now properly escaped. Fixes #49.
- HEAD requests supported. Closes #48.
- Event Hooks. Each time a GET, POST, PATCH, DELETE method has been executed,
both global
on_<method>and resource-levelon_<method>_<resource>events will be raised. You can subscribe to these events with multiple callback functions. Callbacks will receive the original flask.request object and the response payload as arguments. - Proper
max_resultshandling ineve.utils.parse_request, refactored tests (Tomasz Jezierski). - Projections. Projections are conditional queries where the client dictates which fields should be returned by the API (Nicolas Bazire).
ALLOW_UNKNOWNoption, and the correspondingallow_optionslocal setting, allow for a less strict schema validation. Closes #34.- ETags are now provided with POST responses. Closes #36.
- PATCH performance improvement: ETag is now computed in memory; performing an extra database lookup is not needed anymore.
- Bulk Inserts on the database. POST method heavily refactored to take
advantage of MongoDB native support for Bulk Inserts. Please note: validation
constraints are checked against the database, and not between the payload
documents themselves. This causes an interesting corner case: in the event of
a multiple documents payload where two or more documents carry the same value
for a field where the
uniqueconstraint is set, the payload will validate successfully, as there are no duplicates in the database (yet). If this is an issue, the client can always send the documents once at a time for insertion, or validate locally before submitting the payload to the API. - Responses to document GET requests now include the ETag in both the header and the payload. Closes #29.
methodssettings keyword renamed toresource_methodsfor coherence with the globalRESOURCE_METHODS(Nicolas Carlier).
Version 0.0.5¶
Released on April 11th 2013.
- Fixed an issue that apparently caused the test suite to only run successfully on the dev box. Thanks Chronidev for reporting this.
- Referential integrity validation via the new
data_relationschema keyword. Closes #25. - Support for
Content-Type: application/jsonfor POST and PATCH methods. Closes #28. - User-restricted resource access. Works in conjunction with Authentication.
When enabled, users can only read/update/delete resource items created by
themselves. Can be switched on and off at global level via the
AUTH_USERFIELD_NAMEkeywork, or at single resource endpoints with the user_userfield_name keyword (the latter will override the former). The keyword contains the actual name of the field used to store the username of the user who created the resource item. Defaults to ‘’, which disables the feature (Thomas Sileo). PAGING_LIMITkeyword setting renamed toPAGINATION_LIMITfor better coherency with the newPAGINATIONkeyword. This could break backward compatibility in some cases.PAGING_DEFAULTkeyword settings renamed toPAGINATION_DEFAULTfor better coherence with the newPAGINATIONkeyword. This could break backward compatibility in some cases.ITEM_CACHE_CONTROLremoved as it seems unnecessary at the moment.- Added an example on how to handle events to perform custom actions. Closes #23 and #22.
eve.validation_schema()now collects offending items and returns all of them into the exception message. Closes #24.- Filters (
?where=), sorting (?sort=) and pagination (?page=10) can now be be disabled at both global and endpoint level. Closes #7. - CORS (Cross-Origin Resource Sharing) support. The new
X-DOMAINSkeywords allows API maintainers to specify which domains are allowed to perform CORS requests. Allowed values are: None, a list of domains, or ‘*’ for a wide-open API. Closes #1. - HMAC (Hash Message Authentication Code) based Autentication.
- Token Based Authentication, a variation of Basic Authentication. Closes #20.
- Orphan function removed (
eve.methods.get.standard_links). DATE_CREATEDandLAST_UPDATEDfields now show default values for documents created outside the API context. Fixes #18.
Version 0.0.4¶
Released on February 25th 2013.
- Consistent ETag computation between runs/instances. Closes #16.
- Support for Basic Authentication (RFC2617).
- Support for fine-tuning authentication with
PUBLIC_METHODSandPUBLIC_ITEM_METHODS. By default, access is restricted to all endpoints, for all HTTP verbs (methods), effectively locking down the whole API. - Supporto for role-based access control with
ALLOWED_ROLESandallowed_roles. - Support for all standard Flask initialization parameters.
- Support for default values in resource fields. The new
defaultkeyword can now be used when defining a field rule set. Please note: currently default values are supported only for main document fields. Default values for fields in embedded documents will be ignored. - Multiple API endpoints can now target the same database collection. For
example now you can set both
/admins/and/users/to read and write from the same collection on the db, people. The newdatasourcesetting allows to explicitly link API resources to database collections. It is a dictionary with two allowed keys: source and filter. source dictates the database collection consumed by the resource. filter is the underlying query, applied by the API when retrieving and validating data for the resource. Previously, the resource name would dictate the linked datasource (and of course you could not have two resources with the same name). This remains the default behaviour: if you omit thedatasourcesetting for a resource, its name will be used to determine the database collection. - It is now possibile to set predefined db filters for each resource.
Predefined filters run on top of user queries (GET requests with
whereclauses) and standard conditional requests (If-Modified-Since, etc.) Please note that datasource filters are applied on GET, PATCH and DELETE requests. If your resource allows for POST requests (document insertions), then you will probably want to set the validation rules accordingly (in our example, ‘username’ should probably be a required field). - JSON-Datetime dependency removed.
- Support for Cerberus v0.0.3 and later.
- Support for Flask-PyMongo v0.2.0 and later.
- Repeated XML requests to the same endpoint could occasionally return an Internal Server Error (Fixes #8).
Version 0.0.3¶
Released on January 22th 2013.
- XML rendering love. Lots of love.
- JSON links are always wrapped in a
_linksdictionary. Key values match the relation between the item being represented and the linked resource. - Streamlined JSON responses. Superflous
responseroot key has been removed from JSON payloads. GET requests to resource endpoints: items are now wrapped with an_itemslist. GET requests to item endpoints: item is now at root level, with no wrappers around it. - Support for API versioning through the new API_VERSION configuration setting.
- Boolean values in request forms are now correctly parsed.
- Tests now run under Python 2.6.
Version 0.0.2¶
Released on November 27th 2012.
- Homepage/api entry point resource links fixed. They had bad ‘href’ tags which also caused XML validation issues when processing responses (especially when accessing the API via browser).
- Version number in ‘Server’ response headers.
- Added support for DELETE at resource endpoints. Expected behavior: will delete all items in the collection. Disabled by default.
eve.io.mongo.Validatornow supportsValidatorsignature, allowing for further subclassing.