Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
swagger-cli
Advanced tools
Command-line tool to parse, validate, and serve Swagger-based REST APIs
The swagger-cli npm package is a command-line tool for working with Swagger and OpenAPI definitions. It provides various functionalities such as validating, bundling, dereferencing, and serving API definitions.
Validate
This feature allows you to validate your Swagger/OpenAPI definition to ensure it is correctly formatted and adheres to the specification.
swagger-cli validate my-api.yaml
Bundle
This feature bundles multiple Swagger/OpenAPI files into a single file. This is useful for managing large APIs split across multiple files.
swagger-cli bundle my-api.yaml --outfile bundled-api.yaml
Dereference
This feature dereferences $ref pointers in your Swagger/OpenAPI definition, replacing them with the actual content they point to. This can be useful for simplifying the API definition.
swagger-cli dereference my-api.yaml --outfile dereferenced-api.yaml
Serve
This feature serves your Swagger/OpenAPI definition over HTTP, allowing you to view and interact with it using a web browser.
swagger-cli serve my-api.yaml
Swagger Parser is a powerful library for parsing, validating, and dereferencing Swagger and OpenAPI definitions. It offers similar functionalities to swagger-cli but is more focused on being used as a library within Node.js applications rather than a command-line tool.
Speccy is a command-line tool for working with OpenAPI specifications. It provides features like validation, linting, and bundling. It is similar to swagger-cli but includes additional features like linting to enforce best practices.
Alpha Code! |
---|
Swagger CLI is still being written. It's not ready to use yet. Check back later, once we release v1.0.0 |
$ref
pointersInstall using npm. Install it globally (using the -g
flag) to run it from any terminal window.
npm install -g swagger-cli
swagger <command> [options] <filename>
Commands:
validate Parses and validates a Swagger file
dereference Dereferences all $ref pointers in a Swagger file
bundle Bundles multiple Swagger files into a single file
serve Serves a Swagger file via a built-in HTTP REST server
Options:
-h, --help Show help for any command
-v, --version Output the CLI version number
I welcome any contributions, enhancements, and bug-fixes. File an issue on GitHub and submit a pull request.
To build/test the project locally on your computer:
Clone this repo
git clone https://github.com/BigstickCarpet/swagger-cli.git
Install dependencies
npm install
Run the build script
npm run build
Run the unit tests
npm run mocha
(just the tests)
npm test
(tests + code coverage)
Swagger CLI is 100% free and open-source, under the MIT license. Use it however you want.
FAQs
Swagger 2.0 and OpenAPI 3.0 command-line tool
The npm package swagger-cli receives a total of 177,107 weekly downloads. As such, swagger-cli popularity was classified as popular.
We found that swagger-cli demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.