{"id":24926151,"url":"https://github.com/dapi-labs/outdoc","last_synced_at":"2025-10-24T21:03:15.516Z","repository":{"id":65391879,"uuid":"521912310","full_name":"dapi-labs/outdoc","owner":"dapi-labs","description":"Auto generate openAPI document from unit test","archived":false,"fork":false,"pushed_at":"2022-11-10T12:45:39.000Z","size":188,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-24T21:02:03.420Z","etag":null,"topics":["api","api-doc","api-docs-generator","api-documentation-tool","api-generator","openapi"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dapi-labs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-06T10:14:36.000Z","updated_at":"2024-04-17T15:20:33.000Z","dependencies_parsed_at":"2023-01-22T11:15:26.581Z","dependency_job_id":null,"html_url":"https://github.com/dapi-labs/outdoc","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/dapi-labs/outdoc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dapi-labs%2Foutdoc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dapi-labs%2Foutdoc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dapi-labs%2Foutdoc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dapi-labs%2Foutdoc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dapi-labs","download_url":"https://codeload.github.com/dapi-labs/outdoc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dapi-labs%2Foutdoc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280865062,"owners_count":26404447,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-24T02:00:06.418Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-doc","api-docs-generator","api-documentation-tool","api-generator","openapi"],"created_at":"2025-02-02T12:26:04.078Z","updated_at":"2025-10-24T21:03:15.487Z","avatar_url":"https://github.com/dapi-labs.png","language":"TypeScript","readme":"## Outdoc\n\nAuto generate OpenAPI document from local HTTP testing\n\n[![Version](http://img.shields.io/npm/v/outdoc.svg)](https://www.npmjs.org/package/outdoc)\n[![npm download][download-image]][download-url]\n\n[download-image]: https://img.shields.io/npm/dm/outdoc.svg?style=flat-square\n[download-url]: https://npmjs.org/package/outdoc\n\n\n\n\u003cimg width=\"35%\" height=\"35%\" src=\"https://user-images.githubusercontent.com/5305874/193726116-d427aebd-035f-4692-a82f-cfaf3cd4d885.png\"\u003e\n\n_colorful robot writing document by Stable Diffusion_\n\n## Installation\n\n```bash\n$ npm install outdoc -D\n```\n\n## Usage\n\nAdd the following codes into your main file\n\n```js\nconst { OutDoc } = require('outdoc')\nif (process.env.NODE_ENV === \"test\") {\n  OutDoc.init()\n}\n```\n\nRun the command\n\n```bash\n$ npx outdoc [test command] [options]\n```\n\nUsually it could be, for example:\n\n```bash\n$ npx outdoc npm test -t project-name\n```\n\nAdn it will generate an api.yaml in your root folder by defaults\n\n## Options\n\n```\n  -o, --output            file path of the generated doc, format supports json and yaml, default: api.yaml\n  -t, --title \u003cstring\u003e    title of the api document, default: API Document\n  -v, --version \u003cstring\u003e  version of the api document, default: 1.0.0\n  -e, --email \u003cstring\u003e    contact information\n  -f, --force             run the script without adding OutDoc.init in the code \n  -h, --help              display help for command\n```\n\n## Examples\n\nPlease check [examples](https://github.com/dapi-labs/outdoc/tree/main/examples) in here of how to use Outdoc with different frameworks\n\n## Not adding extra codes\nYou might don't wanna add any extra codes in your project only for generating API document, then you can do:\n\nFirst, Check if the **main** in your package.json pointing to your app entry file which export your nodejs server. If not, please add the attribute **outdoc** pointing to it. If you are writting a Typescript project, you need to add the following configuration.\n\n```json\n{\n\t\"outdoc\": {\n\t\t\"main\": \"./src/app.ts\"\n\t}\n}\n```\n\nThen run the command with the option **-f**\n\n```bash\n$ npx outdoc npm test -f\n```\n\n#### What is happending behind `-f`\n\nBy using the option `-f`, Outdoc will first check the **outdoc.main** in your package.json, if it not exist, Outdoc will use **main** in the package.json to find the app entry file.\n\nThen Outdoc will copy the entry app file and insert codes into it, and use the new copied file as the entry app file, the concrete steps are:\n\n1. Find your app entry file from package.json, for example the file is named as app.js\n2. Copy app.js to a new temporary file named tmp_outdoc_file\n3. Insert Outdoc.init into app.js and start running the program to generate the API doc\n4. After the generation finished, copy back the content of tmp_outdoc_file to app.js and remove tmp_outdoc_file\n\n\n## Notes\n\nOutdoc can only understand tests who are sending and receiving real HTTP requests, for example using the [supertest](https://github.com/visionmedia/supertest) in your test cases.\n\nMocked HTTP request won't work with Ourdoc, like fastify.inject.\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdapi-labs%2Foutdoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdapi-labs%2Foutdoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdapi-labs%2Foutdoc/lists"}