https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38365

--- Comment #255 from Lari Taskula <[email protected]> ---
Created attachment 194449
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=194449&action=edit
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

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to