Skip to content

AB#113906 allow get assignment options to have string assignmentId#78

Merged
sebastianchristopher merged 6 commits intomasterfrom
AB#113906
Feb 18, 2026
Merged

AB#113906 allow get assignment options to have string assignmentId#78
sebastianchristopher merged 6 commits intomasterfrom
AB#113906

Conversation

@sebastianchristopher
Copy link

Allow us to pass non-numeric ids like ~"lti_context_id:ab84f579-4442-4d4a-acd8-85c5ec6fd2b6"

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request modifies GetSingleAssignmentOptions to support non-numeric assignment identifiers, specifically allowing LTI context IDs in the format "lti_context_id:ab84f579-4442-4d4a-acd8-85c5ec6fd2b6". The change aligns with Canvas API's support for qualified identifiers (similar to "sis_course_id:abc123" for courses) and maintains backward compatibility through constructor overloading.

Changes:

  • Changed assignmentId field type from Integer to String to support both numeric IDs and qualified identifiers
  • Added constructor overload accepting Integer to maintain backward compatibility with existing code

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

public GetSingleAssignmentOptions(String courseId, Integer assignmentId) {
public GetSingleAssignmentOptions(String courseId, String assignmentId) {
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new functionality allowing String assignment IDs (e.g., "lti_context_id:ab84f579-4442-4d4a-acd8-85c5ec6fd2b6") lacks test coverage. While existing tests will continue to work through the backward-compatible Integer constructor, there should be a test that verifies the String constructor works correctly with non-numeric IDs, ensuring the URL is properly constructed and the API call succeeds.

Copilot uses AI. Check for mistakes.
Comment on lines +19 to 25
public GetSingleAssignmentOptions(String courseId, String assignmentId) {
if(courseId == null || assignmentId == null) {
throw new IllegalArgumentException("Course and assignment IDs are required");
}
this.courseId = courseId;
this.assignmentId = assignmentId;
}
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constructor Javadoc (inherited from line 17-21 in AssignmentReader) states it retrieves "a specific assignment from Canvas by its Canvas ID number", but this is now outdated since the constructor accepts String to support non-numeric identifiers like "lti_context_id:...". Consider updating the documentation to clarify that it accepts either a numeric Canvas ID or a qualified identifier (e.g., "lti_context_id:abc123"), similar to how GetSingleCourseOptions documents "May be of the form sis_course_id:abc123".

Copilot uses AI. Check for mistakes.
sebastianchristopher and others added 2 commits February 18, 2026 10:41
…tOptions.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
 * refactor GetSingleAssignmentOptions constructor to use Objects.toString for null-safe assignmentId handling
@buckett
Copy link
Member

buckett commented Feb 18, 2026

@sebastianchristopher Looks like build is failing.

 * refactor GetSingleAssignmentOptions constructor to use Objects.toString for null-safe assignmentId handling
Copy link
Member

@buckett buckett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@sebastianchristopher sebastianchristopher merged commit edf6397 into master Feb 18, 2026
1 check passed
@sebastianchristopher sebastianchristopher deleted the AB#113906 branch February 18, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants