]> git.koha-community.org Git - koha.git/commit
Bug 26635: Move expand syntax to x-koha-embed
authorTomas Cohen Arazi <tomascohen@theke.io>
Wed, 2 Nov 2022 15:48:29 +0000 (12:48 -0300)
committerTomas Cohen Arazi <tomascohen@theke.io>
Wed, 9 Nov 2022 17:00:51 +0000 (14:00 -0300)
commit7e3ab9fe083c31dabf9bce7ee4bae19817161db8
tree8411c9a338a43fe5a1282fbae5088859d37140eb
parent8dd24dab223375d49592f68b8c6ab01273e4e005
Bug 26635: Move expand syntax to x-koha-embed

Instead of a global av-expand flag (through a header) this patch
proposes to allow specifying +av_expand at the x-koha-embed header
level. This allows a more fine-grained control on what objects get avs
expanded. e.g.:

GET /patrons/123
x-koha-expand: +av_expand,checkouts.item+av_expand
=>
{
    "_str": {
        "city": { "str": "Córdoba", ... }
    },
    ...
    "checkouts": [
        {
            ...,
            "item": {
                "_str": {
                    "not_for_loan_status": { "str": "Reference material", ... },
                    ...
                },
                ...
            }
        }
    ]
}

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Object.t \
           t/Koha/REST/Plugin/Query.t \
           t/db_dependent/Koha/REST/Plugin/Objects.t
=> SUCCESS: Tests pass!
2. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Koha/Object.pm
Koha/REST/Plugin/Objects.pm
Koha/REST/Plugin/Query.pm
t/Koha/REST/Plugin/Query.t
t/db_dependent/Koha/Object.t
t/db_dependent/Koha/REST/Plugin/Objects.t