Package: anyblok_pyramid_rest_api
Anyblok Pyramid Rest ApiThe main idea is to provide facilities for building restful api that interacts withAnyBlokmodels
through a CRUD like pattern.As dependecy, it useCornicefor its validators and schema abilities andMarshmallowfor
schema definition, serialization and deserialization (we have since split this work toAnyBlok_Marshmallow).Free software: Mozilla Public License Version 2.0Documentation:https://anyblok-pyramid-rest-api.readthedocs.ioFeaturesIncoming request validation through schema (validation before database query and ability to
validate several parts of the request object)CRUD queries always with request.validated dataData deserialization for response through schemaEasy CRUD resource declaration (map a model on an endpoint)Automatic schema generation based on models introspectionAdvanced collection filtering, ordering, paging (querystring validation through schema)TodoHelpers for JsonSchema or SwaggerAdvanced introspection for api documentation generationRequest lifecyleincoming request-> validators -> deserializer (json to dict) -> schema load -> request.validated -> request.errorsrequest.validated-> crud -> resulting records
-> deserializer (records to schema dump)
-> serializer (default pyramid / cornice dict to json serializer)
-> responseAuthorFranck Bretfranckbret@gmail.comhttps://github.com/franckbretContributorsJean-Sébastien Suzannejs.suzanne@gmail.comhttps://github.com/jssuzannehttps://github.com/AnyBlokCreditsAnyblokPyramidCorniceMarshmallowAnyBlok_MarshmallowLicenseThis Source Code Form is subject to the terms of the Mozilla Public License,
v. 2.0. If a copy of the MPL was not distributed with this file,You can
obtain one athttp://mozilla.org/MPL/2.0/.Copyright (c) 2017, Franck BretChange LogAll notable changes to this project will be documented in this file.
This project adheres toSemantic Versioning.0.7.0 (2020-12-07)Added entries in the querystring:primary-keys[key1:key2:…:keyn]=va1:va2:…:van,vb1:vb2:…:vbn~primary-keys[key1:key2:…:keyn]=va1:va2:…:van,vb1:vb2:…:vbncomposite-filter[key1:key2:…:keyn][op1:op2:…:opn]=va1:va2:…:van,vb1:vb2:…:vbn~composite-filter[key1:key2:…:keyn][op1:op2:…:opn]=va1:va2:…:van,vb1:vb2:…:vbn0.6.0 (2020-05-15)AddedCrudResource can now allow calls to certain http verb without being logged.* allow_unauthenticated_user_to_access_to_all_verbs
* allow_unauthenticated_user_to_access_to_collection_get
* allow_unauthenticated_user_to_access_to_collection_post
* allow_unauthenticated_user_to_access_to_collection_patch
* allow_unauthenticated_user_to_access_to_collection_put
* allow_unauthenticated_user_to_access_to_collection_delete
* allow_unauthenticated_user_to_access_to_get
* allow_unauthenticated_user_to_access_to_delete
* allow_unauthenticated_user_to_access_to_patch
* allow_unauthenticated_user_to_access_to_putRefactoredUpdated theorder_by[operator]=fieldnamebyorder_by[fieldname]=operatorbecause more than one order by can be sendWarningthe oldest order_by is deprecated and will be remove later0.5.0 (2019-06-21)RefactoredTag can now be grouped@Adapter.tags('green', 'blue')
def tag_is_green_or_blue(self, querystring, query, tags):
    query = query.join(self.registry.Customer.tags, aliased=True)
    query = query.filter(self.registry.Tag.name.in_(tags))
    return queryadapter_clsis renamedQueryStringAdapter. the compatibility is keeped and
a DeprecationWarning is sent0.4.0 (2019-01-03)AddedCrudResource.execute(name, kwarg) decorator to define Service on:collection_path/execute/name: validator on the bodypath/execute/name: validator on the path and the body@resource(collection_path='/foo', path='/foo/{bar}')
class MyResource(CrudResource):
    @CrudResource.service('print', collection=True)
    def plop(self):  # /foo/execute/print
        # verb : POST (default), GET, PUT, PATCH, DELETE, ...
        # schema optional
        # query = self.get_querystring('rest action given to get_model')
        # body = self.body
        ...

    @CrudResource.service('print')
    def otherplop(self):  # /foo/{bar}/execute/print
        # verb : POST (default), GET, PUT, PATCH, DELETE, ...
        # schema optional for body, pathschema for path
        # body = self.body
        ...Collection views to update and delete collection defined by querystring:collection_putcollection_patchcollection_deleteRefactoredIf arequest.erroris found during the execution of a view in the crud resource,
then a registry.rollback will be doneCollection postis waiting a list of dict, Now it is possible to create more than
one entry0.3.0 (2018-12-07)RemovedCompatibility with python 3.3FixedQueryString filters and tags are executed only one time by queryin the context manager to save the error, the registry is now rollbackedRefactoredThe error field is now the key of the errors description dict (All validation errors messages are now dict)0.2.1 (2018-10-06)AddedMANIFEST.in fileRemovedVERSION file0.2.0 (2018-10-01)Addedcontextkey in querystring. The goal is to add some informations
to help custom filter and tag to build their queryRefactoredNow the querystring desarializer use regex to get the informations0.1.0 (2018-09-26)AddedCRUDResourceclass to define REST apiservice behaviours