AndrewNatoli / wp-rest-api-call-generator

[WIP] Tool with a long name to generate code for accessing your WP REST API endpoints

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Certain route params are not being transcribed properly

AndrewNatoli opened this issue · comments

wp-api-menus has a few route definitions that don't get transcribed properly.

Example:

"/wp-api-menus/v2/menus/(?P<id>\\d+)": {
"namespace": "wp-api-menus/v2",
"methods": [
"GET"
],
"endpoints": [
{
"methods": [
"GET"
],
"args": {
"context": {
"required": false,
"default": "view"
}
}
}
]
},

Gets turned to:

export const getMenusById = (args = {}) => {

  const body = {};
  if (args.context !== undefined) {
    body.context = args.context
  } 

  return WordpressService.doRequest({
    method: "GET",
    url: "wp-api-menus/v2/menus/(?P<id>\d+)"
  })
}