Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ concurrency:

jobs:
build:
if: ${{ github.repository == 'ozgen/openapi-sample-emulator' }}
if: ${{ github.repository == 'greenbone/gvm-openapi-emulator' }}
strategy:
fail-fast: false
matrix:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ APP_NAME ?= emulator
MAIN_PKG ?= ./cmd/emulator

# Docker
IMAGE_NAME ?= openapi-sample-emulator:local
IMAGE_NAME ?= gvm-openapi-emulator:local

# Run config
HOST ?= 0.0.0.0
Expand Down
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
![Greenbone Logo](https://www.greenbone.net/wp-content/uploads/gb_new-logo_horizontal_rgb_small.png)

# gvm-openapi-emulator

![CI](https://github.com/greenbone/gvm-openapi-emulator/actions/workflows/ci.yml/badge.svg)
![Lint](https://github.com/greenbone/gvm-openapi-emulator/actions/workflows/lint.yml/badge.svg)
![Format](https://github.com/greenbone/gvm-openapi-emulator/actions/workflows/format.yml/badge.svg)

`gvm-openapi-emulator` is a lightweight HTTP emulator that serves predefined responses based on an OpenAPI / Swagger specification.

It is designed for **local development**, **integration testing**, and **CI environments** where deterministic and predictable API behavior is required.
Expand All @@ -12,6 +18,39 @@ It is designed for **local development**, **integration testing**, and **CI envi

---

## How to use

Clone the repository and run locally:

```bash
git clone https://github.com/greenbone/gvm-openapi-emulator.git
cd gvm-openapi-emulator
make run
```

### Using Makefile

The repository includes a `Makefile` with helpful targets:

```bash
make build # Build the binary into ./bin/emulator
make run # Build and run the emulator (uses SPEC_PATH / SAMPLES_DIR defaults)
make test # Run all tests
make cover # Run tests with coverage and generate reports (coverage.html)

make format # Format code with goimports + gofumpt + gofmt
make lint # Run golangci-lint
make tidy # Run go mod tidy

make docker-build # Build Docker image (gvm-openapi-emulator:local)
make docker-run # Run Docker image with example volume mount
make compose-up # Start via docker compose
make compose-down # Stop docker compose
make clean # Remove build and coverage artifacts
```

---

## What it does

* Reads an OpenAPI / Swagger specification
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ services:
build:
context: .
dockerfile: Dockerfile
image: openapi-sample-emulator:local
image: gvm-openapi-emulator:local
ports:
- "${EMULATOR_HOST_PORT:-8086}:8086"
environment:
Expand Down
Loading