Conversation
Course reserve endpoints serialized result sets directly with Koha::Objects->to_api. That bypassed the controller context supplied by Koha::REST::Plugin::Objects, including the authenticated user. Koha::Patron->to_api requires that user context, so /instructors returned 500 as soon as the result set was non-empty while an empty set still returned []. Serialize through $c->objects->to_api so the standard public, embed, strings and user context is passed to every result object.
Add an Unreleased changelog entry for the non-empty /instructors failure without assigning the change to a release version prematurely. Keeping this separate from the functional commit lets release maintenance adjust or drop the note independently.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #44.
Problem
CourseReservesController::_get_paged_resultsserialized result sets directly with:That bypasses the request context supplied by
Koha::REST::Plugin::Objects. In particular,Koha::Patron->to_apirequires the authenticateduserparameter.This explains the data-dependent failure reported in #44:
[];user, raisingKoha::Exceptions::MissingParameterand returning HTTP 500.Change
Serialize paged course-reserve result sets through Koha's controller helper:
The helper supplies the standard
public,embed,strings, andusercontext. This fixes non-empty/instructorsresponses without introducing plugin-local serialization policy.A separate commit records the fix under an
Unreleasedchangelog section so release maintenance can adjust it independently.Commits
Use Koha REST serializer for course reserve resultsDocument the course instructor serialization fixTest plan
/api/v1/contrib/kohasuomi/instructorswith no instructors and confirm HTTP 200 with[]./courses,/departments, and/coursereserves, which share_get_paged_results.Scope note
This PR does not alter the
patron_idselected by/coursereserves. The controller currently sources it fromcourse_instructors.borrowernumber; a concrete mismatching response is needed to determine whether #44 compares that internal patron identifier withuserid/card number or exposes a separate join/cardinality defect.Verification
The branch is exactly two commits ahead of
main. The functional diff is one changed line; the other changed file isCHANGELOG.md.Runtime tests were not run here because this repository has no test harness and the execution environment does not contain a Koha installation.