Bug 35197 - Expose additional_field definitions through REST API
Summary: Expose additional_field definitions through REST API
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: REST API (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Pedro Amorim
QA Contact: Tomás Cohen Arazi
URL:
Keywords: Sandbox
Depends on: 35190
Blocks: 35044
  Show dependency treegraph
 
Reported: 2023-10-31 11:53 UTC by Pedro Amorim
Modified: 2024-02-28 22:39 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 35197: Add additional_fields REST API endpoint (6.62 KB, patch)
2023-10-31 11:56 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35197: Add additional_fields REST API endpoint (6.64 KB, patch)
2023-11-06 11:51 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35197: Add tests (4.35 KB, patch)
2023-11-06 11:51 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35197: Add additional_fields REST API endpoint (6.66 KB, patch)
2023-11-06 12:18 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35197: Add tests (4.35 KB, patch)
2023-11-06 12:18 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 35197: Add additional_fields REST API endpoint (6.72 KB, patch)
2023-11-06 23:18 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 35197: Add tests (4.41 KB, patch)
2023-11-06 23:18 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 35197: Add additional_fields REST API endpoint (6.79 KB, patch)
2023-12-07 13:24 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35197: Add tests (4.47 KB, patch)
2023-12-07 13:24 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 35197: Field name consistency (2.67 KB, patch)
2023-12-07 13:24 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Pedro Amorim 2023-10-31 11:53:01 UTC

    
Comment 1 Pedro Amorim 2023-10-31 11:56:26 UTC Comment hidden (obsolete)
Comment 2 Pedro Amorim 2023-11-06 11:51:08 UTC Comment hidden (obsolete)
Comment 3 Pedro Amorim 2023-11-06 11:51:11 UTC Comment hidden (obsolete)
Comment 4 Pedro Amorim 2023-11-06 12:18:14 UTC
Created attachment 158514 [details] [review]
Bug 35197: Add additional_fields REST API endpoint

Test plan:
1) Apply patch, restart plack 'koha-plack --restart kohadev'
2) Visit /api/v1/additional_fields?tablename=aqinvoices - Notice its empty
3) Visit /cgi-bin/koha/admin/additional-fields.pl?tablename=aqbasket and add a new additional field
4) Do step 2) again - Notice the newly created additional field is there
5) Visit /cgi-bin/koha/admin/additional-fields.pl?tablename=aqinvoices and add a new additional field for invoices
6) Do step 2) again - Notice both additional fields are there
7) Visit /api/v1/additional_fields?tablename=aqinvoices - Notice only the additional field for aqinvoices is listed
Comment 5 Pedro Amorim 2023-11-06 12:18:17 UTC
Created attachment 158515 [details] [review]
Bug 35197: Add tests

prove t/db_dependent/api/v1/additional_fields.t
Comment 6 Pedro Amorim 2023-11-06 12:19:14 UTC
Rebased on top of bug 35190
Comment 7 Lucas Gass 2023-11-06 23:18:48 UTC
Created attachment 158577 [details] [review]
Bug 35197: Add additional_fields REST API endpoint

Test plan:
1) Apply patch, restart plack 'koha-plack --restart kohadev'
2) Visit /api/v1/additional_fields?tablename=aqinvoices - Notice its empty
3) Visit /cgi-bin/koha/admin/additional-fields.pl?tablename=aqbasket and add a new additional field
4) Do step 2) again - Notice the newly created additional field is there
5) Visit /cgi-bin/koha/admin/additional-fields.pl?tablename=aqinvoices and add a new additional field for invoices
6) Do step 2) again - Notice both additional fields are there
7) Visit /api/v1/additional_fields?tablename=aqinvoices - Notice only the additional field for aqinvoices is listed

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 8 Lucas Gass 2023-11-06 23:18:50 UTC
Created attachment 158578 [details] [review]
Bug 35197: Add tests

prove t/db_dependent/api/v1/additional_fields.t

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 9 Martin Renvoize 2023-12-07 13:24:21 UTC
Created attachment 159648 [details] [review]
Bug 35197: Add additional_fields REST API endpoint

Test plan:
1) Apply patch, restart plack 'koha-plack --restart kohadev'
2) Visit /api/v1/additional_fields?tablename=aqinvoices - Notice its empty
3) Visit /cgi-bin/koha/admin/additional-fields.pl?tablename=aqbasket and add a new additional field
4) Do step 2) again - Notice the newly created additional field is there
5) Visit /cgi-bin/koha/admin/additional-fields.pl?tablename=aqinvoices and add a new additional field for invoices
6) Do step 2) again - Notice both additional fields are there
7) Visit /api/v1/additional_fields?tablename=aqinvoices - Notice only the additional field for aqinvoices is listed

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 10 Martin Renvoize 2023-12-07 13:24:24 UTC
Created attachment 159649 [details] [review]
Bug 35197: Add tests

prove t/db_dependent/api/v1/additional_fields.t

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 11 Martin Renvoize 2023-12-07 13:24:26 UTC
Created attachment 159650 [details] [review]
Bug 35197: Field name consistency

This patch adds a to_api_mapping and updates the yaml definitions to be
ensure we are consistent with modern best practice for our api field
names.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 12 Martin Renvoize 2023-12-07 13:26:00 UTC
I updated the mappings to be more consistent with the communities agreed guidelines.. though it raised lots of little questions for me.. I'm wondering how often our embeded extended_attributes are going to really look like the spec here.

Sending Tomas's way for final QA
Comment 13 Martin Renvoize 2024-02-28 22:39:40 UTC
Ping Tomas...