Bugzilla – Attachment 117684 Details for
Bug 27855
Allow embedding extended_attributes on /patrons routes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27855: Add 'extended_attributes' embedding to the spec
Bug-27855-Add-extendedattributes-embedding-to-the-.patch (text/plain), 3.03 KB, created by
Kyle M Hall (khall)
on 2021-03-04 11:41:27 UTC
(
hide
)
Description:
Bug 27855: Add 'extended_attributes' embedding to the spec
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2021-03-04 11:41:27 UTC
Size:
3.03 KB
patch
obsolete
>From 8c0a352486f0ec91ab416190c5d095408a9aca32 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 4 Mar 2021 06:45:47 -0300 >Subject: [PATCH] Bug 27855: Add 'extended_attributes' embedding to the spec > >This patch just adds: >- The optional 'extended_attribute' attribute to the patron object > OpenAPI definition. It consists of an array of extended_attribute > objects. >- Add the x-koha-embed: [ 'extended_attributes' ] definition on the GET > routes for patrons, allowing immedite availability of the > 'extended_attributes' embedding feature. > >To test: >1. Apply this patchset >2. Restart Plack >3. Have some known patron_id/borrowernumber that has some extended > attributes ('Patron attributes' on the UI). >4. Enable Basic authentication >5. Assuming the known patron_id is 1, point your favourite REST tool to http://kohadev-intra.myDNSname.org:8081/api/v1/patrons/1 > e.g.: if your user/pass is koha/koha > curl --location --request GET 'http://kohadev-intra.myDNSname.org:8081/api/v1/patrons/1' \ > --header 'Content-Type: application/json' \ > --header 'Authorization: Basic a29oYTprb2hh' >=> SUCCESS: You get the patron object correctly, no extended_attributes >6. Repeat 5, adding the x-koha-embed header like this: > curl --location --request GET 'http://kohadev-intra.myDNSname.org:8081/api/v1/patrons/1' \ > --header 'Content-Type: application/json' \ > --header 'x-koha-embed: extended_attributes' \ > --header 'Authorization: Basic a29oYTprb2hh' >=> SUCCESS: You get the patron, with the extended attributes inside! >7. Sign off :-D > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > api/v1/swagger/definitions/patron.json | 7 +++++++ > api/v1/swagger/paths/patrons.json | 10 ++++++++-- > 2 files changed, 15 insertions(+), 2 deletions(-) > >diff --git a/api/v1/swagger/definitions/patron.json b/api/v1/swagger/definitions/patron.json >index 60488f5a4b..2b4c9ceea2 100644 >--- a/api/v1/swagger/definitions/patron.json >+++ b/api/v1/swagger/definitions/patron.json >@@ -281,6 +281,13 @@ > "type": "boolean", > "readOnly": true, > "description": "If the patron has been anonymized" >+ }, >+ "extended_attributes": { >+ "type": "array", >+ "description": "patron's extended attributes", >+ "items": { >+ "$ref": "extended_attribute.json" >+ } > } > }, > "additionalProperties": false, >diff --git a/api/v1/swagger/paths/patrons.json b/api/v1/swagger/paths/patrons.json >index 3e4e7739a1..23d143b918 100644 >--- a/api/v1/swagger/paths/patrons.json >+++ b/api/v1/swagger/paths/patrons.json >@@ -451,7 +451,10 @@ > "permissions": { > "borrowers": "1" > } >- } >+ }, >+ "x-koha-embed": [ >+ "extended_attributes" >+ ] > }, > "post": { > "x-mojo-to": "Patrons#add", >@@ -580,7 +583,10 @@ > "permissions": { > "borrowers": "edit_borrowers" > } >- } >+ }, >+ "x-koha-embed": [ >+ "extended_attributes" >+ ] > }, > "put": { > "x-mojo-to": "Patrons#update", >-- >2.24.1 (Apple Git-126)
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 27855
:
117660
|
117661
|
117662
|
117663
|
117681
|
117682
|
117683
|
117684
|
117685
|
117686
|
117687
|
117688
|
117689
|
117690
|
117691
|
117692
|
117693
|
117694
|
117695