Import & Export
Snaapi provides multiple import and export formats to help you migrate existing data, bootstrap new projects, and back up your registry configuration.
YAML Import
Import your full registry configuration — resources, fields, roles, permissions, and webhooks — from a YAML file.
| Feature | Description |
|---|---|
| Full registry import | Resources, roles, fields, permissions, and webhooks |
| Event emission | Emits resource.created, role.created, field.created, permission.created, webhook.created events |
| Import tracking | Reports imported and skipped item counts |
| Admin-only | Requires admin authentication |
Example YAML Structure
resources:
- name: posts
displayName: Posts
fields:
- name: title
type: string
required: true
- name: body
type: string
roles:
- name: editor
description: Can edit posts
GraphQL SDL Import
Import resource definitions from a GraphQL schema, either by uploading an SDL file or by introspecting a live GraphQL endpoint.
| Feature | Description |
|---|---|
| SDL file upload | Parse a .graphql schema file directly |
| URL introspection | Introspect a live GraphQL endpoint to discover types |
| SSRF protection | Blocks introspection requests to private IP ranges |
| Preview & confirm | Two-step workflow: preview detected types, then import |
| Type mapping | Maps GraphQL scalars to Snaapi field types |
| Relation detection | Detects object relations and maps them appropriately |
| Enum support | Converts GraphQL enum types |
| Validation inference | Infers validation rules and content types from scalars |
GraphQL to Snaapi Type Mapping
| GraphQL Scalar | Snaapi Field Type |
|---|---|
String |
string |
Int |
number |
Float |
number |
Boolean |
boolean |
ID |
uuid |
DateTime |
datetime |
Money |
number |
Relay pagination types (Connection, Edge, PageInfo) are automatically
recognized and handled.
Excel & CSV Import
Import data from Excel (.xlsx) or CSV files with automatic type inference.
| Feature | Description |
|---|---|
| File formats | Excel (.xlsx) and CSV |
| Max file size | 10 MB |
| Preview & confirm | Two-step workflow: preview columns and inferred types, then import |
| System field mapping | Detects id, createdAt, updatedAt from column headers and values |
| Merge support | Creates new resources or merges fields into existing ones |
| Row insertion | Inserts row data with timestamp preservation |
| Event emission | Emits resource.created events for new resources |
| Sample analysis | Analyzes up to 500 sample rows for type detection |
Type Inference
When importing from Excel, CSV, or GraphQL, Snaapi automatically infers field types from your data.
| Inferred Type | Detection Method |
|---|---|
boolean |
Values like true, false, yes, no, 0, 1 |
number |
Numeric values (integers and floats) |
datetime |
ISO 8601, MM/DD/YYYY, DD-MM-YYYY formats |
timestamp |
Numeric timestamps and Excel date serials |
enum |
Repeated categorical values across rows |
string |
Default fallback type |
Additional inference features:
- Name sanitization: Converts column names to lowercase, replaces special characters, handles reserved names, enforces 100-character limit
- Display name inference: Creates human-readable display names from
technical column names (e.g.,
created_at→Created At) - Content type inference: Maps field names to semantic content types (e.g.,
a column named
emailgets theemailcontent type)
Export
Export your entire registry configuration as a YAML file for backup or migration.
| Feature | Description |
|---|---|
| Format | YAML |
| Scope | Full registry (resources, fields, roles, permissions, webhooks) |
| Download mode | Download as .yaml file with timestamp in filename |
| JSON mode | Return as JSON response for programmatic access |
| Admin-only | Requires admin authentication |
Content Generation
Use the Content Generator in the admin console to populate resources with realistic fake data. This is useful after importing a schema to quickly generate test records.
| Feature | Description |
|---|---|
| Record count | Generate 1–500 records per request |
| Content-aware | Values match field content types and validation rules |
| Relation-aware | Queries related resources for valid foreign key values |