google / json_serializable.dart

Generates utilities to aid in serializing to/from JSON.
https://pub.dev/packages/json_serializable
BSD 3-Clause "New" or "Revised" License
1.54k stars 393 forks source link

[Feature Request] fieldRename support for Records #1354

Open livtanong opened 10 months ago

livtanong commented 10 months ago

Hi, as mentioned in this comment(https://github.com/google/json_serializable.dart/issues/1222#issuecomment-1594876611), I'd appreciate it if there were some way to add fieldRename for Records.

I'm making this separate issue because I have a feeling it has been overlooked because it's on a closed issue.

I figure the intuitive way for this to work would be for JsonSerializable(fieldRename: __) to apply recursively to all records under a class, with the option for a JsonKey argument to override this behavior.

That said, if this is something that for some reason or another will not be supported, it would still be useful to have official word on this issue, and guidelines on what should be done instead.