-
-
Notifications
You must be signed in to change notification settings - Fork 1k
SAK-52288 webapi Add scorm rest documentation #14336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
https://sakaiproject.atlassian.net/browse/SAK-52288 This change also normalises the test file layout, bringing the scorm test into the same package as the other tests.
WalkthroughUpdated documentation URL and added SCORM API docs; refactored ScormController formatting and changed getSession to return 404 when missing; reorganized test packages to Changes
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
webapi/src/test/java/org/sakaiproject/webapi/controllers/test/LoginControllerTests.java (2)
106-114: Replacevarwith explicit types per coding guidelines.The use of
varfor local variable type inference violates the project's coding guidelines. Explicit types are required for all local variable declarations.♻️ Proposed fix
- var auth = mock(Authentication.class); + Authentication auth = mock(Authentication.class); when(authenticationManager.authenticate(any())).thenReturn(auth); - var session = mock(Session.class); + Session session = mock(Session.class); when(session.getId()).thenReturn("session1"); when(sessionManager.startSession()).thenReturn(session); - var username = "user1"; - var password = "password1"; + String username = "user1"; + String password = "password1";
135-136: Replacevarwith explicit types.Same issue as above—use explicit
Stringtype declarations.♻️ Proposed fix
- var username = "user1"; - var password = "password1"; + String username = "user1"; + String password = "password1";
🤖 Fix all issues with AI agents
In
`@webapi/src/test/java/org/sakaiproject/webapi/controllers/test/ScormControllerTest.java`:
- Around line 153-157: The test "closeSessionReturnsNoContent" expects 204 but
ScormController.closeSession() currently returns void with no `@ResponseStatus`,
producing 200; fix by adding `@ResponseStatus`(HttpStatus.NO_CONTENT) to the
ScormController.closeSession method (to follow REST best practices) and update
the test in ScormControllerTest.closeSessionReturnsNoContent to assert
status().isNoContent() so the controller and test agree.
🧹 Nitpick comments (2)
webapi/src/test/java/org/sakaiproject/webapi/controllers/test/BaseControllerTests.java (1)
58-62: Empty catch block silently swallows exceptions.While the fallback to the original URI is reasonable, the empty catch block loses diagnostic information that could help debugging. Consider logging the exception.
♻️ Suggested improvement
public URI getUri() { try { return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), "/api" + uri.getPath(), uri.getQuery(), uri.getFragment()); - } catch (Exception e) { + } catch (Exception e) { + // URI construction failed; fall back to original } return uri; }webapi/src/main/asciidoc/webapi.adoc (1)
69-81: Consider adding the session cookie reminder for consistency.Other API sections (Announcements, Calendar) include
__See the login api about session cookies__to remind users about authentication. The Scorm API section would benefit from the same note.♻️ Suggested addition
=== Scorm API +__See the login api about session cookies__ + Create a Scorm session: include::{snippets}/create-scorm-session/http-request.adoc[]
https://sakaiproject.atlassian.net/browse/SAK-52288
This change also normalises the test file layout, bringing the scorm test into the same package as the other tests.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Tests
✏️ Tip: You can customize this high-level summary in your review settings.