Serialising an enum, and the case that was renamed

serialize on a pure enum stores the case name, and on a backed enum stores the value, which makes the two behave differently across a rename.

enum Direction { case Ascending; }
enum Status: string { case Active = 'active'; }

serialize(Direction::Ascending);
// E:20:"Direction:Ascending";   ← the NAME

serialize(Status::Active);
// E:13:"Status:Active";         ← also the name

// json_encode differs:
json_encode(Status::Active);      // "active"  — the value
json_encode(Direction::Ascending);
// Exception: Type is not supported

Native serialisation uses the case name for both, and JSON encoding uses the backing value and refuses a pure enum entirely — which is a sensible pair of decisions and means a rename is safe for one and breaking for the other. A pure enum reaching json_encode throws rather than producing something wrong, which is the good failure and is discovered the first time one appears in an API response.