graphql-ruby icon indicating copy to clipboard operation
graphql-ruby copied to clipboard

Missing field for mutation if returning interface with no implementations

Open goalaleo opened this issue 5 years ago • 1 comments
trafficstars

I had a mutation with an interface as the return type, but forgot to add the implements MyInterface declaration to any types. As a result, when I tried to call the mutation, I got back an error that there was no such field.

My bad for forgetting to add the declarations, but I wish that there would have been some kind of a warning or error instead of silently ignoring the mutation type

goalaleo avatar Jan 15 '20 15:01 goalaleo

Sorry for the nasty surprise! It's technically a feature -- we support dynamically hiding some parts of the schema, and as you noticed, when all of an interface's implementors are hidden, we hide that too.

Maybe some better approaches are:

  • When building a schema, if we find an interface with no implementations, give a warning
  • Build a verbose log (#2286) which outputs this information into the Rails terminal

rmosolgo avatar Jan 15 '20 15:01 rmosolgo

I haven't addressed this yet, but for paperwork purposes, I'm going to close this issue since it's covered by #2817

rmosolgo avatar Aug 07 '23 16:08 rmosolgo