Giter VIP home page Giter VIP logo

openapi-mock's Introduction

OpenAPI Mock Server

CI Scrutinizer Code Quality Code Coverage GitHub release (latest by date)

OpenAPI API mock server with random data generation by specified schemas.

  • OpenAPI 3.x support.
  • Load specification from a local file or URL.
  • JSON and YAML format supported.
  • Generates fake response data by provided schemas or by examples.
  • Content negotiation by Accept header.
  • Can be used as standalone application (Linux and Windows) or can be run via Docker container.

Supported features

Feature Support status
generating xml response basic support (without xml tags)
generating json response supported
generation of basic types supported
generation of enums supported
generation of associative arrays supported
generation of combined types supported (without tag not and discriminator)
local reference resolving supported
remote reference resolving not supported
URL reference resolving not supported
validating request data not supported
force using custom response schema not supported (schema detected automatically)

Quick start

Download latest binary and run a server.

# runs a local server on port 8080
./openapi-mock serve --specification-url https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml

# to test that the server successfully ran
curl 'http://localhost:8080/v1/pets'

Alternatively, you can use Docker image.

# downloads an image
docker pull muonsoft/openapi-mock

# runs a docker container with exported port 8080
docker run -p 8080:8080 -e "OPENAPI_MOCK_SPECIFICATION_URL=https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml" --rm muonsoft/openapi-mock

# to test that the server successfully ran
curl 'http://localhost:8080/v1/pets'

Also, you can use Docker Compose. Example of docker-compose.yml

version: '3.0'

services:
  openapi_mock:
    container_name: openapi_mock
    image: muonsoft/openapi-mock
    environment:
      OPENAPI_MOCK_SPECIFICATION_URL: 'https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml'
    ports:
      - "8080:8080"

To start up a container run command.

docker-compose up -d

Usage guide

License

This project is licensed under the MIT License - see the LICENSE file for details.

openapi-mock's People

Contributors

strider2038 avatar nqlad avatar hugochinchilla avatar goodwix-owner avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.