Praxis v0.11 Release Notes

    • MediaTypeCollection:
      • Added support for loading decorateed Resource associations.
    • ๐Ÿ‘ Refined and enhanced support for API versioning:
      • version DSL now can take a using option which specifies and array of the methods are allowed: :header,:params,:path(new)
      • if not specified, it will default to using: [:header, :params] (so that the version can be passed to the header OR the params)
      • the new :path option will build the action routes by prefixing the version given a common pattern (i.e., "/v1.0/...")
      • The effects of path versioning will be visible through rake praxis:routes
      • the default api prefix pattern is ("/v(version)/") but can changed by either
        • overriding `Praxis::Request.path_version_prefix and return the appropriate string prefix (i.e., by default this returns "/v")
        • or overriding Praxis::Request.path_version_matcher and providing the fully custom matching regexp. This regexp must have a capture (named version) that would return matched version value.
    • โœจ Enhanced praxis generator:
      • Added a new generator (available through praxis new app_name) which creates a blank new app, with enough basic structure and setup to start building an API.
      • Changed the example hello world generation command. Instead of praxis generate app_name, it is now available through praxis example app_name
      • Changed the path lookup for the praxis directory (to not use installed gems, which could be multiple). [Issue #67]
    • ResourceDefinition:
      • Added: action_defaults method, to define default options for actions. May be called more than once.
      • Removed: params, payload, headers, and response. Specify these inside action_defaults instead.
    • Application:
      • Added middleware method to use Rack middleware.
    • ErrorHandler
      • It is now possible to register the error handler class to be invoked when an uncaught exception is thrown by setting Application#error_handler.
      • The default error handler writes the error and backtrace into the Praxis logger, and returns an InternalServerError response
    • โž• Added Praxis::Notifications framework backed by ActiveSupport::Notifications
      • Its interface is the same as AS::Notifications (.publish, .instrument, .subscribe, and etc.)
      • Each incoming rack request is instrumented as rack.request.all, with a payload of {response: response}, where response is the Response object that will be returned to the client. Internally, Praxis subscribes to this to generate timing statistics with Praxis::Stats.
      • Additionally, each request that is dispatched to an action is instrumented as praxis.request.all, with a payload of {request: request, response: response}, where response is as above, and request is the Request object for the request.
    • โž• Added Praxis::Stats framework backed by Harness (i.e. a statsd interface)
      • Can be configured with a collector type (fake, Statsd) and an asynchronous queue + thread
      • Wraps the statsd interface: count, increment, decrement, time ...
    • โž• Added a new decorate_docs method to enhance generated JSON docs for actions in ResourceDefinitions
      • Using this hook, anybody can register a block that can change/enhance the JSON structure of generated documents for any given action
    • โž• Added a brand new Plugins architecture
      • Plugins can easily inject code in the Request, Controller, ResourceDefinition or ActionDefinition
      • Can be instances or singletons (and will be initialized correspondingly)
      • Plugins can be easily configured under a unique "config key" in the Praxis config
      • See the Plugins section in the documentation for more information.
    • โž• Added a Plugin for using the Praxis::Mapper gem
      • Configurable through a simple praxis_mapper.yml file
      • Its supports several repositories (by name)
      • Each repository can be of a different type (default is sequel)
    • ๐Ÿ’ป praxis:doc_browser rake task now takes a port argument for specifying the port to run on, e.g. rake praxis:doc_browser[9000] to run on port 9000.
    • โž• Added show_exceptions configuration option to to control default ErrorHandler behavior.