Prism. The perfect OAS (Swagger) companion.

Supercharge any OAS file with mocking, transformations, validations, and more.

v0.3.3 - October 26th, 2016
Follow @stoplightio to hear about new releases.
RUN IT
1) curl https://raw.githubusercontent.com/stoplightio/prism/master/install.sh | sh
2) prism run --mock --list --spec http://petstore.swagger.io/v2/swagger.json

Instant Mock Server

Starting Prism with the --mock flag will create a mock server, built off of the given OAS specification file.

If a request comes in for a response without a defined example, Prism will dynamically generate a response based on the response’s schema.

Automatic Request Validation

Simulates real server behavior by automatically validating incoming request headers, query string, and bodies, against your OAS specification.

If validation fails, Prism will return a 400 response with helpful error messages.

Request Transformations

Need a mocked response property to always be a random future date? No problem. Prism extends the swagger spec with simple scripts, written in plain Javascript.

Write scripts for more complex mocking behavior, custom validations, and much more. You can even use Prism as a full blown network proxy, and setup scripts to block access to certain websites.

Simple & Free

Prism was born out of the StopLight modeling tools, and is integrated into the StopLight API Designer. Running it standalone is completely free, and since it has zero dependencies, extremely simple!

Just download and run it from your command line. Easy as 1..2..

Features

Mocking

Turns any OAS file into a
mock server.

List

Pretty print the paths of any OAS file to your terminal.

Spec Validation

Validate any OAS file from your
terminal.

Dynamic Responses

Generates responses from your JSON schemas.

HTTP Validation

Validates requests / responses against your OAS definition.

Before Scripts

Simple JS scripts invoked before traffic reaches your server.

Logging

Optionally log traffic to an HTTP location, or MongoDB.

Hot Reload

Automatically reloads when your spec file changes.

After Scripts

Simple JS scripts invoked on traffic returning from your server.

Full Proxy

Can be used as a system-wide
proxy.

MITM

Can be used as a MITM proxy, with HTTPS traffic.

Dependency Free

Just download and run. Prism has no external requirements.