Skip to content

Prepare 3.0: honor explicit namespace roots consistently - #111

Draft
dblock wants to merge 2 commits into
ruby-grape:masterfrom
dblock:breaking/3.0-consistent-roots
Draft

dblock wants to merge 2 commits into
ruby-grape:masterfrom
dblock:breaking/3.0-consistent-roots

Conversation

@dblock

@dblock dblock commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Dependency

Stacked on #107. Merge that compatibility fix first; this draft deliberately introduces the single-object behavior change separately for 3.0. The upstream PR targets master because the parent branch is in a fork. Focused diff against #107.

Breaking change

Bump the gem version to 3.0.0. An explicit namespace root now applies literally to both collections and single objects. With namespace users and root members, a collection remains {"members": [...]} and a single object changes from {"user": {...}} to {"members": {...}}. Roots are not automatically singularized.

Preserve render > route > inner namespace > outer namespace > default serializer option precedence. Without explicit roots, single objects retain model/serializer inference and collections retain namespace/route defaults. Adapter-specific behavior is unchanged, including attributes responses, JSON:API documents, and AMS root:false semantics.

Add a 3.0 changelog section, README examples, migration guidance, and focused request cases for inherited roots, inferred defaults, root:false, and attributes responses. To retain an old single-object key, set an explicit route/render root or move collection roots to collection routes.

Validation

All 88 examples and RuboCop pass locally on Ruby 4.0 with Grape 4. Hosted CI passes the full compatibility matrix and lint; Danger also passes.

Keep this PR as a draft for the next major release.

Created by Copilot, an AI, on behalf of @dblock.

dblock and others added 2 commits October 26, 2026 22:32
Merge serializer options from actual namespace scopes, preserving outer-to-inner precedence, and forward root through render. Document adapter selection, root precedence, empty collections, root:false behavior, and unwrapped arrays. Cover each documented response shape with request-level regressions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Apply explicit namespace roots to single objects as well as collections. Preserve root precedence, inferred defaults, and adapter behavior, and document the breaking response-key change and migration options.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dblock
dblock force-pushed the breaking/3.0-consistent-roots branch from af53bbe to 7d726f4 Compare October 27, 2026 02:46
@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Danger Report

No issues found.

View run

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