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

--- Comment #2 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 211087
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211087&action=edit
Bug 44035: (follow-up) Rename payload to validated_payload and drop the
fallback

The helper returns what the OpenAPI plugin validated, coerced to the types
the body schema declares. That is what sets it apart from $c->req->body, the
raw bytes, and $c->req->json, a plain parse of them, so the name should say
so. $c->validated_payload does.

The name also exposed a hole: when nothing had been stashed yet, the helper
fell back to parsing the body itself. That value was neither validated nor
coerced, so called before $c->openapi->valid_input it quietly returned
something the name would no longer describe. The fallback is gone. Without
validation there is nothing validated to return, so a warning is logged and
undef is returned, and the raw body is still $c->req->body.

Considered and not done: exposing it as $c->openapi->validated_payload, next
to the OpenAPI plugin's own helpers. It would avoid adding a top-level helper
name, but it is longer to type in every controller, and the plugin does not
own this value. It would be a small change to register it there too if we
prefer that.

To test:
1. prove t/db_dependent/Koha/REST/V1.t \
         t/db_dependent/Koha/REST/Plugin/PluginRoutes.t \
         t/db_dependent/api/v1/iso18626/

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to