-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
Migrate redisctl human-friendly commands to use our typed API client libraries instead of raw JSON. This will help us dogfood our own libraries and discover improvements.
Motivation
- Dogfooding: Using our own libraries will help us find issues and improve them
- Type Safety: Catch errors at compile time rather than runtime
- Better Error Messages: Typed errors are more informative than JSON parsing errors
- Field Validation: Discover fields that should be Optional, missing derives, etc.
Implementation Strategy
Keep Raw for API Commands
// redisctl cloud api GET /subscriptions/123/databases
// These continue using raw JSON passthrough for maximum compatibility
client.get_raw("/subscriptions/123/databases").await?Use Typed for Human Commands
// redisctl cloud database list
// These use typed APIs for better validation
let databases = client.database().list(subscription_id).await?;
let value = serde_json::to_value(databases)?; // Convert for outputBenefits We'll Discover
- Missing Optional fields - Fields that can be null but aren't marked as
Option<T> - Missing derives - Debug, Clone, Default, etc.
- API ergonomics - Methods that would make the API easier to use
- Validation gaps - Places where we should validate input
- Documentation needs - Missing or unclear documentation
Migration Checklist
Cloud Commands to Migrate
-
database list- List databases -
database get- Get database details -
subscription list- List subscriptions -
subscription get- Get subscription details -
user list- List users -
backup list- List backups
Enterprise Commands to Migrate
-
database list- List databases (bdbs) -
database get- Get database details -
cluster info- Get cluster information -
node list- List nodes -
user list- List users -
alert list- List alerts
Handler Updates Needed
- Add
.to_value()or similar methods to convert typed responses to JSON Value - Ensure all handlers return consistent types
- Add proper error context when conversions fail
Success Criteria
- Commands using typed APIs have better error messages
- We identify at least 5 improvements to make to the libraries
- Performance impact is negligible (per our benchmarks)
- All tests continue to pass
Notes
Per our benchmarks (#23), the performance difference is negligible for typical API responses, so we're not sacrificing performance for type safety.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request