An unobtrusive Ruby gem for versioning APIs in Rails or Rack applications using versioned view templates.
Version Cake is a Ruby gem that provides an unobtrusive way to version APIs in Rails or Rack applications. It allows developers to manage multiple API versions through versioned view templates, ensuring backward compatibility and clean separation of version-specific logic. The gem supports flexible version extraction strategies and graceful degradation for unsupported client requests.
Ruby on Rails developers building versioned REST APIs who want a convention-based, maintainable approach to API versioning without heavy controller modifications.
Developers choose Version Cake for its simplicity and Rails-friendly design, using view templates for versioning to reduce controller complexity. It offers built-in graceful degradation and multiple version extraction strategies out of the box.
:cake: Version Cake is an unobtrusive way to version APIs in your Rails or Rack apps
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Version-specific logic is isolated in view templates with file extensions like index.json.v1.jbuilder, reducing controller clutter and adhering to Rails conventions, as shown in the example views.
Requests for unsupported versions automatically fall back to the latest available version, ensuring backward compatibility without manual handling, demonstrated in the sample output for missing v3.
Supports version extraction via query parameters, HTTP headers, path parameters, or custom strategies, offering adaptability for different client needs, as outlined in the configuration section.
Allows fine-grained control over obsolete, deprecated, and supported versions per resource URI using regex patterns, enabling tailored version policies for diverse endpoints.
Major version upgrades (e.g., v1 to v2) require file renaming and configuration changes, as documented in the README, which can disrupt development and increase maintenance effort.
Since versioning is handled in views, API changes affecting core logic (e.g., model relationships) still need manual controller adjustments, limiting its utility for complex versioning scenarios.
Setting up resource patterns and extraction strategies involves regex and initializer files, which can be overwhelming for simple APIs or teams unfamiliar with such configurations.