Why Files Were Deleted & How to Restore
What was deleted (from git status)
docs/api/onramp/– entire folder (e.g.onramp-1-user-login.api.mdx,onramp-2-fetch-kyc-status.api.mdx, etc.)docs/api/offramp/– entire folder (e.g.offramp-1-user-login.api.mdx, etc.)docs/On-Ramp/Overview.md
Why it happened
The npm run gen-api-docs script in package.json does this:
rm -rf docs/api && docusaurus gen-api-docs all && ...
So it removes the whole docs/api folder before generating API docs from swagger.yaml.
The plugin then only creates a flat layout under docs/api/ (e.g. 1-user-login.api.mdx, 2-fetch-kyc-status.api.mdx).
It does not recreate docs/api/onramp/ or docs/api/offramp/.
So when gen-api-docs was run:
rm -rf docs/apideleted everything indocs/api, including:docs/api/onramp/and all its.api.mdxfilesdocs/api/offramp/and all its.api.mdxfiles- Any other custom files under
docs/api/
- The plugin only wrote the new flat files (
api/1-user-login.api.mdx, etc.).
That’s why the onramp/offramp files and anything else only in docs/api disappeared.
How to restore the deleted files
From the repo root, run:
# Restore deleted API onramp/offramp folders and On-Ramp overview
git checkout HEAD -- docs/api/onramp/ docs/api/offramp/ docs/On-Ramp/
That brings back the deleted files from the last commit.
If some of those were already deleted in an earlier commit, use:
git checkout <commit-before-gen-api-docs> -- docs/api/onramp/ docs/api/offramp/ docs/On-Ramp/
(replace <commit-before-gen-api-docs> with the commit hash from before you ran gen-api-docs).
After restoring
- Your sidebars were changed to use the flat doc ids (e.g.
api/1-user-login).
If you want to use the onramp/offramp structure again, the sidebars (and any links in guides) need to point back toapi/onramp/onramp-*andapi/offramp/offramp-*. - You will then have both:
- Flat API docs:
api/1-user-login.api.mdx, etc. - Onramp/Offramp docs:
api/onramp/...,api/offramp/...
You can either keep both and wire sidebars to one set, or remove the flat duplicates if you only use onramp/offramp.
- Flat API docs:
Avoiding this in the future
- Don’t run
gen-api-docsif you need to keep a customdocs/apistructure (e.g. onramp/offramp), or - Change the script so it doesn’t wipe the whole folder, for example:
- Remove
rm -rf docs/apiand only delete/regenerate the files the plugin actually creates, or - Generate into a temp dir and then merge/copy into
docs/apiwithout deleting onramp/offramp.
- Remove