fix: add missing Action enum variants#752
Conversation
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🔇 Additional comments (7)
✏️ Tip: You can disable this entire section by setting 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/key.rs`:
- Around line 784-819: Remove the invalid FieldsPost enum variant from the
permission enum in src/key.rs: delete the variant definition (#[serde(rename =
"fields.post")] FieldsPost) and any associated doc comment, leaving the
surrounding chat/webhook variants unchanged; then search the codebase for any
references to FieldsPost (e.g., pattern matches, tests, serialization
expectations) and remove or update them to use the correct existing
permission(s); run cargo build/tests to ensure no remaining references.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/key.rs
🔇 Additional comments (6)
src/key.rs (6)
659-667: LGTM! Critical fix for issue#746.The
AllGetvariant with"*.get"rename directly addresses the deserialization failure when reading keys with the "Default Read-Only Admin API Key". TheDocumentsAllwildcard variant properly complements the existing granular document actions.
677-697: LGTM!The
IndexesAll,IndexesSwap, andIndexesCompactvariants properly extend the indexes action coverage with correct serde renames.
698-742: LGTM!The task, settings, stats, metrics, dumps, and snapshots variants follow a consistent naming pattern with correct serde renames. The wildcard variants (
*Allwith"resource.*") and specific action variants complement the existing granular actions.
766-780: LGTM!The experimental features, export, and network configuration actions properly cover newer Meilisearch API endpoints with correct serde renames.
820-824: LGTM! Forward compatibility preserved.The
Unknown(String)variant with#[serde(untagged)]is correctly positioned as the last variant. This ensures serde will fall through to it for any action strings not yet supported by the SDK, preventing deserialization failures for future Meilisearch versions.
747-765: Breaking change is well-documented in code; no external changelog found.The
Key*→Keys*renames are complete and clean—no references to the old variant names remain in the codebase. The doc comments noting "This was previously namedKeyGetin older SDK versions" provide clear migration guidance for users encountering compile errors.However, there is no
CHANGELOGfile in the repository to verify external documentation of this breaking change. The in-code migration notes are sufficient for developers using the SDK, though users upgrading from earlier versions will rely on the doc comments and release notes generated from.github/release-draft-template.ymlto understand the impact.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
This PR adds all missing Action enum variants that exist in Meilisearch v1.22.2: - AllGet (*.get) - used by Default Read-Only Admin API Key - DocumentsAll (documents.*) - IndexesAll (indexes.*) - IndexesSwap (indexes.swap) - IndexesCompact (indexes.compact) - TasksAll (tasks.*) - TasksCancel (tasks.cancel) - TasksDelete (tasks.delete) - SettingsAll (settings.*) - StatsAll (stats.*) - MetricsAll (metrics.*) - MetricsGet (metrics.get) - DumpsAll (dumps.*) - SnapshotsAll (snapshots.*) - SnapshotsCreate (snapshots.create) - ExperimentalFeaturesGet (experimental.get) - ExperimentalFeaturesUpdate (experimental.update) - Export (export) - NetworkGet (network.get) - NetworkUpdate (network.update) - ChatsAll (chats.*) - ChatsGet (chats.get) - ChatsDelete (chats.delete) - ChatsSettingsAll (chatsSettings.*) - ChatsSettingsGet (chatsSettings.get) - ChatsSettingsUpdate (chatsSettings.update) - WebhooksAll (webhooks.*) - WebhooksGet (webhooks.get) - WebhooksCreate (webhooks.create) - WebhooksUpdate (webhooks.update) - WebhooksDelete (webhooks.delete) - FieldsPost (fields.post) Breaking changes: - Renamed KeyGet -> KeysGet - Renamed KeyCreate -> KeysCreate - Renamed KeyUpdate -> KeysUpdate - Renamed KeyDelete -> KeysDelete - Removed DumpsGet (does not exist in Meilisearch) Fixes meilisearch#746
The fields.post action does not exist in Meilisearch server. This variant was incorrectly added and would cause issues if used.
2501475 to
1f1fc24
Compare
Summary
This PR adds all missing Action enum variants that exist in Meilisearch server (v1.22.2+), fixing the issue where the SDK fails to deserialize keys that use newer actions like *.get.
Problem
As reported in #746, the SDK fails when reading keys because many Action enum values are missing, especially:
This caused errors like:
\
unknown variant *.get, expected one of *, \search, ...
\\
Changes
New Actions Added
Breaking Changes
The following variants were renamed to match the Meilisearch server naming convention:
Removed
Fixes
Fixes #746
Summary by CodeRabbit
New Features
Breaking Changes
✏️ Tip: You can customize this high-level summary in your review settings.