Import & Export - Overview

You can import your and Swagger and OpenAPI specifications and Postman collections into MockLab in order to auto-generate stubs in your mock API. Swagger 2.x and OpenAPI 3.x are supported, in both JSON and YAML format.

You can also import and export stubs in WireMock JSON format. This can be used to move projects between WireMock and MockLab, store your mock APIs in source control and make copies of MockLab APIs.

Importing - basics

To import from any of the supported formats, navigate to the Stubs page of the mock API you’d like to import into, then click the Import button.

Import button

Then either paste the content to be imported:

Import text

Or upload it as a file:

Import file

The WireMock JSON format is also MockLab’s native format, so when a file of this type is imported it the stubs created correspond exactly to the file contents.

However, when importing from Swagger and OpenAPI stubs are generated according to a set of conversion rules. These can be tweaked and customised in a number of ways.

You can also automate imports via MockLab’s API.

Exporting

To export the current mock API’s stubs in MockLab/WireMock JSON format, click the Export button:

Export button

Then click the download link:

Export dialog