Skip to content

[OpenAPI]: Add support for blueprinter root key#343

Open
Abishekcs wants to merge 4 commits into
rage-rb:mainfrom
Abishekcs:openapi/blueprinter-root-key
Open

[OpenAPI]: Add support for blueprinter root key#343
Abishekcs wants to merge 4 commits into
rage-rb:mainfrom
Abishekcs:openapi/blueprinter-root-key

Conversation

@Abishekcs

@Abishekcs Abishekcs commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

What this PR does?

Add Support for root key

Example

  # @response DataMining(view: :extended, root: :user)

Screnshot

  • Before
image
  • After
image

Abishekcs added 4 commits July 1, 2026 16:58
…ations

Add support for the `root:` option in Blueprinter parser, wrapping the schema under a named key when specified (e.g. `@response UserBlueprint(root: :user)`).
@Abishekcs Abishekcs force-pushed the openapi/blueprinter-root-key branch from b5e1f27 to a8f4eda Compare July 1, 2026 11:28
@Abishekcs Abishekcs changed the title Add support for blueprinter root key [OpenAPI]: Add support for blueprinter root key Jul 1, 2026
@Abishekcs

Copy link
Copy Markdown
Contributor Author

PR is ready for review!

end
end

describe "collection" do

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see parsing fails with collections and string-based root keys, e.g. Array<UserBlueprint(root: 'user')> and Array<UserBlueprint(root: "user")>.

RUBY
end

it "wraps the array items schema under the specified root key" do

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wording seems correct, but your test looks different. The test expects a structure like [{ root_key: { ... } }], but the correct structure seems to be { root_key: [{ ... }] }.

@Abishekcs Abishekcs Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the root key gets wrapped in array too. Didn't check the actual blueprinter output for collection, should had done that earlier😐

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.

2 participants