# frozen_string_literal: truemoduleGraphQLclassSchema# Subclasses of this can influence how {GraphQL::Execution::Interpreter} runs queries.## - {.include?}: if it returns `false`, the field or fragment will be skipped altogether, as if it were absent# - {.resolve}: Wraps field resolution (so it should call `yield` to continue)classDirective<GraphQL::Schema::MemberextendGraphQL::Schema::Member::HasArgumentsclass<<self# Return a name based on the class name,# but downcase the first letter.defdefault_graphql_name@default_graphql_name||=begincamelized_name=supercamelized_name[0]=camelized_name[0].downcasecamelized_nameendenddeflocations(*new_locations)ifnew_locations.any?@locations=new_locationselse@locations||=(superclass.respond_to?(:locations)?superclass.locations:[])endenddefdefault_directive(new_default_directive=nil)ifnew_default_directive!=nil@default_directive=new_default_directiveelsif@default_directive.nil?@default_directive=(superclass.respond_to?(:default_directive)?superclass.default_directive:false)else!!@default_directiveendenddefdefault_directive?default_directiveenddefto_graphqldefn=GraphQL::Directive.newdefn.name=self.graphql_namedefn.description=self.descriptiondefn.locations=self.locationsdefn.default_directive=self.default_directivedefn.ast_node=ast_nodedefn.metadata[:type_class]=selfarguments.eachdo|name,arg_defn|arg_graphql=arg_defn.to_graphqldefn.arguments[arg_graphql.name]=arg_graphqlend# Make a reference to a classic-style Arguments classdefn.arguments_class=GraphQL::Query::Arguments.construct_arguments_class(defn)defnend# If false, this part of the query won't be evaluateddefinclude?(_object,_arguments,_context)trueend# Continuing is passed as a block; `yield` to continuedefresolve(object,arguments,context)yieldenddefon_field?locations.include?(FIELD)enddefon_fragment?locations.include?(FRAGMENT_SPREAD)&&locations.include?(INLINE_FRAGMENT)enddefon_operation?locations.include?(QUERY)&&locations.include?(MUTATION)&&locations.include?(SUBSCRIPTION)endendLOCATIONS=[QUERY=:QUERY,MUTATION=:MUTATION,SUBSCRIPTION=:SUBSCRIPTION,FIELD=:FIELD,FRAGMENT_DEFINITION=:FRAGMENT_DEFINITION,FRAGMENT_SPREAD=:FRAGMENT_SPREAD,INLINE_FRAGMENT=:INLINE_FRAGMENT,SCHEMA=:SCHEMA,SCALAR=:SCALAR,OBJECT=:OBJECT,FIELD_DEFINITION=:FIELD_DEFINITION,ARGUMENT_DEFINITION=:ARGUMENT_DEFINITION,INTERFACE=:INTERFACE,UNION=:UNION,ENUM=:ENUM,ENUM_VALUE=:ENUM_VALUE,INPUT_OBJECT=:INPUT_OBJECT,INPUT_FIELD_DEFINITION=:INPUT_FIELD_DEFINITION,]DEFAULT_DEPRECATION_REASON='No longer supported'LOCATION_DESCRIPTIONS={QUERY:'Location adjacent to a query operation.',MUTATION:'Location adjacent to a mutation operation.',SUBSCRIPTION:'Location adjacent to a subscription operation.',FIELD:'Location adjacent to a field.',FRAGMENT_DEFINITION:'Location adjacent to a fragment definition.',FRAGMENT_SPREAD:'Location adjacent to a fragment spread.',INLINE_FRAGMENT:'Location adjacent to an inline fragment.',SCHEMA:'Location adjacent to a schema definition.',SCALAR:'Location adjacent to a scalar definition.',OBJECT:'Location adjacent to an object type definition.',FIELD_DEFINITION:'Location adjacent to a field definition.',ARGUMENT_DEFINITION:'Location adjacent to an argument definition.',INTERFACE:'Location adjacent to an interface definition.',UNION:'Location adjacent to a union definition.',ENUM:'Location adjacent to an enum definition.',ENUM_VALUE:'Location adjacent to an enum value definition.',INPUT_OBJECT:'Location adjacent to an input object type definition.',INPUT_FIELD_DEFINITION:'Location adjacent to an input object field definition.',}endendend