rubocop: GraphQL/OrderedArguments

autocorrected

Change-Id: Id3a8707ab6fd1ba9a9e8f26ea9940a3bd8137272
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/358319
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2024-09-24 10:41:41 -06:00
parent 782f4381c3
commit 95878ca8cb
45 changed files with 150 additions and 152 deletions

View File

@ -227,8 +227,6 @@ GraphQL/FieldName:
AutoCorrect: false
GraphQL/MultipleFieldDefinitions:
AutoCorrect: false
GraphQL/OrderedArguments:
AutoCorrect: false
GraphQL/OrderedFields:
AutoCorrect: false
GraphQL/UnusedArgument:

View File

@ -23,14 +23,14 @@ class Mutations::AddConversationMessage < Mutations::BaseMutation
include ConversationsHelper
argument :conversation_id, ID, required: true, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Conversation")
argument :body, String, required: true
argument :recipients, [String], required: true
argument :included_messages, [ID], required: false, prepare: GraphQLHelpers.relay_or_legacy_ids_prepare_func("ConversationMessage")
argument :attachment_ids, [ID], required: false, prepare: GraphQLHelpers.relay_or_legacy_ids_prepare_func("Attachment")
argument :body, String, required: true
argument :context_code, String, required: false
argument :conversation_id, ID, required: true, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Conversation")
argument :included_messages, [ID], required: false, prepare: GraphQLHelpers.relay_or_legacy_ids_prepare_func("ConversationMessage")
argument :media_comment_id, ID, required: false
argument :media_comment_type, String, required: false
argument :context_code, String, required: false
argument :recipients, [String], required: true
field :conversation_message, Types::ConversationMessageType, null: true

View File

@ -21,36 +21,36 @@
module Mutations::AssignmentBase; end
class Mutations::AssignmentBase::AssignmentOverrideCreateOrUpdate < GraphQL::Schema::InputObject
argument :id, ID, required: false
argument :due_at, Types::DateTimeType, required: false
argument :id, ID, required: false
argument :lock_at, Types::DateTimeType, required: false
argument :unlock_at, Types::DateTimeType, required: false
argument :unassign_item, Boolean, required: false
argument :unlock_at, Types::DateTimeType, required: false
argument :course_id, ID, required: false
argument :course_section_id, ID, required: false
argument :group_id, ID, required: false
argument :student_ids, [ID], required: false
argument :noop_id, ID, required: false
argument :student_ids, [ID], required: false
argument :title, String, required: false
end
class Mutations::AssignmentBase::AssignmentModeratedGradingUpdate < GraphQL::Schema::InputObject
argument :enabled, Boolean, required: false
argument :grader_count, Int, required: false
argument :final_grader_id, ID, required: false
argument :grader_comments_visible_to_graders, Boolean, required: false
argument :grader_count, Int, required: false
argument :grader_names_visible_to_final_grader, Boolean, required: false
argument :graders_anonymous_to_graders, Boolean, required: false
argument :final_grader_id, ID, required: false
end
class Mutations::AssignmentBase::AssignmentPeerReviewsUpdate < GraphQL::Schema::InputObject
argument :enabled, Boolean, required: false
argument :count, Int, required: false
argument :due_at, Types::DateTimeType, required: false
argument :intra_reviews, Boolean, required: false
argument :anonymous_reviews, Boolean, required: false
argument :automatic_reviews, Boolean, required: false
argument :count, Int, required: false
argument :due_at, Types::DateTimeType, required: false
argument :enabled, Boolean, required: false
argument :intra_reviews, Boolean, required: false
end
class Mutations::AssignmentBase::AssignmentInputBase < GraphQL::Schema::InputObject
@ -58,6 +58,7 @@ class Mutations::AssignmentBase::AssignmentInputBase < GraphQL::Schema::InputObj
argument :assignment_group_id, ID, required: false
argument :assignment_overrides, [Mutations::AssignmentBase::AssignmentOverrideCreateOrUpdate], required: false
argument :due_at, Types::DateTimeType, required: false
argument :for_checkpoints, Boolean, required: false
argument :grading_standard_id, ID, required: false
argument :grading_type, Types::AssignmentType::AssignmentGradingType, required: false
argument :group_category_id, ID, required: false
@ -69,7 +70,6 @@ class Mutations::AssignmentBase::AssignmentInputBase < GraphQL::Schema::InputObj
argument :points_possible, Float, required: false
argument :post_to_sis, Boolean, required: false
argument :unlock_at, Types::DateTimeType, required: false
argument :for_checkpoints, Boolean, required: false
end
class Mutations::AssignmentBase::AssignmentCreate < Mutations::AssignmentBase::AssignmentInputBase
@ -129,35 +129,35 @@ class Mutations::AssignmentBase::Mutation < Mutations::BaseMutation
end
# input arguments
argument :state, Types::AssignmentType::AssignmentStateType, required: false
argument :due_at, Types::DateTimeType, required: false
argument :lock_at, Types::DateTimeType, required: false
argument :unlock_at, Types::DateTimeType, required: false
argument :description, String, required: false
argument :assignment_overrides, [Mutations::AssignmentBase::AssignmentOverrideCreateOrUpdate], required: false
argument :position, Int, required: false
argument :points_possible, Float, required: false
argument :grading_type, Types::AssignmentType::AssignmentGradingType, required: false
argument :allowed_extensions, [String], required: false
argument :assignment_group_id, ID, required: false
argument :group_set_id, ID, required: false
argument :allowed_attempts, Int, required: false
argument :only_visible_to_overrides, Boolean, required: false
argument :submission_types, [Types::AssignmentSubmissionType], required: false
argument :grading_standard_id, ID, required: false
argument :peer_reviews, Mutations::AssignmentBase::AssignmentPeerReviewsUpdate, required: false
argument :moderated_grading, Mutations::AssignmentBase::AssignmentModeratedGradingUpdate, required: false
argument :grade_group_students_individually, Boolean, required: false
argument :group_category_id, ID, required: false
argument :omit_from_final_grade, Boolean, required: false
argument :anonymous_instructor_annotations, Boolean, required: false
argument :post_to_sis, Boolean, required: false
argument :allowed_extensions, [String], required: false
argument :anonymous_grading,
Boolean,
"requires anonymous_marking course feature to be set to true",
required: false
argument :module_ids, [ID], required: false
argument :anonymous_instructor_annotations, Boolean, required: false
argument :assignment_group_id, ID, required: false
argument :assignment_overrides, [Mutations::AssignmentBase::AssignmentOverrideCreateOrUpdate], required: false
argument :description, String, required: false
argument :due_at, Types::DateTimeType, required: false
argument :for_checkpoints, Boolean, required: false
argument :grade_group_students_individually, Boolean, required: false
argument :grading_standard_id, ID, required: false
argument :grading_type, Types::AssignmentType::AssignmentGradingType, required: false
argument :group_category_id, ID, required: false
argument :group_set_id, ID, required: false
argument :lock_at, Types::DateTimeType, required: false
argument :moderated_grading, Mutations::AssignmentBase::AssignmentModeratedGradingUpdate, required: false
argument :module_ids, [ID], required: false
argument :omit_from_final_grade, Boolean, required: false
argument :only_visible_to_overrides, Boolean, required: false
argument :peer_reviews, Mutations::AssignmentBase::AssignmentPeerReviewsUpdate, required: false
argument :points_possible, Float, required: false
argument :position, Int, required: false
argument :post_to_sis, Boolean, required: false
argument :state, Types::AssignmentType::AssignmentStateType, required: false
argument :submission_types, [Types::AssignmentSubmissionType], required: false
argument :unlock_at, Types::DateTimeType, required: false
# the return data if the update is successful
field :assignment, Types::AssignmentType, null: true

