CodingKeys: snake_case β†’ camelCase

Two naming worlds collide

The backend is Python, and Python names things in snake_case: photo_url, price_per_30min_cents. Swift names things in camelCase: photoURL, pricePer30MinCents. Neither side should bend β€” each should look idiomatic in its own language.

But by default, Codable matches property names to JSON keys character for character. So let photoURL: String? goes looking for a JSON key literally called photoURL β€” which isn't there. Because it's an optional, decoding doesn't even fail: photoURL just comes back nil, silently, and every walker photo in the app is blank. let pricePer30MinCents: Int is worse-but-honest: it's not optional, so decoding throws.

The fix: CodingKeys

You add a nested enum named CodingKeys inside the struct. It's a String raw-value enum β€” exactly the kind you built in Module 02 β€” that also conforms to CodingKey. Three rules:

  1. Once the enum exists, it's the complete list β€” only properties with a case get decoded, and every stored property needs one.
  2. A case without a raw value (case id) matches the JSON key with the same name.
  3. A case with one (case photoURL = "photo_url") remaps: Swift property name on the left, the exact JSON key in quotes on the right.