Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#480 Automatic Coproduct Rename from/to Protobuf GeneratedEnum #489

Closed
wants to merge 1 commit into from

Conversation

saeltz
Copy link
Contributor

@saeltz saeltz commented Apr 1, 2024

I'm not entirely happy with the TransformedNamesComparison because it matches too broadly. I'm open for better suggestions.

I want to achieve a comparison for the following:

enum Field {
  FIELD_UNSPECIFIED = 0;
  FIELD_CASE_ONE = 1;
  FIELD_CASE_TWO = 2;
}

From/To

enum Field:
  case One, Two

Copy link

codecov bot commented Apr 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.20%. Comparing base (2df4291) to head (57d6c6f).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #489      +/-   ##
==========================================
+ Coverage   90.06%   90.20%   +0.13%     
==========================================
  Files         125      125              
  Lines        4763     4759       -4     
  Branches      430      412      -18     
==========================================
+ Hits         4290     4293       +3     
+ Misses        473      466       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@MateuszKubuszok MateuszKubuszok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the effort! I left a comment.

@@ -44,6 +44,16 @@ object TransformedNamesComparison {
def namesMatch(fromName: String, toName: String): Boolean = fromName.equalsIgnoreCase(toName)
}

case object GeneratedProtobufEnumEquality extends TransformedNamesComparison {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would either name it CamelCaseUnderscoreCaseEquality (to e.g. use this with Java enums as well, maybe it should be a default for it? Maybe it should be named JavaEnumAware?) or keep it in chimneyProtobuf module. I wouldn't put some integration-specific conventions in the core package.

@MateuszKubuszok
Copy link
Member

Hey @saeltz 👋 , do you still want to work on this?

@saeltz
Copy link
Contributor Author

saeltz commented Apr 29, 2024

Hey @MateuszKubuszok, this currently matches too broadly. For this special use case I would probably rather go for something like moia-oss/teleproto#326 by @lbialy.

@saeltz saeltz closed this Apr 29, 2024
@saeltz saeltz deleted the protobuf-rename branch April 29, 2024 19:41
@MateuszKubuszok
Copy link
Member

@saeltz - if you want to use Chimney in your macro-logic, with 1.1.0 it would be possible to just use Chimney macros directly. Please, open a discussion if you are interested in this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants