-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(documentation): use correct localization schema #18580
fix(documentation): use correct localization schema #18580
Conversation
Maby a stupit question but should we not check if i18n plugin is installed and enabled before we add "ListResponseDataItemLocalized" or maby make this documentation come from the i18n package. |
Also @ciriousjoker Mind adding fixes: #18577 to your initial message so that it properly links the issue and your PR. |
Do you mean adding it to the commit message or to the PR message? |
Should I bother to keep this in sync with the main branch or can I do it once right before it's (hopefully) being merged? |
Idk don't work for strapi soo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good. I'll just want to test it when I have a second later. I just had one small request 🙏 .
packages/plugins/documentation/server/services/helpers/utils/clean-schema-attributes.js
Outdated
Show resolved
Hide resolved
Co-authored-by: markkaylor <mkaylor.guitar@gmail.com>
Not sure how to fix the PR labels. @markkaylor Do I need to do anything? |
Thanks for reviewing it. Any eta for when this will be merged? |
What does it do?
The generated
full_documentation.json
contains an error in thelocalizations
property. Thelocalizations
property only shows up when strapi-plugin-populate-deep is also installed, but the issue is in the documentation plugin, not strapi-plugin-populate-deep.The edited line is only hit once in the debugger and patching it seems to do exactly what I want and nothing else. It's used in production at our company.
Why is it needed?
Without this, the localization field in the schema doesn't match the actual api response. The api response contains an id & attributes, which then contain the actual data. The schema makes it seem like the localization field already contains the data.
Api response via Postman:
How to test it?
Related issue(s)/PR(s)
Context
We had a pretty scuffed
package-lock.json
at some point, which for whatever reason produced a correctfull_documentation.json
schema. However, I couldn't reproduce this correct behavior when deleting thepackage-lock.json
& thenode_modules
folder. In the workingfull_documentation.json
, it used this name:ArticleListResponseDataItemLocalized
, so when I had the option of choosing the suffix, I chose the one that most closely resembled the (I assume) original, correct behavior.