Skip to content

feat: add API versioning and error contract - #9

Merged
vinimachadosantana merged 1 commit into
developfrom
feat/api-foundation
Aug 7, 2026
Merged

feat: add API versioning and error contract#9
vinimachadosantana merged 1 commit into
developfrom
feat/api-foundation

Conversation

@vinimachadosantana

Copy link
Copy Markdown
Owner

What

Adds an /api/v1 namespace, a versioned base controller with centralised error handling, and a JSON spec helper.

Why

Every error response now has one predictable shape, so clients handle failures generically instead of special-casing each endpoint. Versioning means a future breaking change can ship as /api/v2 without stranding existing consumers.

How

  • rescue_from handlers are matched bottom-up, so StandardError is declared first and specific exceptions after (500 inverse).
  • Unhandled exceptions are logged in full and re-raised in development and test (for a usable stack trace) but return a generic message in production.
  • URL versioning over header versioning to be easier to debug and cache.

Testing

  • bundle exec rspec green
  • RuboCop and Brakeman clean

@vinimachadosantana vinimachadosantana self-assigned this Aug 7, 2026
@vinimachadosantana
vinimachadosantana merged commit 41919ec into develop Aug 7, 2026
3 checks passed
@vinimachadosantana
vinimachadosantana deleted the feat/api-foundation branch August 7, 2026 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant