-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[gatsby-source-wordpress] add config option to manipulate list of endpoint we fetch #17943
Comments
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing! Thanks for being a part of the Gatsby community! 💪💜 |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Thanks again for being part of the Gatsby community! 💪💜 |
With v4 of |
There is need for users to be able to manipulate list of endpoints we get from wp rest introspection endpoint. This includes setting query params on routes and adding/removing routes.
Use cases for it are:
lang
query param on post types endpoints + hitting them for each language)There were few attempts to implement this ( #10942 , #10335 ), but those implementations didn't allow for general purpose, robust system (they were mostly geared toward fixing particular use case)
I'd like to propose solution that is similar to wordpress filters, where user will be able to programatically manipulate list of endpoints with config option (and is similar to how
normalizer
config option works), where it's optional function that get list of endpoints, do some processing on it and return modified list to wordpress plugin:routesFilter
is not final name of the config option - please comment on better name for it.routes
would be array of objects with following fields:Ultimate goal here is to create API that later on can be packaged into reusable
gatsby-source-wordpress
subplugins (see gatsbyjs/rfcs#23 ). Creating subplugin system wouldn't be in scope for initial implementation. This features is just first step on path to be able to do this.Implementation:
Split
gatsby/packages/gatsby-source-wordpress/src/fetch.js
Lines 557 to 650 in 4af3f91
routes
list (but doesn't dowhitelist
/blacklist
filtering)filterRoutes
function (if it is defined)whitelist
/blacklist
filtersAdjust
gatsby/packages/gatsby-source-wordpress/src/fetch.js
Lines 396 to 399 in 4af3f91
queryParams
object in route objectFigure out where in
gatsby/packages/gatsby-source-wordpress/src/fetch.js
Lines 252 to 369 in 4af3f91
normalizer
function for given route (this is a bit tricky, becausegatsby-source-wordpress
already have special support for some wordpress plugins - do we want to apply normalization before or after those special cases?)References:
See #10942 (comment) comment (that contains some of information in this issue) about motivation and "roadmap" to be able to create wordpress subplugins in smaller incremental steps
The text was updated successfully, but these errors were encountered: