apifox-ptfe-gen
v1.1.1
Published
Generate TypeScript API modules from Swagger/OpenAPI and Apifox shared docs
Maintainers
Readme
apifox-ptfe-gen
Generate TypeScript API files from Swagger/OpenAPI docs and Apifox shared docs.
Usage
- Put config in your project
package.json:
{
"apifoxPtfeGen": {
"url": "https://s.apifox.cn/<share-id>",
"outDir": "src/Apis",
"full": false
}
}apifoxPtfeGen is preferred, but the legacy swaggerPtfeGen / swagger-ptfe-gen keys are still supported for compatibility.
- Run command:
apifox-ptfe-genOr override by CLI args:
apifox-ptfe-gen --url https://s.apifox.cn/<share-id> --outDir src/ApisSupported input URLs
- Swagger / OpenAPI JSON URLs
- Swagger UI HTML pages that expose a
url/urlsconfig or/swagger.json//v2/api-docs - Apifox public share root URLs such as
https://s.apifox.cn/<share-id> - Apifox public share detail URLs such as
https://s.apifox.cn/<share-id>/<detail-id> - Single Apifox markdown pages such as
https://s.apifox.cn/<share-id>/<detail-id>.md
Apifox support notes
- Apifox support only targets public
s.apifox.cnshare links. - Share roots and detail pages expand through
llms.txt, so the whole shared document set is generated. - Direct
.mdURLs only generate the single API page they point to. - The current normalization layer supports JSON request bodies plus path/query/header/cookie parameters.
- Non-JSON request bodies such as
multipart/form-dataare rejected with a clear error message.
