
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
swagger-mock-validator
Advanced tools
A CLI tool to validate mocks against swagger/OpenApi specs.
For a list of all the validation features see FEATURES.md.
Install the tool using npm
npm install --global swagger-mock-validator
Invoke the tool with a path or url to a Swagger or OpenApi file and a path or url to a mock file. These files should be in json format.
swagger-mock-validator /path/to/swagger.json /path/to/pact.json
swagger-mock-validator https://api.com/swagger.json https://pact-broker.com/pact.json
swagger-mock-validator /path/to/swagger.json https://pact-broker.com/pact.json
Invoking this command will confirm the Swagger/OpenApi spec and mock are compatible with each other. FEATURES.md contains the details of what is verified.
If the two files are compatible with each other an exit status of 0 is returned.
If the two files are not compatible with each other an exit status of 1 is returned, along with a message containing the reason why the two files are not compatible.
The depth of the objects in the output can be modified by using --outputDepth
flag, default depth is 4.
swagger-mock-validator spec.json mock.json --outputDepth 5
For more options on how to use the command run the command with the help flag.
swagger-mock-validator --help
Provider services can easily verify all the consumer pact files uploaded to a Pact Broker using this tool. Invoke the tool with a url to the Pact Broker along with the name of the provider service and the tool will automatically discover and validate the latest versions of the consumer pact files for the provider service.
swagger-mock-validator /path/to/swagger.json https://pact-broker.com --provider my-provider-name
Additionally, provide a Pact Broker version tag alongside the name of the provider service to filter the retrieved consumer pacts for the provider by the given tag.
swagger-mock-validator /path/to/swagger.json https://pact-broker.com --provider my-provider-name --tag production
If the Pact Broker is behind basic auth, you can pass credentials with the --user
option while invoking the tool.
swagger-mock-validator /path/to/swagger.json https://pact-broker.com --provider my-provider-name --user BASIC_AUTH_USER:BASIC_AUTH_PASSWORD
The tool can be configured to send analytics events to a server of your choosing. Use the --analyticsUrl
flag to pass a url that the tool should post the event to. The tool will send this event via a http post request and will timeout after 5 seconds. See analytics.ts for the post body schema.
swagger-mock-validator /path/to/swagger.json /path/to/pact.json --analyticsUrl https://analytics-server.com/event
Any errors sending the analytic events are ignored and do not impact the validation results, a successful validation that had an error while trying to send the analytic event is still a successful validation.
By default analytics are disabled. To protect your privacy this is an opt-in feature.
See CHANGELOG.md
See CONTRIBUTING.md
See LICENSE.txt
FAQs
A CLI tool to validate mocks against swagger/OpenApi specs.
The npm package swagger-mock-validator receives a total of 512 weekly downloads. As such, swagger-mock-validator popularity was classified as not popular.
We found that swagger-mock-validator demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.