DmitryTsepelev / rubocop-graphql

Rubocop extension for enforcing graphql-ruby best practices
MIT License
226 stars 50 forks source link

False positives with GraphQL/FieldUniqueness and the camelize option #147

Closed severin closed 10 months ago

severin commented 11 months ago

For legacy compatibility we have some fields on some types defined with different spelling, i.e. the first name field can be referenced as firstName but also as first_name.

In code this looks like:

field :first_name, String

field :first_name, String, camelize: false

rubocop-graphql currently detects this as duplicate field definition which is not really correct since it actually results in two different fields.

I guess the issue is similar to #83 and a solution would be to consider the camelize option when checking for duplication.

I did throw together a quick fix for this but I have no previous experience with rubocop and/or rubocop-ast so the code is ugly and needs some love before it could be merged.

I'll happily open a PR and invest some time in polishing if you think that this is an issue worth fixing.