documentation
documentation copied to clipboard
[Request]: Using strapi-utils into v4 is correct?
Summary
This page seems that are loading this library:
const { parseMultipartData, sanitizeEntity } = require('strapi-utils');
It is correct? or its better to use the newest "@strapi/utils"
If we need to use newest, I cant found sanitizeEntity, how is the update? Please can you check this page to check if this example is correct for v4
Why is it needed?
To help people to Create is owner policy
Suggested solution(s)
Update documentation
Related issue(s)/PR(s)
No response
HI @biko8 Thank you for creating this issue. I'm sorry you're having trouble.
The "is-owner policy" guide has not been updated to Strapi v4 yet. I will work with solution engineers and/or devs to see how we can update it :-)
I will double-check with back-end devs but from my understanding:
-
Indeed,
strapi-utils
is now@strapi/utils
as you can see in the dependencies section of the code migration guide -
Strapi v4 does not use
sanitizeEntity
anymore, these utilities have been replaced bysanitizeInput
andsanitizeOutput
(this is mentioned for instance in the controllers migration documentation)
Hi and apologies it took so long to get an answer from the Strapi Documentation team. 2 ways of creating an "is-owner policy" are now documented: using a custom middleware or using a custom policy, and the controllers documentation was also updated several times about sanitization. I'll close this issue for now, thanks again for your precious feedback!