Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Auto generate OpenAPI document from local HTTP testing
colorful robot writing document by Stable Diffusion
$ npm install outdoc -D
Add the following codes into your main file
const { OutDoc } = require('outdoc')
if (process.env.NODE_ENV === "test") {
OutDoc.init()
}
Run the command
$ npx outdoc [test command] [options]
Usually it could be, for example:
$ npx outdoc npm test -t project-name
Adn it will generate an api.yaml in your root folder by defaults
-o, --output file path of the generated doc, format supports json and yaml, default: api.yaml
-t, --title <string> title of the api document, default: API Document
-v, --version <string> version of the api document, default: 1.0.0
-e, --email <string> contact information
-f, --force run the script without adding OutDoc.init in the code
-h, --help display help for command
You might don't wanna add any extra codes in your project only for generating API document, then you can do:
First, 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.
{
"outdoc": {
"main": "./src/app.ts"
}
}
Then run the command with the option -f
$ npx outdoc npm test -f
-f
By 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.
Then 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:
Outdoc can only understand tests who are sending and receiving real HTTP requests, for example using the supertest in your test cases.
Mocked HTTP request won't work with Ourdoc, like fastify.inject.
MIT
FAQs
Auto-generate OpenAPI document for Node.js service from the local testing
The npm package outdoc receives a total of 1 weekly downloads. As such, outdoc popularity was classified as not popular.
We found that outdoc demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.