Koha-clms/Koha/REST/V1
Lari Taskula c42848609c
Bug 38365: Make swagger-cli happy
Schema type [array,object] is not valid in OpenAPI version 2.

There are two different CSP reporting directives.

One is the now deprecated "report-uri" directive. Browsers typically send a single
JSON object following the CSP2 specification.

"report-uri" is deprecated in CSP3 in favor of the newer "report-to" directive. It
is expected to contain an array of report objects.

There are browser that do not yet support the "report-to" directive, so both
directives should be supported.

There are also variations among the "report-uri" format. See
https://www.tollmanz.com/content-security-policy-report-samples/

Because of these variations, it becomes quite complex to handle the most common
cases in a single API endpoint.

We could build two separate endpoints for both directives.

Or we can accept any type of input and handle the variations in a single endpoint.
This patch attempts to do that.

Before this patch input parameters were validated by JSON::Validator. That is the
normal and recommended way to build OpenAPI endpoints in Koha. After this patch we
remove all input parameter restrictions from the OpenAPI spec, and simply accept
any type of body.

This means the controller will now always return a HTTP 204 regardless of the type
of data passed to the controller. It instead truncates too long input before
writing them into log files.

As this is not an endpoint that developers will build new Koha clients for, we
do not have to offer a very in-depth input parameter spec for this endpoint.

To test:
1. t/db_dependent/api/v1/public/csp_reports.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2026-03-16 11:57:37 +01:00
..
Acquisitions Bug 29668: Adapt to current guidelines 2026-01-21 15:28:16 -07:00
Auth Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Biblios Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
CashRegisters Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Clubs Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Config Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
ERM Bug 40192: Add additional fields support to ERM titles 2026-01-22 09:25:57 -07:00
ILL Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
OAuth Bug 34164: Redirect to referring URL when doing OIDC/OAuth SSO 2025-10-09 14:58:40 -06:00
Patrons Bug 40613: Add DELETE hold groups REST API endpoint 2025-11-07 10:54:15 -07:00
Preservation Bug 37622: Remove location from 2 preservation 'update' routes 2025-09-26 10:36:53 -06:00
SIP2 Bug 37893: Fix http links 2025-11-18 11:21:20 -07:00
StockRotation Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
AdditionalContents.pm Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
AdvancedEditorMacro.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
ArticleRequests.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Auth.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
AuthorisedValueCategories.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
AuthorisedValues.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Authorities.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
BackgroundJobs.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Biblios.pm Bug 39336: Public Biblio endpoint should honour OpacSuppression syspref 2025-10-24 07:57:00 -06:00
Bookings.pm Bug 40134: Implement optimal item selection for 'any item' bookings 2026-02-10 08:50:56 -07:00
CSPReports.pm Bug 38365: Make swagger-cli happy 2026-03-16 11:57:37 +01:00
Checkouts.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
CirculationRules.pm Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Cities.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
DeletedBiblios.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
ERM.pm Bug 39320: Preparation: ERM counts API endpoint 2026-01-13 15:03:20 -07:00
ExtendedAttributeTypes.pm Bug 39438: (bug 38446 follow-up) Add agreement_period to /erm/extended_attribute_types 2026-01-30 10:54:11 -07:00
Holds.pm Bug 41416: Add skip_fix_priority option to ModReserve 2026-01-16 14:07:18 -07:00
ImportBatchProfiles.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
ImportRecordMatches.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
ItemTypes.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Items.pm Bug 40154: prevent deletion of items with holds 2026-02-10 10:52:04 -07:00
Libraries.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Lists.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
OAuth.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Patrons.pm Bug 40219: Moved Extended Attributes Validation Before Enqueuing Welcome Email 2025-12-17 13:24:34 -07:00
Preservation.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Quotes.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
RecordSources.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
ReturnClaims.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
SearchFilter.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Static.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Suggestions.pm Bug 41076: Adjust our perl tidiness for v20250105 2026-02-05 09:03:51 -07:00
Tickets.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
TransferLimits.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
TwoFactorAuth.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00