Koha-clms/api/v1/swagger/paths
Tomas Cohen Arazi dab0260702 Bug 33161: Add +strings support to GET /items and /items/:item_id
This patch introduces the `api_strings_mapping` method to the
*Koha::Item* class, and makes the API spec for the following routes:

* GET /items
* GET /items/:item_id
* GET /acquisitions/orders

accept the new `+strings` parameter that can be passed through the
`x-koha-embed` header and was introduced by bug 26635. In the case of
/acquisitions/orders, you will need to use

x-koha-embed: items+strings

I introduce it here to highlight the flebility we introduced with bug
26635.

The `api_strings_mapping` method has its roots on the cool
`columns_to_str` method already present. The main differences:

* It is aware of the `public_read_list` for attributes so no hidden
  information is exposed.
* Attribute names get mapped for consistency with the API (e.g.
  `homebranch` is converted into `home_library_id`, etc).
* The data structure it returns includes information about the source
  for the descriptions (e.g. it it is an authorised value, then `type`
  will be `av`, and the related category information is returned so
  dropdowns and such can be built. The same goes for other types as
 `library`, `item_type` and `call_number_source`.

To test:
1. Apply this patch
2. Reload everything
3. Play with your favourite REST tool (e.g. Postman)
4. Try:
GET http://localhost:8081/api/v1/items
x-koha-embed: +strings
=> SUCCESS: You get a list of items, they include the new _strings
structure, and the contents make sense!
5. Repeat with a specific item:
GET http://localhost:8081/api/v1/items/14
x-koha-embed: +strings
=> SUCCESS: It all makes sense!
6. Sign off :-D

Sponsored-by: Virginia Polytechnic Institute and State University
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-03-10 10:20:09 -03:00
..
acquisitions_baskets.yaml Bug 30536: (QA follow-up) POD + Spec Consistency 2022-05-03 11:19:51 -10:00
acquisitions_funds.yaml Bug 30536: Update spec files 2022-05-03 11:19:51 -10:00
acquisitions_orders.yaml Bug 33161: Add +strings support to GET /items and /items/:item_id 2023-03-10 10:20:09 -03:00
acquisitions_vendors.yaml Bug 30394: Add x-koha-request-id support on API routes 2022-04-04 16:23:46 +02:00
advancededitormacros.yaml Bug 30394: Add x-koha-request-id support on API routes 2022-04-04 16:23:46 +02:00
article_requests.yaml Bug 30194: (follow-up) Simply OpenAPI Specification 2022-03-29 16:44:31 +02:00
auth.yaml Bug 30962: (QA follow-up) Rename attribute and simplify tests 2023-02-03 10:30:13 -03:00
authorised_value_categories.yaml Bug 32997: Add REST API endpoint to list authorised values for multiple given categories 2023-03-02 12:00:15 -03:00
authorised_values.yaml Bug 32997: (QA follow-up) values => authorised_values 2023-03-02 12:00:17 -03:00
authorities.yaml Bug 31794: Add REST endpoint to get an authority 2023-03-06 14:45:26 -03:00
biblios.yaml Bug 29939: Use the REST API for ratings 2022-08-22 11:31:15 -03:00
biblios_item_groups.yaml Bug 32923: Fix new occurrences of x-koha-embed at top level 2023-02-27 11:07:14 -03:00
cash_registers.yaml Bug 30536: Update spec files 2022-05-03 11:19:51 -10:00
checkouts.yaml Bug 32923: Fix new occurrences of x-koha-embed at top level 2023-02-27 11:07:14 -03:00
circulation-rules.yaml Bug 30194: (follow-up) Simply OpenAPI Specification 2022-03-29 16:44:31 +02:00
cities.yaml Bug 30394: Add x-koha-request-id support on API routes 2022-04-04 16:23:46 +02:00
clubs.yaml Bug 30194: (follow-up) Simply OpenAPI Specification 2022-03-29 16:44:31 +02:00
config_smtp_servers.yaml Bug 30394: Add x-koha-request-id support on API routes 2022-04-04 16:23:46 +02:00
erm_agreements.yaml Bug 32923: Some fixes in ERM specs 2023-02-27 11:07:19 -03:00
erm_documents.yaml Bug 32030: Add document to license - REST API spec 2022-11-08 09:44:31 -03:00
erm_eholdings_packages.yaml Bug 33145: Fix ERM swagger specs 2023-03-06 09:51:43 -03:00
erm_eholdings_packages_resources.yaml Bug 32923: Some fixes in ERM specs 2023-02-27 11:07:19 -03:00
erm_eholdings_resources.yaml Bug 32030: ERM EHoldings Resources - Remove inexistent 'resources' embed from resources 2022-11-08 09:44:40 -03:00
erm_eholdings_titles.yaml Bug 33145: Fix ERM swagger specs 2023-03-06 09:51:43 -03:00
erm_eholdings_titles_resources.yaml Bug 33145: Fix ERM swagger specs 2023-03-06 09:51:43 -03:00
erm_licenses.yaml Bug 32923: Some fixes in ERM specs 2023-02-27 11:07:19 -03:00
erm_users.yaml Bug 32923: Fix new occurrences of x-koha-embed at top level 2023-02-27 11:07:14 -03:00
holds.yaml Bug 24860: Implement reserves.item_group_id 2022-11-04 19:39:55 -03:00
ill_backends.yaml Bug 30194: (follow-up) Simply OpenAPI Specification 2022-03-29 16:44:31 +02:00
illrequests.yaml Bug 30194: (follow-up) Simply OpenAPI Specification 2022-03-29 16:44:31 +02:00
import_batch_profiles.yaml Bug 30394: Add x-koha-request-id support on API routes 2022-04-04 16:23:46 +02:00
import_batches.yaml Bug 30855: Rename /import => /import_batches 2022-06-02 13:42:28 -03:00
items.yaml Bug 33161: Add +strings support to GET /items and /items/:item_id 2023-03-10 10:20:09 -03:00
jobs.yaml Bug 30982: (QA follow-up) Spelling 2022-09-23 08:57:50 -03:00
libraries.yaml Bug 29144: Copy and remove branches.opac_info (dbrev) 2022-09-16 09:55:20 -03:00
oauth.yaml Bug 32354: Accept session_state param given by OAuth IdP 2022-12-07 12:58:32 -03:00
patrons.yaml Bug 30578: Remove circ/ysearch.pl in favor of the /patrons REST API route 2022-07-18 11:01:34 -03:00
patrons_account.yaml Bug 30194: (follow-up) Simply OpenAPI Specification 2022-03-29 16:44:31 +02:00
patrons_extended_attributes.yaml Bug 30394: Add x-koha-request-id support on API routes 2022-04-04 16:23:46 +02:00
patrons_holds.yaml Bug 30394: Add x-koha-request-id support on API routes 2022-04-04 16:23:46 +02:00
patrons_password.yaml Bug 29926: (QA follow-up) Date format missing in spec 2022-05-06 10:33:10 -10:00
public_oauth.yaml Bug 32354: Accept session_state param given by OAuth IdP 2022-12-07 12:58:32 -03:00
public_patrons.yaml Bug 30194: (follow-up) Simply OpenAPI Specification 2022-03-29 16:44:31 +02:00
quotes.yaml Bug 30394: Add x-koha-request-id support on API routes 2022-04-04 16:23:46 +02:00
return_claims.yaml Bug 30194: (follow-up) Simply OpenAPI Specification 2022-03-29 16:44:31 +02:00
rotas.yaml Bug 30194: (follow-up) Simply OpenAPI Specification 2022-03-29 16:44:31 +02:00
search_filters.yaml Bug 17170: (QA follow-up) Spec cleanup 2022-10-21 11:15:22 -03:00
suggestions.yaml Bug 30663: Add x-koha-override options to /suggestions 2022-05-05 10:26:41 -03:00
tickets.yaml Bug 31028: Add catalog concern management page to staff 2023-03-06 11:23:17 -03:00
transfer_limits.yaml Bug 30394: Add x-koha-request-id support on API routes 2022-04-04 16:23:46 +02:00