Complete guide to exporting
⚠️ IMPORTANT: Not all schema-dsl features can be exported to the database. Please read the Export Restrictions Description first to learn which features are not supported for export.
Use this guide after you understand the JSON Schema generated by schema-dsl. Always check Export Limitations before relying on database DDL as the only validation layer.
Overview
schema-dsl supports exporting JSON Schema into a variety of database structures or document formats to achieve "define once, use in many places".
Supported export formats
Among them, MarkdownExporter is more suitable for generating interface field descriptions, form documents or internal specification documents. For complete usage, see Markdown Exporter.
quick start
Markdown export
If your goal is not a database, but to generate a directly readable field description document for R&D, testing, product or interface users, you can use MarkdownExporter:
For a more complete description of options, examples, and multilingual output, see Markdown Exporter.
MongoDB export
Basic usage
Output:
Generate create command
Output:
Used in MongoDB
MySQL export
Basic usage
Output:
Configuration options
Generate index
PostgreSQL export
Basic usage
Output:
Configuration options
Generate index
Export comparison
Three exports of the same Schema
Constraint support comparison
best practices
1. Use description to add comments
2. Unified definition, exported in multiple places
3. Automated migration script
4. Version management
Complete example
E-commerce system Schema export
Related documents
- Export Restrictions ⚠️ Must Read
- MongoDB Exporter
- MySQL Exporter
- PostgreSQL Exporter
- TypeConverter
- DSL syntax
Corresponding sample file
Example entry: export-guide.ts Description: A minimal workflow that covers the same set of schemas and simultaneously exports to MongoDB, MySQL and PostgreSQL, making it easy to compare the results of multiple exporters.