Open danlo opened 2 months ago
Hey, thanks for the suggestion. I'm open to it, it looks like DidYouMean has a handy direct-use API: https://github.com/ruby/did_you_mean?tab=readme-ov-file#using-the-didyoumeanspellchecker
Want to give it a shot? Here's where the "field doesn't exist on type" error is created: https://github.com/rmosolgo/graphql-ruby/blob/4e241f87bdac4748bcd0c593b47c6e9c722c4644/lib/graphql/static_validation/rules/fields_are_defined_on_type.rb#L17-L21
You can get the options for field names using:
visible_fields = context.warden.fields(parent_type) # filter out any hidden fields
possible_field_names = visible_fields.map(&:graphql_names)
I expect that plenty of existing tests will fail -- and pass after they're updated to contain "did you mean ..." ✨
Let me know what you think!
Is your feature request related to a problem? Please describe.
I'm constantly caught between switching between camelCase and snake_case as addressed in these previous issues:
Describe the solution you'd like
if content comes in snake_case then displaying a warning "did you mean..." snakeCase would be great. #4563
Describe alternatives you've considered
none.
Additional context
I know this is re-opening a previous issue, however, I think enough programmers screw up often enough that a few minutes from everyone's time adds up to be a lot of time.
Would you please reconsider working on #4563 as this would save many people a little bit of time and greatly improve progarmmer expierence.
Regards,
-daniel