Skip to content

Add render template route#1256

Merged
Strift merged 2 commits into
meilisearch:mainfrom
qorexdevs:render-template-route
Jun 30, 2026
Merged

Add render template route#1256
Strift merged 2 commits into
meilisearch:mainfrom
qorexdevs:render-template-route

Conversation

@qorexdevs

@qorexdevs qorexdevs commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Related issue

Closes #1253

What does this PR do?

  • Add client.render_template() for the experimental POST /render-template route added in Meilisearch 1.48
  • Send template with an optional input, and drop input from the body when it is not passed (the route returns the unrendered template with rendered: null in that case)
  • Add unit tests for the request shape plus live tests gated by a renderRoute experimental-feature fixture
  • Add the post_render_template_1 code sample

The route is behind the renderRoute experimental feature, so callers enable it with update_experimental_features({"renderRoute": True}) first. Tested the new cases against a local Meilisearch 1.48.0.

AI disclosure

None

PR checklist

  • Have you read the contributing guidelines?
  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you made sure that the title is accurate and descriptive of the changes?

Summary by CodeRabbit

  • New Features
    • Added render_template to the client to render inline document templates, with optional document input.
  • Documentation
    • Added a new Meilisearch documentation code sample demonstrating how to enable and use template rendering.
  • Bug Fixes
    • Ensures request payloads include input only when provided.
  • Tests
    • Added coverage for render_template, including scenarios with and without input.
    • Added a test fixture to enable/disable the experimental render feature during the test run.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6ea52139-1915-4ef1-84d7-6b9e6d4e9da1

📥 Commits

Reviewing files that changed from the base of the PR and between 0bfbbb6 and f4a4244.

📒 Files selected for processing (1)
  • .code-samples.meilisearch.yaml
✅ Files skipped from review due to trivial changes (1)
  • .code-samples.meilisearch.yaml

📝 Walkthrough

Walkthrough

Adds Client.render_template for the experimental render-template endpoint, including the route constant, opt-in test fixture, tests, and a code sample.

Changes

Render Template Feature

Layer / File(s) Summary
Route constant and Client.render_template implementation
meilisearch/config.py, meilisearch/client.py
Config.Paths.render_template is set to "render-template"; Client.render_template builds a request body with template and optional input, posts it, and returns the response dict.
Tests and fixture
tests/conftest.py, tests/client/test_client_render_template.py
enable_render_route enables and later disables the renderRoute experimental feature; tests cover route invocation, omitted input, inline template rendering, and rendered being None.
Code sample
.code-samples.meilisearch.yaml
Adds post_render_template_1, showing client.update_experimental_features, then client.render_template with inline document template and inline document input.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Poem

🐇 A template hopped into the light,
With render routes and docs just right.
I nosed the sample, neat and bright,
Then bounced away in rabbit delight.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding the render template route.
Linked Issues check ✅ Passed The PR adds the endpoint method, tests, and code sample required by issue #1253.
Out of Scope Changes check ✅ Passed The changes are limited to the experimental render template feature and its supporting tests/sample.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.code-samples.meilisearch.yaml:
- Around line 613-623: The `post_render_template_1` sample calls
`client.render_template` without first opting into the gated feature, so update
the example to include the explicit
`client.update_experimental_features({"renderRoute": True})` step before the
render call. Keep the change in the same docs sample and ensure the
`render_template` snippet clearly shows the required experimental-feature opt-in
path before using `client.render_template`.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 70a3f670-59b8-4dec-94a9-224011b43849

📥 Commits

Reviewing files that changed from the base of the PR and between 0170ce0 and 0bfbbb6.

📒 Files selected for processing (5)
  • .code-samples.meilisearch.yaml
  • meilisearch/client.py
  • meilisearch/config.py
  • tests/client/test_client_render_template.py
  • tests/conftest.py

Comment thread .code-samples.meilisearch.yaml
@Strift Strift added the enhancement New feature or request label Jun 30, 2026

@Strift Strift left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hello @qorexdevs and thanks for your contirbution 🙌 LGTM!

@Strift Strift added this pull request to the merge queue Jun 30, 2026
Merged via the queue into meilisearch:main with commit 8330e28 Jun 30, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Meilisearch v1.48.0] Add render template (experimental)

2 participants