Something went wrong

Thank you for being patient! We're working hard on resolving the issue

Params deserialization - Lona Docs Log in

Params deserialization

Rowkey patterns use camelCase segments; Rust types use snake_case fields. Bridge the two with #[serde(rename = "...")]:

#[derive(Deserialize, Clone, Debug)]
pub struct GarminParams {
  #[serde(rename = "authId")]
  pub auth_id: String,
}

Multi-segment paths repeat the pattern:

#[derive(Deserialize, Clone, Debug)]
pub struct GoogleCalendarParams {
  #[serde(rename = "authId")]
  pub auth_id: String,
  #[serde(rename = "calId")]
  pub cal_id: String,
}

When a segment had a legacy short name, allow both with alias:

#[derive(Deserialize, Clone, Debug)]
pub struct WeatherParams {
  #[serde(rename = "locationId", alias = "lid")]
  pub location_id: String,
}

Why explicit rename

The connector's blanket FromHandlerParams impl over serde::de::DeserializeOwned decodes a JSON object whose keys match the rowkey-pattern parameter names. The pattern parser preserves the original case ({authId} → key "authId"), so the serde-rename hop maps it onto your snake_case Rust field.

Without rename, the field would have to be named authId — which conflicts with idiomatic Rust style — or the rowkey would have to use snake_case segments — which conflicts with URL/JS-style camelCase that the rest of the surface uses.

Unit params

Many Row impls have no per-row params (just the integration's):

impl Row for Sleep {
  type Integration = Garmin;
  type Params = ();      // no per-row params
  // …
}

The blanket FromHandlerParams impl handles () correctly — your Row::lookup_key body still receives the integration's params, and the second argument is &().

What to put in Params vs Integration::Params

  • Integration::Params is the path prefix that's stable across all rows under that integration: e.g. {authId} for Garmin, {authId, calId} for Google Calendar.
  • Row::Params is anything further that varies per row beyond the integration prefix. E.g. a hypothetical :~strava:{authId}:activity:{activityId} would put {activityId} in Row::Params.

In practice today every Row::Params is () because rowkeys flatten cleanly into the integration prefix. Use Row::Params only when you genuinely need it.