Skip to content

Add missing code samples and remove unused ones#3545

Open
curquiza wants to merge 3 commits intomainfrom
fix-code-samples
Open

Add missing code samples and remove unused ones#3545
curquiza wants to merge 3 commits intomainfrom
fix-code-samples

Conversation

@curquiza
Copy link
Copy Markdown
Member

@curquiza curquiza commented Apr 6, 2026

Description

Only .code-samples.meilisearch.yaml to check. All other files are generated following changes in .code-samples.meilisearch.yaml

This PR fixes CI failiing

Capture d’écran 2026-04-06 à 16 45 19 Capture d’écran 2026-04-06 à 16 44 55

Because of one of the CI failing, some examples in our API references are generated by Mintlify and do not have proper examples created by our teams, which is not always a good experience for our users, as you can see for Network control route

Capture d’écran 2026-04-06 à 16 48 55

Summary by CodeRabbit

Release Notes

  • Documentation
    • Added API code examples for chat workspace management, dynamic search rules operations, foreign keys settings, network control, and task compaction endpoints.
    • Updated OpenAPI specification with additional code samples for multiple endpoints.
    • Removed outdated API documentation examples.

@mintlify
Copy link
Copy Markdown

mintlify bot commented Apr 6, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
meilisearch-documentation 🟢 Ready View Preview Apr 6, 2026, 2:25 PM

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 6, 2026

📝 Walkthrough

Walkthrough

Updated Meilisearch API documentation and code examples by removing outdated snippets and adding comprehensive examples for chat operations, dynamic search rules, foreign keys settings, network control, and task management across YAML configuration, OpenAPI spec, and MDX documentation files.

Changes

Cohort / File(s) Summary
Configuration & OpenAPI Updates
.code-samples.meilisearch.yaml, assets/open-api/meilisearch-openapi-mintlify.json
Removed 7 legacy snippet keys (field properties, search parameters, index settings, rename index, multi-search federated). Added 16 new snippet keys for chat workflows (list/get/delete workspaces, chat completions, settings), dynamic search rules CRUD, foreign keys settings, network control, and task compaction. OpenAPI spec augmented with x-codeSamples blocks containing cURL examples for these endpoints.
Chat Workflow Examples
snippets/generated-code-samples/code_samples_list_chat_workspaces_1.mdx, code_samples_get_chat_workspace_1.mdx, code_samples_delete_chat_workspace_1.mdx, code_samples_post_chat_completion_1.mdx, code_samples_reset_chat_workspace_settings_1.mdx
Added new MDX snippets demonstrating chat endpoint operations: listing workspaces (GET /chats), retrieving specific workspace (GET /chats/:workspaceUid), deleting workspace (DELETE), posting chat completions (POST), and resetting settings (DELETE).
Dynamic Search Rules Examples
snippets/generated-code-samples/code_samples_list_dynamic_search_rules_1.mdx, code_samples_get_dynamic_search_rule_1.mdx, code_samples_patch_dynamic_search_rule_1.mdx, code_samples_delete_dynamic_search_rule_1.mdx
Added complete CRUD example set for dynamic search rules: list with pagination (POST), retrieve by ID (GET), update rule properties (PATCH), and delete rule (DELETE).
Foreign Keys Settings Examples
snippets/generated-code-samples/code_samples_get_foreign_keys_setting_1.mdx, code_samples_update_foreign_keys_setting_1.mdx, code_samples_reset_foreign_keys_setting_1.mdx
Added three new snippets for managing foreign keys index settings: retrieve settings (GET), update with mapping array (PUT), and reset to default (DELETE).
Additional Endpoint Examples
snippets/generated-code-samples/code_samples_network_control_1.mdx, code_samples_compact_task_queue_1.mdx, code_samples_get_task_documents_1.mdx
Added examples for network control operations (POST with origin/message payload), task queue compaction (POST), and task document retrieval (GET).
Removed Examples
snippets/generated-code-samples/code_samples_field_properties_guide_searchable_1.mdx, code_samples_search_parameter_guide_show_ranking_score_details_1.mdx, code_samples_index_settings_tutorial_api_get_setting_1.mdx, code_samples_index_settings_tutorial_api_put_setting_1.mdx, code_samples_index_settings_tutorial_api_task_1.mdx, code_samples_rename_an_index_1.mdx, code_samples_multi_search_remote_federated_1.mdx, code_samples_chat_index_settings_1.mdx
Removed cURL code examples from multiple documentation snippets, keeping remaining language-specific implementations where applicable.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Hopping through examples new and old,
We've swapped the tired for stories bold!
Chat and rules and foreign keys—
Documentation grows with ease!
From snippets trimmed to workflows grand,
Our API docs now shine so grand! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: removing unused code samples and adding missing ones to fix CI failures.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-code-samples

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

