Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sngular/api-mock-runner

Create mocks servers with its schemas from OpenAPI 3.0.0 spec files
https://github.com/sngular/api-mock-runner

api microservices mock mock-server mocking openapi

Last synced: about 1 month ago
JSON representation

Create mocks servers with its schemas from OpenAPI 3.0.0 spec files

Awesome Lists containing this project

README

        

# Welcome to api-mock-runner 👋

Run multiple mock servers from one or more [OpenAPI Specification](https://www.openapis.org/).

Schemas can be provided from a remote origin (https:// or git@) or a local path.

Remote and circular references are allowed.

## 📘 Usage

You can use api-mock-runner in a three different ways. All of them starts a CLI guided journey:

### 1. NPX (No installation needed)

```sh
npx @sngular/api-mock-runner
```

### 2. Globally

```sh
sudo npm install --global @sngular/api-mock-runner
```

To use: type `api-mock-runner` in the terminal.

### 3. Current project dev dependency

```sh
npm i --save-dev @sngular/api-mock-runner
```

### Manual options

You could avoid CLI interaction by using `api-mock-runner` with flags.
To explore manual options, use -h flag:

```sh
npx @sngular/api-mock-runner -h
```

```sh
Usage: api-mock-runner [options]

Options:
-o, --origin path or repo containing schemas
-s, --schema [schemaPaths...] path to schemas
-p, --port [ports...] port to serve each schema
-r, --run-config use saved config
-h, --help display help for command
```

### Response selection

The application will return the first response found in the schema by default. To use another existing response, use `prefer` header with the content `statusCode=XXX` in the request.

```
prefer: statusCode=500
```

## Architectural Decision Record (ADR)

Here you can find [architectural decisions records](docs/adr/)

## ❤️ Special thanks

We would like to express our special thanks to [open-api-mocker](https://github.com/jormaechea/open-api-mocker), which is used to set up a mock server.