OpenAPI Model Generator
A tool for generating Rust models from OpenAPI specifications. This utility automatically creates Rust structures based on schemas from OpenAPI (Swagger) documentation.
Features
- OpenAPI 3.0 specification support
- YAML and JSON format support
- Automatic generation of Rust structures with Serde attributes
- Support for nested types and arrays
- Support for required and optional fields
- Support for various data types (String, Number, Integer, Boolean, DateTime, UUID)
Installation
Usage
Parameters
-i, --input
- Path to the OpenAPI specification file (YAML or JSON)-o, --output
- Path to the output directory (default: ./generated)
Example
Source OpenAPI schema:
components:
schemas:
User:
type: object
properties:
id:
type: string
format: uuid
name:
type: string
email:
type: string
age:
type: integer
is_active:
type: boolean
required:
- id
- name
- email
Generated Rust code:
use ;
use Uuid;
use ;
Development
Dependencies
- Rust 1.70 or higher
- Cargo
Building
Running Tests
License
MIT