Skip to content
  • Denis Laxalde's avatar
    Use resource interfaces for context of API views · fe8187f8d252
    Denis Laxalde authored
    We define interfaces (using zope.interface) for main resource classes
    and refer to these interfaces (as dotted names) in API views' context
    instead of registering these views against the resource classes
    directly.
    
    The idea is to make it possible for downstream applications to register
    their own resource classes that could be selected by standard API views.
    
    Interfaces have attributes and methods declared based on what appears to
    be needed on API views. We use interface inheritance to reduce
    duplication (e.g. the IMapped interface is a base for all interface but
    IRoot; IRelatedEntities is a base for IRelatedEntity).
    
    Notice that this somehow conflicts with the Mappable abstract class that
    was defined previously in resources module; so we drop this abstract
    class and replace it by an IMapped interface.
    fe8187f8d252