evolution-gaming / derivation

Configured derivation library for scala 3
MIT License
34 stars 6 forks source link

Allow changing case to one field only #2

Closed FunFunFine closed 2 years ago

FunFunFine commented 2 years ago

If someone would want to make only one field of product to be snake case, then they would need to copy paste it as in @Rename("snake_cased_field_name)" SnakeCasedFieldName. This PR makes that task easier by allowing to write @SnakeCase annotation directly near the field.

Also this PR adds kebab-case and PascalCase just to be kinda complete.

Also, as I didn't know the project was unformatted, this MR formats a bunch of files. If required, I can do it in a separate PR.

FunFunFine commented 2 years ago

Also question: should we add renamed fields from transformedFields to Config.ForProduct#fieldRenaming function? It has something to do with priority of those and stuff.

Odomontois commented 2 years ago

Also question: should we add renamed fields from transformedFields to Config.ForProduct#fieldRenaming function? It has something to do with priority of those and stuff.

Yeah, I suppose we need to refactor Config a little bit to a Map[String, FieldInfo]