View File

@ -21,14 +21,14 @@
module Mutations
class BaseLearningOutcomeMutation < BaseMutation
# input arguments
argument :title, String, required: true
argument :calculation_int, Integer, required: false
argument :calculation_method, String, required: false
argument :description, String, required: false
argument :display_name, String, required: false
argument :vendor_guid, String, required: false
argument :calculation_method, String, required: false
argument :calculation_int, Integer, required: false
argument :mastery_points, Float, required: false
argument :ratings, [Types::ProficiencyRatingInputType], required: false
argument :title, String, required: true
argument :vendor_guid, String, required: false
field :learning_outcome, Types::LearningOutcomeType, null: true

View File

@ -21,8 +21,8 @@
class Mutations::CreateCommentBankItem < Mutations::BaseMutation
graphql_name "CreateCommentBankItem"
argument :course_id, ID, required: true, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Course")
argument :comment, String, required: true
argument :course_id, ID, required: true, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Course")
field :comment_bank_item, Types::CommentBankItemType, null: true
def resolve(input:)

View File

@ -23,17 +23,17 @@ class Mutations::CreateConversation < Mutations::BaseMutation
include ConversationsHelper
argument :recipients, [String], required: true
argument :subject, String, required: false
argument :attachment_ids, [ID], required: false, prepare: GraphQLHelpers.relay_or_legacy_ids_prepare_func("Attachment")
argument :body, String, required: true
argument :bulk_message, Boolean, required: false
argument :force_new, Boolean, required: false
argument :group_conversation, Boolean, required: false
argument :attachment_ids, [ID], required: false, prepare: GraphQLHelpers.relay_or_legacy_ids_prepare_func("Attachment")
argument :media_comment_id, ID, required: false
argument :media_comment_type, String, required: false
argument :context_code, String, required: false
argument :conversation_id, ID, required: false, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Conversation")
argument :force_new, Boolean, required: false
argument :group_conversation, Boolean, required: false
argument :media_comment_id, ID, required: false
argument :media_comment_type, String, required: false
argument :recipients, [String], required: true
argument :subject, String, required: false
argument :tags, [String], required: false
field :conversations, [Types::ConversationParticipantType], null: true

View File

