A small server for generating ad hoc mock servers based on an OpenAPIv3 specification.
For architecture details, see ARCHITECTURE
To try it out quickly:
$ docker pull floriank/mimicry
and a
$ docker run -p 8080:8080 floriank/mimicry
By default, servers are available under the special __mimicry
path:
$ curl --header "Content-Type: application/json" \
http://localhost:8080/__mimicry
If you'd like to try out how it works, post a valid OpenAPIv3 to create a mock server:
$ curl --header "Content-Type: application/json" \
--request POST \
--data '{"spec": { /* your OpenAPIv3 Spec */ }}'' \
http://localhost:8080/__mimicry
Following up with a
# The host you're using needs to be part of your OpenAPIv3 Specification in info.servers[]
$ curl --header "X-Mimicry-Host: https://my.production.api.info" \
http://localhost:8080/
should return you the specification.
❗ NOTE: Mimicry uses the title
and version
fields to generate an id for your particular spec. the URL passed to X-Mimicry-Host
is one of the server URLs defined in your specification.
You can add a set of specifications upon startup:
$ docker run -v `pwd`/my-specs:/specifications -p 8080:8080 floriank/mimicry
The project comes with a small docker-compose
setup. You can use make
to get started:
# to get the local image built
$ make setup
# to start the local development server
$ make up
You should be able to reach mimicry
at localhost:4000. Have a look at config/dev.exs
if you wish to change ports.
Not recommended, but mimicry
is just a Phoenix powered Elixir Application with no dependencies. So you can always run:
# copy over the config sample
$ cp ./config/dev.exs.sample ./config/dev.exs
# get the deps
$ mix deps.get
# run the server directly
$ mix phx.serve
Some ways to customizing your iex
experience are included in this mode.
The logo was designed by the most excellent Agatha Schnips. It's released under CC BY 4.0. You may use, change and alter it, as long as you attribute the original author and indicate changes made.
- Coverage of most of the OpenAPIv3 specification, offering opinionated servers
- Allow for creating simple GraphQL endpoints based on the schemata provided
- Simple installation/running via docker container