Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/sngular/api-mock-runner
- Owner: sngular
- License: mpl-2.0
- Created: 2023-12-21T08:33:19.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-02T12:58:30.000Z (11 months ago)
- Last Synced: 2024-11-07T23:58:04.987Z (2 months ago)
- Topics: api, microservices, mock, mock-server, mocking, openapi
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/@sngular/api-mock-runner
- Size: 421 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
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.