Skip to content

Support Payload api route config#77

Open
mzronek wants to merge 4 commits into
janbuchar:masterfrom
mzronek:dynamic-api-basepath
Open

Support Payload api route config#77
mzronek wants to merge 4 commits into
janbuchar:masterfrom
mzronek:dynamic-api-basepath

Conversation

@mzronek

@mzronek mzronek commented May 14, 2026

Copy link
Copy Markdown

The current implementation always uses /api as base path for all Payload routes. This will produce an invalid spec if the Payload config uses routes.api to customize the api route path. This PR fixes the issue and adds the possibility to customize it completely.

@janbuchar

Copy link
Copy Markdown
Owner

Hi @mzronek and thanks for your contribution! How does this compare to #76?

mzronek added 2 commits May 14, 2026 21:59
… hardcoding /api, add another test to check if the payload api route config works
@mzronek

mzronek commented May 14, 2026

Copy link
Copy Markdown
Author

@janbuchar Glad to support the project!

Unfortunately I missed this PR. It is very close to mine. The only difference is, that my approach allows the apiBasePath to bet set freely in the plugin options. Otherwise it defaults to the currently configured Payload api route. Sorry for any inconvenience.

I updated my PR, because I liked the idea of the previous PR to use the sanitized payload config from the req object to avoid hardcoding "/api". I also added a second test to properly test changes to the Payload config.
In addition I added the correct Zed config to be able to work correctly with Biome. Without the correct Zed setup even running yarn lint:fix can't undo small style changes for long lines due to introduced commas.

Comment thread .zed/settings.json Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants