rubocop-graphql
rubocop-graphql copied to clipboard
GraphQL/ExtractInputType being thrown inside an input type object
Hey guys not sure if this is still maintained, for some reason running rubocop -a is throwing several GraphQL/ExtractInputType errors inside of an input type object
example of the error:
app/graphql/types/public/program_application_attributes.rb:11:7: C: GraphQL/ExtractInputType: Consider moving arguments to a new input type
argument :company_size, String, required: false, description: 'size of company ex. 11-50'
example of the file structure and class definition
# app/graphql/types/public/program_application_attributes.rb
module Types
module Public
class ProgramApplicationAttributes < Types::BaseInputObject
argument :company_size, String, required: false, description: 'size of company ex. 11-50'
do you guy have any idea how to fix the error without disabling the feature?
Hi @ab320012, could you please show me the whole ProgramApplicationAttributes
class?
Hey @DmitryTsepelev its what i sent over to you except with probably 12 arguments all strings with the same required flag
I guess the issue is that we should run this cop only for mutations. I'll mark it as bug, but the temporary fix should be something like this added to your .rubocop.yml
:
GraphQL/ExtractInputType:
Inclide:
- 'graphql/mutations/**/*.rb'
Please let me know if it helps!