Sign inSign up

beavuck/hermit

By beavuck

•Updated 11 days ago

Hermit is an OpenAPI mock server. No stubs to write, sensible defaults, configurable.

Image
API management
Developer tools
Web servers
1

4.4K

beavuck/hermit repository overview

⁠🦀🐚 Beavuck Hermit

Hermit is an OpenAPI mock server. Point it at a spec file, and it instantly serves schema-accurate responses -- no stubs to write, sensible defaults, configurable.

⁠Quick start

Mount your specs directory and point HERMIT_SPECS_DIR at it:

docker run --rm --pull=always \
  -p 8532:8532 \
  -v ./your-specs:/specs:ro \
  -e HERMIT_SPECS_DIR=specs \
  beavuck/hermit

Your mock server is now running on port 8532.

⁠docker-compose

hermit:
  image: beavuck/hermit:latest
  pull_policy: always
  environment:
    HERMIT_SPECS_DIR: specs
  ports:
    - "8532:8532"
  volumes:
    - ./your-specs:/specs:ro

⁠Loading specific files

To load individual files rather than a whole directory, use HERMIT_SPECS with a comma-separated list:

docker run --rm --pull=always \
-p 8532:8532 \
-v ./your-specs:/specs:ro \
-e HERMIT_SPECS=specs/users-api.openapi.yml \
beavuck/hermit

⁠Environment variables

VariableDefaultDescription
HERMIT_SPECS_DIR(required)Path to a directory of OpenAPI spec files (conflicts with HERMIT_SPECS)
HERMIT_SPECS(required)Comma-separated paths to individual spec files (conflicts with HERMIT_SPECS_DIR)
HERMIT_PORT8532Internal port to listen on
HERMIT_MIN_ITEMS1Minimum items in generated arrays
HERMIT_MAX_ITEMS20Maximum items in generated arrays
HERMIT_USE_EXAMPLESfalseUse example fields from schemas instead of generating random data
HERMIT_CORS_ALLOWED_ORIGINS*Allowed CORS origins; * for all, or comma-separated list

⁠How responses are generated

PrioritySourceWhen
1Request body fieldsPOST, PUT, PATCH -- your values are reflected back in the response
2example in schemaField has an explicit example value (and HERMIT_USE_EXAMPLES is true)
3default in schemaField has a default value (and HERMIT_USE_EXAMPLES is true)
4Random valueFallback -- format-aware (UUID, date-time, …)

Fields marked readOnly are never overridden by request body values. Fields marked writeOnly are excluded from responses.

⁠Source

gitlab.com/beavuck-services/hermit⁠

Tag summary

Content type

Image

Digest

sha256:811dc1e47…

Size

1.2 MB

Last updated

11 days ago

docker pull beavuck/hermit