Gathering detailed insights and metrics for @stoplight/prism-cli
Gathering detailed insights and metrics for @stoplight/prism-cli
Gathering detailed insights and metrics for @stoplight/prism-cli
Gathering detailed insights and metrics for @stoplight/prism-cli
npm install @stoplight/prism-cli
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
4,341 Stars
2,026 Commits
349 Forks
55 Watching
30 Branches
142 Contributors
Updated on 27 Nov 2024
TypeScript (98.89%)
Dockerfile (0.53%)
JavaScript (0.45%)
Shell (0.13%)
Cumulative downloads
Total Downloads
Last day
-16.4%
13,890
Compared to previous day
Last week
4.5%
77,162
Compared to previous week
Last month
5.9%
335,558
Compared to previous month
Last year
32.4%
3,297,346
Compared to previous year
Prism is a set of packages for API mocking and contract testing with OpenAPI v2 (formerly known as Swagger) and OpenAPI v3.x.
Prism provides:
Stoplight provides hosted mock servers for convenience so that API consumers can experiment with an API without the need for backend code.
Use one of these options for instant, hosted mock servers:
Learn more in the hosted Prism documentation.
Prism is an open-source HTTP server run from the command-line. It provides mocking, request validation, and content negotiation. Use it standalone tool or in continuous integration.
This information refers to Open Source Prism 3.x, which is the current version most likely you will use. If you're looking for the 2.x version, look at the 2.x
branch
Prism requires
1npm install -g @stoplight/prism-cli 2 3# OR 4 5yarn global add @stoplight/prism-cli
For more installation options, see our installation documentation.
Prism can help you create a fake "mock" based off an OpenAPI document, which helps people see how your API will work before you even have it built. Run it locally with the prism mock
command to run your API on a HTTP server you can interact with.
1prism mock https://raw.githack.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore-expanded.yaml
Learn more about how the mock server works.
Prism can help you check for discrepencies between your API implementation and the OpenAPI document that describes, letting you funnel HTTP traffic through it with the prism proxy
command.
1prism proxy examples/petstore.oas2.yaml https://petstore.swagger.io/v2
Learn more about how the validation proxy works.
Cannot access mock server when using Docker?
Prism uses localhost by default, which usually means 127.0.0.1. When using docker the mock server will
be unreachable outside of the container unless you run the mock command with -h 0.0.0.0
.
Why am I getting 404 errors when I include my basePath?
OpenAPI v2.0 had a concept called "basePath", which was essentially part of the HTTP path the stuff
after host name and protocol, and before query string. Unlike the paths in your paths
object, this
basePath was applied to every single URL, so Prism v2.x used to do the same. In OpenAPI v3.0 they
merged the basePath concept in with the server.url, and Prism v3 has done the same.
We treat OAS2 host + basePath
the same as OAS3 server.url
, so we do not require them to go in
the URL. If you have a base path of api/v1
and your path is defined as hello
, then a request to
http://localhost:4010/hello
would work, but http://localhost:4010/api/v1/hello
will fail. This
confuses some, but the other way was confusing to others. Check the default output of Prism CLI to
see what URLs you have available.
Submit your ideas for new functionality on the Stoplight Roadmap.
If you're using Prism for an interesting use case, contact us for a case study. We'll add it to a list here. Spread the goodness 🎉
If you are interested in contributing to Prism itself, check out our contributing docs ⇗ and code of conduct ⇗ to get started.
Prism is built on top of lots of excellent packages, and here are a few we'd like to say a special thanks to.
Check these projects out!
If you would like to thank us for creating Prism, we ask that you buy the world a tree.
No vulnerabilities found.
Reason
12 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 23/25 approved changesets -- score normalized to 9
Reason
4 existing vulnerabilities detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
Project has not signed or included provenance with any releases.
Details
Reason
security policy file not detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More