Search code examples
mockingswaggerswagger-2.0openapi

Swagger/OpenAPI mock server


I have an API reference in a Swagger file. I want to create a very simple mock server, so that when I call e.g.:

mymockurl.com/users it will return a predefined JSON (no need to connect to a database).

What's the easiest way to do this? I'm not a backend guy.


Solution

  • SwaggerHub provides a mock server for OpenAPI 2.0 and 3.0 specs. Mocking is supported on both free and paid plans.

    To use the mock server, import your spec into SwaggerHub and enable "API Auto Mocking". Mock responses can be JSON, YAML and XML, and are generated based on your response schemas and the example, default and enum values defined in the schemas.

    Disclosure: I work for the company that makes SwaggerHub.