@ -22,9 +22,9 @@ class Mutations::CreateDiscussionEntry < Mutations::BaseMutation
graphql_name "CreateDiscussionEntry"
argument :discussion_topic_id, ID, required: true, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("DiscussionTopic")
argument :file_id, ID, required: false, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Attachment")
argument :message, String, required: true
argument :parent_entry_id, ID, required: false, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("DiscussionEntry")
argument :file_id, ID, required: false, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Attachment")
argument :is_anonymous_author, Boolean, required: false
argument :quoted_entry_id, ID, required: false, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("DiscussionEntry")

View File

@ -21,23 +21,23 @@
class Mutations::CreateDiscussionEntryDraft < Mutations::BaseMutation
graphql_name "CreateDiscussionEntryDraft"
argument :discussion_topic_id,
ID,
required: true,
prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("DiscussionTopic")
argument :discussion_entry_id,
ID,
required: false,
prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("DiscussionEntry")
argument :parent_id,
argument :discussion_topic_id,
ID,
required: false,
prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("DiscussionEntry")
required: true,
prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("DiscussionTopic")
argument :file_id,
ID,
required: false,
prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Attachment")
argument :message, String, required: true
argument :parent_id,
ID,
required: false,
prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("DiscussionEntry")
field :discussion_entry_draft, Types::DiscussionEntryDraftType, null: true

View File

@ -31,13 +31,13 @@ class Mutations::CreateDiscussionTopic < Mutations::DiscussionBase
graphql_name "CreateDiscussionTopic"
argument :anonymous_state, Types::DiscussionTopicAnonymousStateType, required: false
argument :assignment, Mutations::AssignmentBase::AssignmentCreate, required: false
argument :context_id, GraphQL::Schema::Object::ID, required: true, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Context")
argument :context_type, Types::DiscussionTopicContextType, required: true
argument :discussion_type, Types::DiscussionTopicDiscussionType, required: false
argument :is_announcement, Boolean, required: false
argument :is_anonymous_author, Boolean, required: false
argument :anonymous_state, Types::DiscussionTopicAnonymousStateType, required: false
argument :context_id, GraphQL::Schema::Object::ID, required: true, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Context")
argument :context_type, Types::DiscussionTopicContextType, required: true
argument :assignment, Mutations::AssignmentBase::AssignmentCreate, required: false
argument :ungraded_discussion_overrides, [Mutations::AssignmentBase::AssignmentOverrideCreateOrUpdate], required: false
# most arguments inherited from DiscussionBase

View File

@ -21,8 +21,8 @@
class Mutations::CreateGroupInSet < Mutations::BaseMutation
graphql_name "CreateGroupInSet"
argument :name, String, required: true
argument :group_set_id, ID, required: true, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("GroupSet")
argument :name, String, required: true
field :group, Types::GroupType, null: true

View File

@ -21,9 +21,9 @@
class Mutations::CreateLearningOutcomeGroup < Mutations::BaseMutation
graphql_name "CreateLearningOutcomeGroup"
argument :description, String, required: false
argument :id, ID, required: true, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("LearningOutcomeGroup")
argument :title, String, required: true
argument :description, String, required: false
argument :vendor_guid, String, required: false
field :learning_outcome_group, Types::LearningOutcomeGroupType, null: true

View File

@ -21,8 +21,8 @@
class Mutations::CreateModule < Mutations::BaseMutation
graphql_name "CreateModule"
argument :name, String, required: true
argument :course_id, ID, required: true, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Course")
argument :name, String, required: true
field :module, Types::ModuleType, null: true, resolver_method: :will_not_be_called
def will_not_be_called

View File

@ -24,10 +24,10 @@ class Mutations::CreateOutcomeCalculationMethod < Mutations::OutcomeCalculationM
graphql_name "CreateOutcomeCalculationMethod"
# input arguments
argument :context_type, String, required: true
argument :context_id, ID, required: true
argument :calculation_method, String, required: true
argument :calculation_int, Integer, required: false
argument :calculation_method, String, required: true
argument :context_id, ID, required: true
argument :context_type, String, required: true
VALID_CONTEXTS = %w[Account Course].freeze

View File

@ -24,8 +24,8 @@ class Mutations::CreateOutcomeProficiency < Mutations::OutcomeProficiencyBase
graphql_name "CreateOutcomeProficiency"
# input arguments
argument :context_type, String, required: true
argument :context_id, ID, required: true
argument :context_type, String, required: true
argument :proficiency_ratings, [Mutations::OutcomeProficiencyRatingCreate], required: true
VALID_CONTEXTS = %w[Account Course].freeze

View File

@ -54,9 +54,9 @@ class Mutations::CreateSubmission < Mutations::BaseMutation
prepare: GraphQLHelpers.relay_or_legacy_ids_prepare_func("Attachment")
argument :media_id, ID, required: false
argument :resource_link_lookup_uuid, String, required: false
argument :student_id, ID, required: false
argument :submission_type, Types::OnlineSubmissionType, required: true
argument :url, String, required: false
argument :student_id, ID, required: false
field :submission, Types::SubmissionType, null: true

View File

