[Bug 43794] New: Add REST API routes for record matching rules (read-only)
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43794 Bug ID: 43794 Summary: Add REST API routes for record matching rules (read-only) Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: tomascohen@gmail.com CC: tomascohen@gmail.com Target Milestone: --- Koha has no REST API for record matching rules (the marc_matchers table, managed in Administration > Record matching rules and consumed by C4::Matcher). Anything that needs to offer or display a matching rule has to get the list some other way, by loading it server-side in a Perl script and embedding it in the page, or by querying the database directly. A concrete example: bug 30800 (a management page for MARC import staging profiles) needs a matching-rule dropdown in a Vue form, and the profiles REST resource (/import_batch_profiles) only returns the bare matcher_id. Proposal Add a read-only REST resource: - GET /record_matchers (list, with the usual query, pagination and ordering support) - GET /record_matchers/{record_matcher_id} Fields to expose: record_matcher_id (matcher_id), code, description, record_type, threshold. The matchpoints and match checks (the detailed rules) are out of scope for this bug. Implementation notes - There is a DBIC result class (Koha::Schema::Result::MarcMatcher) but no Koha::Object wrapper yet; add Koha::RecordMatcher and Koha::RecordMatchers. - Add the swagger definition and paths, and a Koha::REST::V1 controller. - Add unit tests for the object classes and REST tests under t/db_dependent/api/v1/. Open questions 1. Permissions. The matching rules page uses the manage_matching_rules parameters permission, but a cataloguer staging records (tools: stage_marc_import) must be able to choose a rule. Reading should probably be allowed with either; how best to express that in x-koha-authorization? 2. Naming: record_matchers, or matching_rules? 3. Write operations (add/edit/delete) are deliberately left to a later bug. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43794 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |30800 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30800 [Bug 30800] Ability to view, modify, and delete profiles for staging MARC records for import -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43794 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|30800 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30800 [Bug 30800] Ability to view, modify, and delete profiles for staging MARC records for import -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43794 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |30800 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30800 [Bug 30800] Ability to view, modify, and delete profiles for staging MARC records for import -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43794 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |martin.renvoize@openfifth.c |ity.org |o.uk -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43794 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43794 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 207964 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207964&action=edit Bug 43794: Add Koha::RecordMatcher(s) object classes This patch adds Koha::RecordMatcher and Koha::RecordMatchers object classes on top of the marc_matchers table, along with unit tests. The next patch adds REST API routes built on these classes. Test plan: 1. Apply both patches of this bug 2. yarn build; restart_all 3. prove t/db_dependent/Koha/RecordMatchers.t \ t/db_dependent/api/v1/record_matchers.t 4. Both pass Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43794 --- Comment #2 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 207965 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207965&action=edit Bug 43794: Add REST API routes for record matching rules Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43794 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43794 Miranda Nero <mnero@oslri.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mnero@oslri.net -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43794 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43794 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #207964|0 |1 is obsolete| | Attachment #207965|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43794 --- Comment #3 from David Nind <david@davidnind.com> --- Created attachment 208402 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208402&action=edit Bug 43794: Add Koha::RecordMatcher(s) object classes This patch adds Koha::RecordMatcher and Koha::RecordMatchers object classes on top of the marc_matchers table, along with unit tests. The next patch adds REST API routes built on these classes. Test plan: 1. Apply both patches of this bug 2. yarn build; restart_all 3. prove t/db_dependent/Koha/RecordMatchers.t \ t/db_dependent/api/v1/record_matchers.t 4. Both pass Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43794 --- Comment #4 from David Nind <david@davidnind.com> --- Created attachment 208403 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208403&action=edit Bug 43794: Add REST API routes for record matching rules Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43794 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |release-notes-needed CC| |lucas@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43794 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA CC| |andrew@bywatersolutions.com --- Comment #5 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- xt/api.t fails with this code: xt/api.t .. 3/8 # Failed test 'No errors in 400 definitions in the spec' # at xt/api.t line 174. # got: '2' # expected: '0' get /record_matchers/{record_matcher_id} -> 'description' does not start with 'Bad request': (Default response.) get /record_matchers/{record_matcher_id} -> '$ref' is not '#/definitions/error': (#/definitions/DefaultResponse) # Looks like you failed 1 test of 1. # Failed test '400 response tests' # at xt/api.t line 179. xt/api.t .. 6/8 # Looks like you failed 1 test of 8. xt/api.t .. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/8 subtests Test Summary Report ------------------- xt/api.t (Wstat: 256 (exited 1) Tests: 8 Failed: 1) Failed test: 5 Non-zero exit status: 1 Files=1, Tests=8, 7 wallclock secs ( 0.02 usr 0.01 sys + 6.07 cusr 0.24 csys = 6.34 CPU) Result: FAIL -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43794 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #208402|0 |1 is obsolete| | Attachment #208403|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43794 --- Comment #6 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 210783 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210783&action=edit Bug 43794: Add Koha::RecordMatcher(s) object classes This patch adds Koha::RecordMatcher and Koha::RecordMatchers object classes on top of the marc_matchers table, along with unit tests. The next patch adds REST API routes built on these classes. Test plan: 1. Apply both patches of this bug 2. yarn build; restart_all 3. prove t/db_dependent/Koha/RecordMatchers.t \ t/db_dependent/api/v1/record_matchers.t 4. Both pass Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43794 --- Comment #7 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 210784 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210784&action=edit Bug 43794: Add REST API routes for record matching rules Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43794 --- Comment #8 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 210785 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210785&action=edit Bug 43794: (follow-up) Document the 400 response of GET /record_matchers/{record_matcher_id} The route has a path parameter, so a 400 response can be returned by the request validation. Without it documented, the default response was used, which xt/api.t rejects. To test: 1. Apply the patches 2. yarn build; restart_all 3. prove xt/api.t => SUCCESS: Tests pass! (before the patch: 'No errors in 400 definitions' fails for get /record_matchers/{record_matcher_id}) 4. Sign off :-D Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43794 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off --- Comment #9 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Thanks Andrew, good catch. GET /record_matchers/{record_matcher_id} has a path parameter, so the request validation can return a 400, but the route did not document one and the default response was used. The new follow-up patch documents it as 'Bad request' with the error schema, like the other routes getting a single object. xt/api.t now passes, as do t/db_dependent/Koha/RecordMatchers.t and t/db_dependent/api/v1/record_matchers.t. All the patches are re-attached, rebased on current main, with the signed-off-by lines kept. Setting back to Signed Off for another look. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43794 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|tomascohen@gmail.com |andrew@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43794 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|andrew@bywatersolutions.com |tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org