@curquiza curquiza changed the title Fix code samples Add missing code samples and remove unused ones Apr 6, 2026
@curquiza curquiza requested review from CaroFG and qdequele April 6, 2026 14:46
@curquiza curquiza marked this pull request as ready for review April 6, 2026 14:46
@curquiza curquiza requested a review from a team as a code owner April 6, 2026 14:46
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (4)
snippets/generated-code-samples/code_samples_get_dynamic_search_rule_1.mdx (1)

7-7: Consider adding a trailing newline.

The file is missing a trailing newline at the end. While not critical, adding one aligns with common convention in many codebases.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@snippets/generated-code-samples/code_samples_get_dynamic_search_rule_1.mdx`
at line 7, Add a trailing newline at the end of the file to comply with POSIX
and repository conventions; open the file
(snippets/generated-code-samples/code_samples_get_dynamic_search_rule_1.mdx),
move the cursor to the end after the closing </CodeGroup> tag and insert a
single newline character so the file ends with a blank line.
.code-samples.meilisearch.yaml (3)

1442-1446: Align snippet key naming with POST action.

list_dynamic_search_rules_1 (Line 1443) maps to # post_dynamic_search_rules and a POST request (Line 1445). Renaming the key to a POST/create-style name would reduce confusion.

Suggested diff
-# post_dynamic_search_rules
-list_dynamic_search_rules_1: |-
+# post_dynamic_search_rules
+create_dynamic_search_rule_1: |-
   curl \
     -X POST 'MEILISEARCH_URL/dynamic-search-rules' \
     -H 'Content-Type: application/json'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.code-samples.meilisearch.yaml around lines 1442 - 1446, The snippet key
name list_dynamic_search_rules_1 conflicts with the POST action and comment
post_dynamic_search_rules; rename the key to reflect a POST/create operation
(e.g., post_dynamic_search_rules_1 or create_dynamic_search_rules_1) so the key
matches the HTTP verb and comment, and update any references to
list_dynamic_search_rules_1 accordingly.

1387-1393: Use WORKSPACE_UID placeholder for workspaceUid routes.

Line 1389 and Line 1393 use WORKSPACE_NAME even though the route is workspaceUid. This is easy to misread and copy incorrectly.

Suggested diff
 get_chat_workspace_1: |-
   curl \
-    -X GET 'MEILISEARCH_URL/chats/WORKSPACE_NAME'
+    -X GET 'MEILISEARCH_URL/chats/WORKSPACE_UID'
 # delete_chats_workspaceUid
 delete_chat_workspace_1: |-
   curl \
-    -X DELETE 'MEILISEARCH_URL/chats/WORKSPACE_NAME'
+    -X DELETE 'MEILISEARCH_URL/chats/WORKSPACE_UID'
Based on learnings: Documentation should be thorough, containing all information users need to use Meilisearch.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.code-samples.meilisearch.yaml around lines 1387 - 1393, Replace the
ambiguous WORKSPACE_NAME placeholder with WORKSPACE_UID for the workspaceUid
routes so examples are accurate: update the get_chat_workspace_1 and
delete_chat_workspace_1 curl examples to use 'WORKSPACE_UID' in the URL (the
route expects workspaceUid). Ensure both occurrences (in the GET and DELETE
examples) are changed to prevent copy-paste errors.

1457-1463: Avoid past-dated campaign timestamps in examples.

As of April 6, 2026, Line 1462 uses a fixed window on November 28, 2025. A placeholder or relative/current-year example would age better.

Suggested diff
-      "description": "Black Friday 2025 rules",
+      "description": "Black Friday campaign rules",
       "priority": 10,
       "active": true,
       "conditions": [
         { "scope": "query", "isEmpty": true },
-        { "scope": "time", "start": "2025-11-28T00:00:00Z", "end": "2025-11-28T23:59:59Z" }
+        { "scope": "time", "start": "YYYY-11-28T00:00:00Z", "end": "YYYY-11-28T23:59:59Z" }
       ],
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.code-samples.meilisearch.yaml around lines 1457 - 1463, The example uses a
hard-coded past date in the rule "Black Friday 2025 rules" within the conditions
time window (keys "start" and "end"); update the time values to be
non-past-proof by replacing the fixed timestamps with either a template
placeholder (e.g., "{{BLACK_FRIDAY_START}}"/"{{BLACK_FRIDAY_END}}") or generate
them relative to the current year (use current-year November 28T00:00:00Z and
November 28T23:59:59Z) so the "conditions" time window remains valid going
forward.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.code-samples.meilisearch.yaml:
- Around line 1382-1393: The curl sample for the GET /chats endpoint under the
snippet key list_chat_workspaces_1 is missing the required Bearer auth header;
update the curl invocation for list_chat_workspaces_1 by adding -H
'Authorization: Bearer MEILISEARCH_KEY' (same header format used elsewhere) so
the sample matches the OpenAPI security requirement for the /chats endpoint.

---

Nitpick comments:
In @.code-samples.meilisearch.yaml:
- Around line 1442-1446: The snippet key name list_dynamic_search_rules_1
conflicts with the POST action and comment post_dynamic_search_rules; rename the
key to reflect a POST/create operation (e.g., post_dynamic_search_rules_1 or
create_dynamic_search_rules_1) so the key matches the HTTP verb and comment, and
update any references to list_dynamic_search_rules_1 accordingly.
- Around line 1387-1393: Replace the ambiguous WORKSPACE_NAME placeholder with
WORKSPACE_UID for the workspaceUid routes so examples are accurate: update the
get_chat_workspace_1 and delete_chat_workspace_1 curl examples to use
'WORKSPACE_UID' in the URL (the route expects workspaceUid). Ensure both
occurrences (in the GET and DELETE examples) are changed to prevent copy-paste
errors.
- Around line 1457-1463: The example uses a hard-coded past date in the rule
"Black Friday 2025 rules" within the conditions time window (keys "start" and
"end"); update the time values to be non-past-proof by replacing the fixed
timestamps with either a template placeholder (e.g.,
"{{BLACK_FRIDAY_START}}"/"{{BLACK_FRIDAY_END}}") or generate them relative to
the current year (use current-year November 28T00:00:00Z and November
28T23:59:59Z) so the "conditions" time window remains valid going forward.

In `@snippets/generated-code-samples/code_samples_get_dynamic_search_rule_1.mdx`:
- Line 7: Add a trailing newline at the end of the file to comply with POSIX and
repository conventions; open the file
(snippets/generated-code-samples/code_samples_get_dynamic_search_rule_1.mdx),
move the cursor to the end after the closing </CodeGroup> tag and insert a
single newline character so the file ends with a blank line.
🪄 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: 7a9611b6-e16e-48d0-8b51-06d2a83dea02

📥 Commits

Reviewing files that changed from the base of the PR and between e67d2b7 and faf6399.

📒 Files selected for processing (25)
  • .code-samples.meilisearch.yaml
  • assets/open-api/meilisearch-openapi-mintlify.json
  • snippets/generated-code-samples/code_samples_chat_index_settings_1.mdx
  • snippets/generated-code-samples/code_samples_compact_task_queue_1.mdx
  • snippets/generated-code-samples/code_samples_delete_chat_workspace_1.mdx
  • snippets/generated-code-samples/code_samples_delete_dynamic_search_rule_1.mdx
  • snippets/generated-code-samples/code_samples_field_properties_guide_searchable_1.mdx
  • snippets/generated-code-samples/code_samples_get_chat_workspace_1.mdx
  • snippets/generated-code-samples/code_samples_get_dynamic_search_rule_1.mdx
  • snippets/generated-code-samples/code_samples_get_foreign_keys_setting_1.mdx
  • snippets/generated-code-samples/code_samples_get_task_documents_1.mdx
  • snippets/generated-code-samples/code_samples_index_settings_tutorial_api_get_setting_1.mdx
  • snippets/generated-code-samples/code_samples_index_settings_tutorial_api_put_setting_1.mdx
  • snippets/generated-code-samples/code_samples_index_settings_tutorial_api_task_1.mdx
  • snippets/generated-code-samples/code_samples_list_chat_workspaces_1.mdx
  • snippets/generated-code-samples/code_samples_list_dynamic_search_rules_1.mdx
  • snippets/generated-code-samples/code_samples_multi_search_remote_federated_1.mdx
  • snippets/generated-code-samples/code_samples_network_control_1.mdx
  • snippets/generated-code-samples/code_samples_patch_dynamic_search_rule_1.mdx
  • snippets/generated-code-samples/code_samples_post_chat_completion_1.mdx
  • snippets/generated-code-samples/code_samples_rename_an_index_1.mdx
  • snippets/generated-code-samples/code_samples_reset_chat_workspace_settings_1.mdx
  • snippets/generated-code-samples/code_samples_reset_foreign_keys_setting_1.mdx
  • snippets/generated-code-samples/code_samples_search_parameter_guide_show_ranking_score_details_1.mdx
  • snippets/generated-code-samples/code_samples_update_foreign_keys_setting_1.mdx
💤 Files with no reviewable changes (8)
  • snippets/generated-code-samples/code_samples_index_settings_tutorial_api_task_1.mdx
  • snippets/generated-code-samples/code_samples_index_settings_tutorial_api_get_setting_1.mdx
  • snippets/generated-code-samples/code_samples_rename_an_index_1.mdx
  • snippets/generated-code-samples/code_samples_chat_index_settings_1.mdx
  • snippets/generated-code-samples/code_samples_search_parameter_guide_show_ranking_score_details_1.mdx
  • snippets/generated-code-samples/code_samples_field_properties_guide_searchable_1.mdx
  • snippets/generated-code-samples/code_samples_index_settings_tutorial_api_put_setting_1.mdx
  • snippets/generated-code-samples/code_samples_multi_search_remote_federated_1.mdx

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