All Projects → stoplightio → Prism

stoplightio / Prism

Licence: apache-2.0
Turn any OpenAPI2/3 and Postman Collection file into an API server with mocking, transformations and validations.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Prism

Mockoon
Mockoon is the easiest and quickest way to run mock APIs locally. No remote deployment, no account required, open source.
Stars: ✭ 3,448 (+38.81%)
Mutual labels:  swagger, openapi, openapi3, mocking, mock-server
Openapi Mock
OpenAPI mock server with random data generation
Stars: ✭ 202 (-91.87%)
Mutual labels:  swagger, openapi, openapi3, mock-server
Spectral
A flexible JSON/YAML linter for creating automated style guides, with baked in support for OpenAPI v2 & v3.
Stars: ✭ 876 (-64.73%)
Mutual labels:  swagger, openapi, openapi3, oas
portman
Port OpenAPI Specs to Postman Collections, inject test suite and run via Newman 👨🏽‍🚀
Stars: ✭ 530 (-78.66%)
Mutual labels:  openapi, oas, api-testing, postman-collection
Openapi Spec Validator
OpenAPI Spec validator
Stars: ✭ 161 (-93.52%)
Mutual labels:  swagger, openapi, openapi3, oas
Studio
The modern editor for API Design and Technical Writing.
Stars: ✭ 459 (-81.52%)
Mutual labels:  swagger, openapi, openapi3, mocking
Openapi Directory
🌐 Wikipedia for Web APIs. Directory of REST API definitions in OpenAPI 2.0/3.x format
Stars: ✭ 2,635 (+6.08%)
Mutual labels:  swagger, openapi, openapi3, oas
openapi-schema-validator
OpenAPI schema validator for Python
Stars: ✭ 35 (-98.59%)
Mutual labels:  swagger, openapi, oas, openapi3
Swagger Ui
Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
Stars: ✭ 21,279 (+756.64%)
Mutual labels:  swagger, openapi, openapi3, oas
Swaggen
OpenAPI/Swagger 3.0 Parser and Swift code generator
Stars: ✭ 385 (-84.5%)
Mutual labels:  swagger, openapi, oas, cli
Openapi Core
OpenAPI core
Stars: ✭ 119 (-95.21%)
Mutual labels:  swagger, openapi, openapi3, oas
Awesome Openapi3
😎 A list of awesome projects related to OpenAPI 3.0.x, curated by the community
Stars: ✭ 469 (-81.12%)
Mutual labels:  swagger, openapi, openapi3, oas
Schemathesis
A modern API testing tool for web applications built with Open API and GraphQL specifications.
Stars: ✭ 768 (-69.08%)
Mutual labels:  swagger, openapi, openapi3, cli
Angular Swagger Ui
An angularJS implementation of Swagger UI
Stars: ✭ 131 (-94.73%)
Mutual labels:  swagger, openapi, openapi3
Oval
oval: CLI for (O)penAPI Specification document (val)idation.
Stars: ✭ 15 (-99.4%)
Mutual labels:  swagger, openapi, cli
Fastapi
FastAPI framework, high performance, easy to learn, fast to code, ready for production
Stars: ✭ 39,588 (+1493.72%)
Mutual labels:  swagger, openapi, openapi3
Restful React
A consistent, declarative way of interacting with RESTful backends, featuring code-generation from Swagger and OpenAPI specs 🔥
Stars: ✭ 1,814 (-26.97%)
Mutual labels:  swagger, openapi, openapi3
Oas Generator
NodeJS RESTful APIs scaffolding based OpenAPI 3.x specs using oas-tools and express.
Stars: ✭ 32 (-98.71%)
Mutual labels:  openapi3, oas, cli
Rapipdf
PDF generation from OpenAPI / Swagger Spec
Stars: ✭ 132 (-94.69%)
Mutual labels:  swagger, openapi, openapi3
Springdoc Openapi
Library for OpenAPI 3 with spring-boot
Stars: ✭ 1,113 (-55.19%)
Mutual labels:  swagger, openapi, openapi3

Prism - API Mock Servers and Contract Testing

CircleCI NPM Downloads Stoplight Forest

Prism is a set of packages for API mocking and contract testing with OpenAPI v2 (formerly known as Swagger) and OpenAPI v3.x.

  • Mock Servers: Life-like mock servers from any API Specification Document.
  • Validation Proxy: Contract Testing for API Consumers and Developers.
  • Comprehensive API Specification Support: OpenAPI v3.1, OpenAPI v3.0, OpenAPI v2.0 (formerly Swagger) and Postman Collections.

Demo of Prism Mock Server being called with curl from the CLI

Note: This branch refers to 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

Overview

🧰 Installation and Usage

Installation

Prism requires NodeJS >= 12 to properly work.

npm install -g @stoplight/prism-cli

# OR

yarn global add @stoplight/prism-cli

For more installation options, see our installation documentation.

Mocking

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.

prism mock https://raw.githack.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore-expanded.yaml

Learn more about how the mock server works.

Validation Proxy

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.

prism proxy examples/petstore.oas2.yaml https://petstore.swagger.io/v2

Learn more about how the validation proxy works.

📖 Documentation and Community

🚧 Roadmap

Submit your ideas for new functionality on the Stoplight Roadmap.

FAQs

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.

Is there a hosted version of Prism?

Yes, hosted mocking is available as part of Stoplight Platform. Learn More

⚙️ Integrations

  • Stoplight Studio: Free visual OpenAPI designer that comes integrated with mocking powered by Prism.
  • Stoplight Platform: Collaborative API Design Platform for designing, developing and documenting APIs with hosted mocking powered by Prism.

🏁 Help Others Utilize Prism

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 🎉

👏 Contributing

If you are interested in contributing to Prism itself, check out our contributing docs ⇗ and code of conduct ⇗ to get started.

🎉 Thanks

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!

🌲 Sponsor Prism by Planting a Tree

If you would like to thank us for creating Prism, we ask that you buy the world a tree.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].