@ -23,6 +23,7 @@ class Mutations::CreateSubmissionComment < Mutations::BaseMutation
argument :attempt, Integer, required: false
argument :comment, String, required: true
argument :draft_comment, Boolean, required: false, default_value: false
argument :file_ids, [ID], required: false, prepare: GraphQLHelpers.relay_or_legacy_ids_prepare_func("Attachment")
argument :group_comment,
Boolean,
@ -33,7 +34,6 @@ class Mutations::CreateSubmissionComment < Mutations::BaseMutation
argument :media_object_type, String, required: false
argument :reviewer_submission_id, ID, required: false, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Submission")
argument :submission_id, ID, required: true, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Submission")
argument :draft_comment, Boolean, required: false, default_value: false
field :submission_comment, Types::SubmissionCommentType, null: true

View File

@ -42,14 +42,14 @@ class Types::DiscussionCheckpointDateSetType < Types::BaseEnum
end
class Mutations::DiscussionCheckpointDate < GraphQL::Schema::InputObject
argument :id, Integer, required: false
argument :type, Types::DiscussionCheckpointDateType, required: true
argument :due_at, Types::DateTimeType, required: false
argument :id, Integer, required: false
argument :lock_at, Types::DateTimeType, required: false
argument :unlock_at, Types::DateTimeType, required: false
argument :student_ids, [Integer], required: false
argument :set_type, Types::DiscussionCheckpointDateSetType, required: false
argument :set_id, Integer, required: false
argument :set_type, Types::DiscussionCheckpointDateSetType, required: false
argument :student_ids, [Integer], required: false
argument :type, Types::DiscussionCheckpointDateType, required: true
argument :unlock_at, Types::DateTimeType, required: false
def to_object
{
@ -74,22 +74,22 @@ end
class Mutations::DiscussionBase < Mutations::BaseMutation
argument :allow_rating, Boolean, required: false
argument :checkpoints, [Mutations::DiscussionCheckpoints], required: false
argument :delayed_post_at, Types::DateTimeType, required: false
argument :file_id, ID, required: false, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Attachment")
argument :group_category_id, ID, required: false
argument :lock_at, Types::DateTimeType, required: false
argument :locked, Boolean, required: false
argument :message, String, required: false
argument :only_graders_can_rate, Boolean, required: false
argument :only_visible_to_overrides, Boolean, required: false
argument :published, Boolean, required: false
argument :require_initial_post, Boolean, required: false
argument :title, String, required: false
argument :todo_date, Types::DateTimeType, required: false
argument :podcast_enabled, Boolean, required: false
argument :podcast_has_student_posts, Boolean, required: false
argument :published, Boolean, required: false
argument :require_initial_post, Boolean, required: false
argument :specific_sections, String, required: false
argument :file_id, ID, required: false, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Attachment")
argument :checkpoints, [Mutations::DiscussionCheckpoints], required: false
argument :title, String, required: false
argument :todo_date, Types::DateTimeType, required: false
field :discussion_topic, Types::DiscussionType, null:

View File

@ -22,8 +22,8 @@ class Mutations::HideAssignmentGrades < Mutations::BaseMutation
graphql_name "HideAssignmentGrades"
argument :assignment_id, ID, required: true, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Assignment")
argument :section_ids, [ID], required: false, prepare: GraphQLHelpers.relay_or_legacy_ids_prepare_func("Section")
argument :only_student_ids, [ID], required: false, prepare: GraphQLHelpers.relay_or_legacy_ids_prepare_func("User")
argument :section_ids, [ID], required: false, prepare: GraphQLHelpers.relay_or_legacy_ids_prepare_func("Section")
argument :skip_student_ids, [ID], required: false, prepare: GraphQLHelpers.relay_or_legacy_ids_prepare_func("User")
field :assignment, Types::AssignmentType, null: true

View File

@ -26,9 +26,9 @@ class Mutations::ImportOutcomes < Mutations::BaseMutation
argument :source_context_id, ID, required: false
argument :source_context_type, String, required: false
# after Remove target_context attributes, the target_group_id should be required
argument :target_group_id, ID, required: false, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("LearningOutcomeGroup")
argument :target_context_id, ID, required: false
argument :target_context_type, String, required: false
argument :target_group_id, ID, required: false, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("LearningOutcomeGroup")
field :progress, Types::ProgressType, null: true

View File

@ -22,10 +22,10 @@ class Mutations::PostAssignmentGrades < Mutations::BaseMutation
graphql_name "PostAssignmentGrades"
argument :assignment_id, ID, required: true, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Assignment")
argument :section_ids, [ID], required: false, prepare: GraphQLHelpers.relay_or_legacy_ids_prepare_func("Section")
argument :only_student_ids, [ID], required: false, prepare: GraphQLHelpers.relay_or_legacy_ids_prepare_func("User")
argument :skip_student_ids, [ID], required: false, prepare: GraphQLHelpers.relay_or_legacy_ids_prepare_func("User")
argument :graded_only, Boolean, required: false
argument :only_student_ids, [ID], required: false, prepare: GraphQLHelpers.relay_or_legacy_ids_prepare_func("User")
argument :section_ids, [ID], required: false, prepare: GraphQLHelpers.relay_or_legacy_ids_prepare_func("Section")
argument :skip_student_ids, [ID], required: false, prepare: GraphQLHelpers.relay_or_legacy_ids_prepare_func("User")
field :assignment, Types::AssignmentType, null: true
field :progress, Types::ProgressType, null: true

View File

@ -22,8 +22,8 @@ class Mutations::PostAssignmentGradesForSections < Mutations::BaseMutation
graphql_name "PostAssignmentGradesForSections"
argument :assignment_id, ID, required: true, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Assignment")
argument :section_ids, [ID], required: true, prepare: GraphQLHelpers.relay_or_legacy_ids_prepare_func("Section")
argument :graded_only, Boolean, required: false
argument :section_ids, [ID], required: true, prepare: GraphQLHelpers.relay_or_legacy_ids_prepare_func("Section")
field :assignment, Types::AssignmentType, null: true
field :progress, Types::ProgressType, null: true

View File

@ -21,13 +21,13 @@
class Mutations::SetFriendlyDescription < Mutations::BaseMutation
graphql_name "SetFriendlyDescription"
argument :context_id, ID, required: true
argument :context_type, String, required: true
argument :description, String, required: true
argument :outcome_id,
ID,
required: true,
prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("LearningOutcome")
argument :context_id, ID, required: true
argument :context_type, String, required: true
field :outcome_friendly_description, Types::OutcomeFriendlyDescriptionType, null: true

View File

@ -23,9 +23,9 @@ class Mutations::SetModuleItemCompletion < Mutations::BaseMutation
graphql_name "SetModuleItemCompletion"
argument :module_id, ID, required: true, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("ContextModule")
argument :item_id, ID, required: true, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("ContextModuleItem")
argument :done, Boolean, required: true
argument :item_id, ID, required: true, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("ContextModuleItem")
argument :module_id, ID, required: true, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("ContextModule")
field :module_item, Types::ModuleItemType, null: false

View File

@ -21,8 +21,8 @@
class Mutations::UpdateCommentBankItem < Mutations::BaseMutation
graphql_name "UpdateCommentBankItem"
argument :id, ID, required: true, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("CommentBankItem")
argument :comment, String, required: true
argument :id, ID, required: true, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("CommentBankItem")
field :comment_bank_item, Types::CommentBankItemType, null: true

View File

@ -22,10 +22,10 @@ class Mutations::UpdateDiscussionEntry < Mutations::BaseMutation
graphql_name "UpdateDiscussionEntry"
argument :discussion_entry_id, ID, required: true, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("DiscussionEntry")
argument :message, String, required: false
argument :remove_attachment, Boolean, required: false
argument :file_id, ID, required: false, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Attachment")
argument :message, String, required: false
argument :quoted_entry_id, ID, required: false
argument :remove_attachment, Boolean, required: false
field :discussion_entry, Types::DiscussionEntryType, null: true
def resolve(input:)

View File

@ -37,9 +37,9 @@ class Mutations::UpdateDiscussionEntryParticipant < Mutations::BaseMutation
graphql_name "UpdateDiscussionEntryParticipant"
argument :discussion_entry_id, ID, required: true, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("DiscussionEntry")
argument :read, Boolean, required: false
argument :rating, Types::RatingInputType, required: false
argument :forced_read_state, Boolean, required: false
argument :rating, Types::RatingInputType, required: false
argument :read, Boolean, required: false
argument :report_type, Types::ReportType, required: false
field :discussion_entry, Types::DiscussionEntryType, null: false

View File

@ -26,10 +26,10 @@ class Mutations::UpdateDiscussionTopic < Mutations::DiscussionBase
# rubocop:disable GraphQL/ExtractInputType
argument :anonymous_state, Types::DiscussionTopicAnonymousStateType, required: false
argument :discussion_topic_id, GraphQL::Schema::Object::ID, required: true, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("DiscussionTopic")
argument :remove_attachment, Boolean, required: false
argument :assignment, Mutations::AssignmentBase::AssignmentUpdate, required: false
argument :discussion_topic_id, GraphQL::Schema::Object::ID, required: true, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("DiscussionTopic")
argument :discussion_type, Types::DiscussionTopicDiscussionType, required: false
argument :remove_attachment, Boolean, required: false
# sets in-memory (not persisiting) flag to decide when to notify users about announcement changes
argument :notify_users, Boolean, required: false
argument :set_checkpoints, Boolean, required: false

View File

@ -21,11 +21,11 @@
class Mutations::UpdateLearningOutcomeGroup < Mutations::BaseMutation
graphql_name "UpdateLearningOutcomeGroup"
argument :id, ID, required: true, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("LearningOutcomeGroup")
argument :title, String, required: false
argument :description, String, required: false
argument :vendor_guid, String, required: false
argument :id, ID, required: true, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("LearningOutcomeGroup")
argument :parent_outcome_group_id, ID, required: false
argument :title, String, required: false
argument :vendor_guid, String, required: false
field :learning_outcome_group, Types::LearningOutcomeGroupType, null: true

View File

@ -42,18 +42,18 @@ class Mutations::UpdateNotificationPreferences < Mutations::BaseMutation
graphql_name "UpdateNotificationPreferences"
argument :account_id, ID, required: false, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Account")
argument :course_id, ID, required: false, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Course")
argument :context_type, Types::NotificationPreferencesContextType, required: true
argument :course_id, ID, required: false, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Course")
argument :enabled, Boolean, required: false
argument :has_read_privacy_notice, Boolean, required: false
argument :send_scores_in_emails, Boolean, required: false
argument :send_observed_names_in_notifications, Boolean, required: false
argument :send_scores_in_emails, Boolean, required: false
argument :communication_channel_id, ID, required: false, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("CommunicationChannel")
argument :notification_category, Types::NotificationCategoryType, required: false
argument :frequency, Types::NotificationFrequencyType, required: false
argument :is_policy_override, Boolean, required: false
argument :notification_category, Types::NotificationCategoryType, required: false
field :user, Types::UserType, null: true
def resolve(input:)

View File

@ -22,9 +22,9 @@ class Mutations::UpdateOutcomeCalculationMethod < Mutations::OutcomeCalculationM
graphql_name "UpdateOutcomeCalculationMethod"
# input arguments
argument :id, ID, required: true
argument :calculation_method, String, required: false
argument :calculation_int, Integer, required: false
argument :calculation_method, String, required: false
argument :id, ID, required: true
def resolve(input:)
record_id = GraphQLHelpers.parse_relay_or_legacy_id(input[:id], "OutcomeCalculationMethod")

View File

@ -21,8 +21,8 @@
class Mutations::UpdateSubmissionGrade < Mutations::BaseMutation
graphql_name "UpdateSubmissionsGrade"
argument :submission_id, ID, required: true
argument :score, Int, required: true
argument :submission_id, ID, required: true
field :submission, Types::SubmissionType, null: true
def resolve(input:)

View File

@ -21,8 +21,8 @@
class Mutations::UpdateSubmissionsReadState < Mutations::BaseMutation
graphql_name "UpdateSubmissionsReadState"
argument :submission_ids, [ID], required: true, prepare: GraphQLHelpers.relay_or_legacy_ids_prepare_func("Submission")
argument :read, Boolean, required: true
argument :submission_ids, [ID], required: true, prepare: GraphQLHelpers.relay_or_legacy_ids_prepare_func("Submission")
field :submissions, [Types::SubmissionType], null: true
def resolve(input:)

View File

@ -25,8 +25,8 @@ module Types
field :mutation_logs, MutationLogType.connection_type, null: true do
description "A list of all recent graphql mutations run on the specified object"
argument :asset_string, String, required: true
argument :start_time, DateTimeType, required: false
argument :end_time, DateTimeType, required: false
argument :start_time, DateTimeType, required: false
end
def mutation_logs(asset_string:, start_time: nil, end_time: nil)

View File

@ -41,8 +41,8 @@ module Types
field :notification_policy_overrides, [NotificationPolicyType], null: true do
argument :account_id, ID, required: false, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Account")
argument :course_id, ID, required: false, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Course")
argument :context_type, NotificationPreferencesContextType, required: true
argument :course_id, ID, required: false, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Course")
end
def notification_policy_overrides(account_id: nil, course_id: nil, context_type: nil)
overrides_for = lambda do |context|

View File

@ -42,8 +42,8 @@ module Types
end
field :conversation_messages_connection, Types::ConversationMessageType.connection_type, null: true do
argument :participants, [ID], required: false, prepare: GraphQLHelpers.relay_or_legacy_ids_prepare_func("User")
argument :created_before, DateTimeType, required: false
argument :participants, [ID], required: false, prepare: GraphQLHelpers.relay_or_legacy_ids_prepare_func("User")
end
def conversation_messages_connection(participants: nil, created_before: nil)
load_association(:conversation_messages).then do |messages|

View File

@ -28,8 +28,8 @@ module Types
class SubmissionOrderInputType < BaseInputObject
graphql_name "SubmissionOrderCriteria"
argument :field, SubmissionOrderFieldType, required: true
argument :direction, OrderDirectionType, required: false
argument :field, SubmissionOrderFieldType, required: true
end
class CourseType < ApplicationObjectType
@ -292,13 +292,13 @@ module Types
field :submissions_connection, SubmissionType.connection_type, null: true do
description "all the submissions for assignments in this course"
argument :filter, SubmissionFilterInputType, required: false
argument :order_by, [SubmissionOrderInputType], required: false
argument :student_ids,
[ID],
"Only return submissions for the given students.",
prepare: GraphQLHelpers.relay_or_legacy_ids_prepare_func("User"),
required: false
argument :order_by, [SubmissionOrderInputType], required: false
argument :filter, SubmissionFilterInputType, required: false
end
def submissions_connection(student_ids: nil, order_by: [], filter: {})
allowed_user_ids = if course.grants_any_right?(current_user, session, :manage_grades, :view_all_grades)

View File

@ -87,9 +87,9 @@ module Types
end
field :author, Types::UserType, null: true do
argument :built_in_only, Boolean, "Only return default/built_in roles", required: false
argument :course_id, String, required: false
argument :role_types, [String], "Return only requested base role types", required: false
argument :built_in_only, Boolean, "Only return default/built_in roles", required: false
end
def author(course_id: nil, role_types: nil, built_in_only: false)
load_association(:discussion_topic).then do |topic|
@ -139,9 +139,9 @@ module Types
end
field :editor, Types::UserType, null: true do
argument :built_in_only, Boolean, "Only return default/built_in roles", required: false
argument :course_id, String, required: false
argument :role_types, [String], "Return only requested base role types", required: false
argument :built_in_only, Boolean, "Only return default/built_in roles", required: false
end
def editor(course_id: nil, role_types: nil, built_in_only: false)
load_association(:discussion_topic).then do |topic|
@ -179,10 +179,10 @@ module Types
end
field :discussion_subentries_connection, Types::DiscussionEntryType.connection_type, null: true do
argument :sort_order, DiscussionSortOrderType, required: false
argument :relative_entry_id, ID, required: false
argument :before_relative_entry, Boolean, required: false
argument :include_relative_entry, Boolean, required: false
argument :relative_entry_id, ID, required: false
argument :sort_order, DiscussionSortOrderType, required: false
end
def discussion_subentries_connection(sort_order: :asc, relative_entry_id: nil, before_relative_entry: true, include_relative_entry: true)
Loaders::DiscussionEntryLoader.for(

View File

@ -148,12 +148,12 @@ module Types
end
field :discussion_entries_connection, Types::DiscussionEntryType.connection_type, null: true do
argument :search_term, String, required: false
argument :filter, Types::DiscussionFilterType, required: false
argument :sort_order, Types::DiscussionSortOrderType, required: false
argument :root_entries, Boolean, required: false
argument :user_search_id, String, required: false
argument :search_term, String, required: false
argument :sort_order, Types::DiscussionSortOrderType, required: false
argument :unread_before, String, required: false
argument :user_search_id, String, required: false
end
def discussion_entries_connection(**args)
get_entries(**args)
@ -199,9 +199,9 @@ module Types
end
field :author, Types::UserType, null: true do
argument :built_in_only, Boolean, "Only return default/built_in roles", required: false
argument :course_id, String, required: false
argument :role_types, [String], "Return only requested base role types", required: false
argument :built_in_only, Boolean, "Only return default/built_in roles", required: false
end
def author(course_id: nil, role_types: nil, built_in_only: false)
# Conditionally set course_id based on whether it's provided or should be inferred from the object
@ -246,9 +246,9 @@ module Types
end
field :editor, Types::UserType, null: true do
argument :built_in_only, Boolean, "Only return default/built_in roles", required: false
argument :course_id, String, required: false
argument :role_types, [String], "Return only requested base role types", required: false
argument :built_in_only, Boolean, "Only return default/built_in roles", required: false
end
def editor(course_id: nil, role_types: nil, built_in_only: false)
# Conditionally set course_id based on whether it's provided or should be inferred from the object
@ -323,11 +323,11 @@ module Types
end
field :entries_total_pages, Integer, null: true do
argument :per_page, Integer, required: true
argument :search_term, String, required: false
argument :filter, Types::DiscussionFilterType, required: false
argument :sort_order, Types::DiscussionSortOrderType, required: false
argument :per_page, Integer, required: true
argument :root_entries, Boolean, required: false
argument :search_term, String, required: false
argument :sort_order, Types::DiscussionSortOrderType, required: false
argument :unread_before, String, required: false
end
def entries_total_pages(**args)
@ -335,9 +335,9 @@ module Types
end
field :root_entries_total_pages, Integer, null: true do
argument :filter, Types::DiscussionFilterType, required: false
argument :per_page, Integer, required: true
argument :search_term, String, required: false
argument :filter, Types::DiscussionFilterType, required: false
argument :sort_order, Types::DiscussionSortOrderType, required: false
end
def root_entries_total_pages(**args)
@ -353,8 +353,8 @@ module Types
end
field :search_entry_count, Integer, null: true do
argument :search_term, String, required: false
argument :filter, Types::DiscussionFilterType, required: false
argument :search_term, String, required: false
end
def search_entry_count(**args)
get_entries(**args).then(&:count)

View File

@ -43,13 +43,13 @@ module Types
class EnrollmentFilterInputType < Types::BaseInputObject
graphql_name "EnrollmentFilterInput"
argument :types, [EnrollmentTypeType], required: false, default_value: nil
argument :associated_user_ids,
[ID],
prepare: GraphQLHelpers.relay_or_legacy_ids_prepare_func("User"),
required: false,
default_value: []
argument :states, [EnrollmentWorkflowState], required: false, default_value: nil
argument :types, [EnrollmentTypeType], required: false, default_value: nil
end
class EnrollmentType < ApplicationObjectType

View File

@ -69,8 +69,8 @@ module Types
end
field :outcomes, Types::ContentTagConnection, null: false do
argument :search_query, String, required: false
argument :filter, String, required: false
argument :search_query, String, required: false
end
def outcomes(**args)
learning_outcome_group_children_service.suboutcomes_by_group_id(object.id, args)

View File

@ -32,8 +32,8 @@ module Types
required: false,
prepare: GraphQLHelpers.relay_or_legacy_ids_prepare_func("Section")
argument :submitted_since, DateTimeType, required: false
argument :graded_since, DateTimeType, required: false
argument :submitted_since, DateTimeType, required: false
argument :updated_since, DateTimeType, required: false
end
end

View File

@ -36,8 +36,8 @@ module Types
are being graded individually.
MD
argument :states, [SubmissionStateType], required: false, default_value: DEFAULT_SUBMISSION_STATES
argument :section_ids, [ID], required: false, prepare: GraphQLHelpers.relay_or_legacy_ids_prepare_func("Section")
argument :states, [SubmissionStateType], required: false, default_value: DEFAULT_SUBMISSION_STATES
argument :enrollment_types, [EnrollmentTypeType], required: false
argument :include_concluded, Boolean, <<~MD, required: false
@ -60,9 +60,9 @@ module Types
There is no character restriction on this field
MD
argument :late, Boolean, "Limit results to submissions that are late", required: false
argument :scored_less_than, Float, "Limit results to submissions that scored below the specified value", required: false
argument :scored_more_than, Float, "Limit results to submissions that scored above the specified value", required: false
argument :late, Boolean, "Limit results to submissions that are late", required: false
argument :grading_status, SubmissionGradingStatusType, "Limit results by grading status", required: false
end

View File

@ -33,7 +33,7 @@ module Types
class SubmissionSearchOrderInputType < Types::BaseInputObject
graphql_name "SubmissionSearchOrder"
description "Specify a sort for the results"
argument :field, SubmissionSearchOrderFieldInputType, required: true
argument :direction, OrderDirectionType, required: false
argument :field, SubmissionSearchOrderFieldInputType, required: true
end
end

View File

@ -152,14 +152,14 @@ module Types
Boolean,
"Whether or not to restrict results to `active` enrollments in `available` courses",
required: false
argument :order_by,
[String],
"The fields to order the results by",
required: false
argument :exclude_concluded,
Boolean,
"Whether or not to exclude `completed` enrollments",
required: false
argument :order_by,
[String],
"The fields to order the results by",
required: false
end
field :login_id, String, null: true
@ -197,8 +197,8 @@ module Types
field :notification_preferences_enabled, Boolean, null: false do
argument :account_id, ID, required: false, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Account")
argument :course_id, ID, required: false, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Course")
argument :context_type, NotificationPreferencesContextType, required: true
argument :course_id, ID, required: false, prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("Course")
end
def notification_preferences_enabled(account_id: nil, course_id: nil, context_type: nil)
enabled_for = lambda do |context|
@ -228,8 +228,8 @@ module Types
end
field :conversations_connection, Types::ConversationParticipantType.connection_type, null: true do
argument :scope, String, required: false
argument :filter, [String], required: false
argument :scope, String, required: false
end
def conversations_connection(scope: nil, filter: nil)
if object == context[:current_user]
@ -271,8 +271,8 @@ module Types
end
field :recipients, RecipientsType, null: true do
argument :search, String, required: false
argument :context, String, required: false
argument :search, String, required: false
end
def recipients(search: nil, context: nil)
return nil unless object == self.context[:current_user]
@ -322,8 +322,8 @@ module Types
end
field :recipients_observers, MessageableUserType.connection_type, null: true do
argument :recipient_ids, [String], required: true
argument :context_code, String, required: true
argument :recipient_ids, [String], required: true
end
def recipients_observers(recipient_ids: nil, context_code: nil)
return nil unless object == context[:current_user]
@ -493,9 +493,9 @@ module Types
end
field :course_roles, [String], null: true do
argument :built_in_only, Boolean, "Only return default/built_in roles", required: false
argument :course_id, String, required: false
argument :role_types, [String], "Return only requested base role types", required: false
argument :built_in_only, Boolean, "Only return default/built_in roles", required: false
end
def course_roles(course_id: nil, role_types: nil, built_in_only: true)
# This graphql execution context can be used to set course_id if you are calling course_role from a nested query

View File

@ -177,12 +177,12 @@ describe Mutations::SetFriendlyDescription do
}
GQL
result = execute_query(mutation_str, ctx)
expect(result["errors"].pluck("message")).to eql([
"Argument 'description' on InputObject 'SetFriendlyDescriptionInput' is required. Expected type String!",
"Argument 'outcomeId' on InputObject 'SetFriendlyDescriptionInput' is required. Expected type ID!",
"Argument 'contextId' on InputObject 'SetFriendlyDescriptionInput' is required. Expected type ID!",
"Argument 'contextType' on InputObject 'SetFriendlyDescriptionInput' is required. Expected type String!"
])
expect(result["errors"].pluck("message")).to match_array([
"Argument 'description' on InputObject 'SetFriendlyDescriptionInput' is required. Expected type String!",
"Argument 'outcomeId' on InputObject 'SetFriendlyDescriptionInput' is required. Expected type ID!",
"Argument 'contextId' on InputObject 'SetFriendlyDescriptionInput' is required. Expected type ID!",
"Argument 'contextType' on InputObject 'SetFriendlyDescriptionInput' is required. Expected type String!"
])
end
it "returns error when pass invalid context type" do