Bugzilla – Attachment 143133 Details for
Bug 26635
Expand coded values in REST API call
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26635: (follow-up) Add optional support for `:` as the modifier
Bug-26635-follow-up-Add-optional-support-for--as-t.patch (text/plain), 2.08 KB, created by
Kyle M Hall
on 2022-11-03 15:22:57 UTC
(
hide
)
Description:
Bug 26635: (follow-up) Add optional support for `:` as the modifier
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2022-11-03 15:22:57 UTC
Size:
2.08 KB
patch
obsolete
>From cd9133bbe3a22c148a00d17e52f9b453282fa3d9 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 3 Nov 2022 11:02:21 +0000 >Subject: [PATCH] Bug 26635: (follow-up) Add optional support for `:` as the > modifier > >This patch adds optional support for using `:` as the modifier for >invoking the 'count' method for relations as discussed. > >We retain support for `+` for backward compatability to prevent a >breaking change. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/REST/Plugin/Query.pm | 2 +- > t/Koha/REST/Plugin/Query.t | 5 ++++- > 2 files changed, 5 insertions(+), 2 deletions(-) > >diff --git a/Koha/REST/Plugin/Query.pm b/Koha/REST/Plugin/Query.pm >index f75d284625..04666168f8 100644 >--- a/Koha/REST/Plugin/Query.pm >+++ b/Koha/REST/Plugin/Query.pm >@@ -364,7 +364,7 @@ sub _parse_embed { > $result->{$curr} = { children => _parse_embed( $next ) }; > } > else { >- if ( $curr =~ m/^(?<relation>.*)\+count/ ) { >+ if ( $curr =~ m/^(?<relation>.*)[\+|:]count/ ) { > my $key = $+{relation} . "_count"; > $result->{$key} = { is_count => 1 }; > } >diff --git a/t/Koha/REST/Plugin/Query.t b/t/Koha/REST/Plugin/Query.t >index 509f4f9ff6..b4edbdaf1d 100755 >--- a/t/Koha/REST/Plugin/Query.t >+++ b/t/Koha/REST/Plugin/Query.t >@@ -433,7 +433,7 @@ subtest '_build_query_params_from_api' => sub { > > subtest 'stash_embed() tests' => sub { > >- plan tests => 14; >+ plan tests => 16; > > my $t = Test::Mojo->new; > >@@ -446,6 +446,9 @@ subtest 'stash_embed() tests' => sub { > $t->get_ok( '/stash_embed' => { 'x-koha-embed' => 'holds+count' } ) > ->json_is( '/embed' => { holds_count => { is_count => 1 } } ); > >+ $t->get_ok( '/stash_embed' => { 'x-koha-embed' => 'holds:count' } ) >+ ->json_is( '/embed' => { holds_count => { is_count => 1 } } ); >+ > $t->get_ok( '/stash_embed' => { 'x-koha-embed' => 'checkouts,checkouts.item,patron' } ) > ->json_is( '/embed' => { > checkouts => { children => { item => {} } }, >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26635
:
111400
|
111401
|
111402
|
111411
|
111412
|
111413
|
111414
|
112538
|
112539
|
116232
|
116233
|
116234
|
116235
|
116592
|
116593
|
120698
|
120699
|
120700
|
124268
|
142761
|
142762
|
142763
|
142776
|
142792
|
142793
|
142794
|
142795
|
142796
|
142801
|
142802
|
142803
|
142804
|
142805
|
143039
|
143040
|
143041
|
143042
|
143043
|
143044
|
143073
|
143074
|
143075
|
143076
|
143077
|
143078
|
143079
|
143080
|
143127
|
143128
|
143129
|
143130
|
143131
|
143132
|
143133
|
143134
|
143276
|
143354
|
143355
|
143356
|
143357
|
143358
|
143359
|
143360
|
143361
|
143362