Import OpenAPI/Swagger

Instantly convert your OpenAPI (Swagger) specifications into fully functional mock APIs.

How It Works

dotMock automatically parses your OpenAPI spec and creates:

All Endpoints

Every path and method defined in your spec

Response Examples

Using examples from your spec or generated data

Smart Mock Generation

Intelligent field detection for realistic data

x-dotmock Extensions

Custom mock configurations preserved

Import Your OpenAPI Spec

Upload your OpenAPI specification to instantly create a mock API

File Upload

Upload your OpenAPI spec file directly. Currently supports JSON format.

[File upload area with drag-and-drop zone showing "Drop your OpenAPI spec here or click to browse" - screenshot here]
JSON
Drag & Drop
Auto-validation

Import Process

Follow these simple steps to import your OpenAPI spec

Import Steps

1

Upload OpenAPI File

Click or drag to upload your JSON file

2

Review Import Preview

See API title, description, version, and endpoint count

3

Configure Options

• Auto-generated subdomain from API title

• Review generated mock templates

• Preserve existing x-dotmock configurations

4

Import & Deploy

Click import and your mock API is instantly live!

Example OpenAPI Spec

Here's a simple OpenAPI 3.0 spec that dotMock can import:

openapi: 3.0.0
info:
  title: Pet Store API
  version: 1.0.0
  description: A simple API for managing pets

servers:
  - url: https://api.petstore.com/v1

paths:
  /pets:
    get:
      summary: List all pets
      operationId: listPets
      tags:
        - pets
      parameters:
        - name: limit
          in: query
          description: How many items to return
          required: false
          schema:
            type: integer
            format: int32
      responses:
        '200':
          description: A paged array of pets
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Pet'
              example:
                - id: 1
                  name: "Fluffy"
                  species: "cat"
                  age: 3
                - id: 2
                  name: "Buddy"
                  species: "dog"
                  age: 5

    post:
      summary: Create a pet
      operationId: createPet
      tags:
        - pets
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewPet'
      responses:
        '201':
          description: Pet created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Pet'

  /pets/{petId}:
    get:
      summary: Get a pet by ID
      operationId: getPetById
      tags:
        - pets
      parameters:
        - name: petId
          in: path
          required: true
          description: The id of the pet
          schema:
            type: integer
      responses:
        '200':
          description: Expected response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Pet'
        '404':
          description: Pet not found

components:
  schemas:
    Pet:
      type: object
      required:
        - id
        - name
        - species
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string
        species:
          type: string
          enum: [dog, cat, bird, fish]
        age:
          type: integer
          format: int32

    NewPet:
      type: object
      required:
        - name
        - species
      properties:
        name:
          type: string
        species:
          type: string
          enum: [dog, cat, bird, fish]
        age:
          type: integer
          format: int32

After Import

Once imported, you can:

Customize Responses

Edit any endpoint to modify responses, add Go template expressions, or create conditional logic

Add New Endpoints

Extend your API by adding new endpoints not in the original spec

Configure Rules

Set up response rules based on headers, query params, or request body

Test Immediately

Your mock API is live instantly - start testing right away

Pro Tips

Include examples in your OpenAPI spec for more realistic mock data

Use schema descriptions - they're imported as endpoint documentation

Tag your operations to organize endpoints into logical groups

Define error responses in your spec for comprehensive mocking