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

matchIgnoreCase for enum members #158

Open
sublee opened this issue Aug 12, 2024 · 0 comments
Open

matchIgnoreCase for enum members #158

sublee opened this issue Aug 12, 2024 · 0 comments
Labels
feature New feature or request

Comments

@sublee
Copy link
Contributor

sublee commented Aug 12, 2024

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

In Go, acronyms should be all capitals. But some codegen does not respect this rule. For example, protoc-gen-go generates ParentId rather than ParentID from parent_id. matchIgnoreCase is useful for mapping struct fields regardless of the case of names. But the problem occurs on enum members also, not only struct fields. Currently, matchIgnoreCase is not allowed on enum type converters.

// goverter:enum:unknown METHOD_UNSPECIFIED
// goverter:matchIgnoreCase
ConvertMethod func(Method) pb.Method
Invalid struct field mapping on method:
    /.../example.go:25
    var ConvertMethod func(Method) pb.Method

Field mappings like goverter:map or goverter:ignore may only be set on struct or struct pointers.
See https://goverter.jmattheis.de/guide/configure-nested
exit status 1
...: running "go": exit status 1

Describe the solution you'd like
A clear and concise description of what you want to happen.

Extending matchIgnoreCase to support both struct fields and enum members. As discussed in #157, this modification does not look like violating the existing design decision.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

N/A

@sublee sublee changed the title matchIgnoreCase for enums matchIgnoreCase for enum members Aug 12, 2024
@jmattheis jmattheis added the feature New feature or request label Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants