Bugzilla – Attachment 143363 Details for
Bug 32118
Clarify expansion/embed modifiers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32118: Add optional support for `:` as the modifier
Bug-32118-Add-optional-support-for--as-the-modifie.patch (text/plain), 2.06 KB, created by
Martin Renvoize (ashimema)
on 2022-11-07 12:33:27 UTC
(
hide
)
Description:
Bug 32118: Add optional support for `:` as the modifier
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-11-07 12:33:27 UTC
Size:
2.06 KB
patch
obsolete
>From d5c7d894fdc3efa0d794b0938caa7e28ac23e85b 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 32118: 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 56f2e2b0f1..5ce0da42f3 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 9da2590e48..46493987f4 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.20.1
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 32118
:
143363
|
148133