OpenAPI Import
Import existing API specifications to instantly create mock endpoints
What is OpenAPI?
OpenAPI (formerly Swagger) is an industry-standard specification format for describing RESTful APIs. It defines endpoints, request/response schemas, authentication, and more in a structured JSON or YAML format.
Benefits of OpenAPI Import
- ✓ Instant Setup: Create complete APIs in seconds, not hours
- ✓ Accurate Structure: Preserve exact data types and validation rules
- ✓ Team Collaboration: Share specs between backend and frontend teams
- ✓ Documentation: Import descriptions and examples automatically
- ✓ Consistency: Ensure mock API matches production spec
Supported Formats
Modern OpenAPI format in JSON
{
"openapi": "3.0.0",
"info": {
"title": "User API",
"version": "1.0.0"
},
"paths": { ... }
}Modern OpenAPI format in YAML
openapi: 3.0.0 info: title: User API version: 1.0.0 paths: ...
Legacy Swagger format
{
"swagger": "2.0",
"info": {
"title": "User API",
"version": "1.0.0"
}
}Legacy Swagger format
swagger: "2.0" info: title: User API version: 1.0.0
How to Import
Navigate to Import Page
Go to Dashboard → Import → OpenAPI
Choose Import Method
Select one of three import methods:
Upload .json or .yaml file
Paste URL to spec file
Copy/paste spec directly
Validation
System validates your OpenAPI spec for errors
Review & Configure
Preview what will be imported:
- • Number of endpoints found
- • Data schemas and models
- • HTTP methods supported
- • Mock data generation settings
Import Complete
Your project is created with all endpoints and schemas ready to use!
What Gets Imported?
All paths from the spec become API endpoints:
/users → GET, POST/users/{id} → GET, PUT, DELETE/products → GET, POSTSchema definitions are converted to database models:
OpenAPI:
type: stringMock API:
String fieldtype: integerNumber fieldGET, POST, PUT, PATCH, DELETE operations are automatically configured
Field descriptions and example values from the spec are preserved
Constraints are automatically applied:
- • Required fields
- • String length (minLength, maxLength)
- • Number ranges (minimum, maximum)
- • Enum values
- • Pattern matching (regex)
Example OpenAPI Spec
{
"openapi": "3.0.0",
"info": {
"title": "User Management API",
"version": "1.0.0",
"description": "Complete CRUD API for user management"
},
"servers": [
{
"url": "https://api.example.com/v1"
}
],
"paths": {
"/users": {
"get": {
"summary": "Get all users",
"responses": {
"200": {
"description": "List of users",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/User"
}
}
}
}
}
}
},
"post": {
"summary": "Create a new user",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserInput"
}
}
}
},
"responses": {
"201": {
"description": "User created successfully"
}
}
}
},
"/users/{id}": {
"get": {
"summary": "Get user by ID",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "User details"
}
}
}
}
},
"components": {
"schemas": {
"User": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"name": {
"type": "string",
"minLength": 3,
"maxLength": 50,
"example": "John Doe"
},
"email": {
"type": "string",
"format": "email",
"example": "john@example.com"
},
"role": {
"type": "string",
"enum": ["user", "admin"],
"default": "user"
},
"isActive": {
"type": "boolean",
"default": true
},
"createdAt": {
"type": "string",
"format": "date-time"
}
},
"required": ["name", "email"]
}
}
}
}Mock Data Generation
After importing, you can automatically generate mock data based on your schemas:
Field types are intelligently mapped to Faker.js generators:
format: email
→ faker.internet.email()
format: date-time
→ faker.date.recent()
format: uri
→ faker.internet.url()
type: boolean
→ faker.datatype.boolean()
If your spec includes example values, they're used as templates:
"email": {
"type": "string",
"example": "user@company.com"
}
// Generated: alice@tech.com, bob@startup.io, etc.Common Issues & Solutions
Problem: "Invalid OpenAPI specification"
Solutions:
- • Validate your spec at editor.swagger.io
- • Check JSON/YAML syntax for errors
- • Ensure openapi version is specified correctly
- • Verify all $ref references are valid
Problem: Endpoints imported but no data structure
Solution: Define schemas in components/schemas section
Problem: Import takes a long time or times out
Solution: Split large specs into smaller ones or import only needed paths
Best Practices
Use Swagger Editor or online validators to ensure your spec is valid before importing.
Add example values to your schemas for better mock data generation.
Define reusable schemas in components section to avoid duplication and ensure consistency.
When your backend API changes, re-import the updated spec to keep your mock API in sync.