# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.4.0] - 2025-11-13
### Added
- **Request Bodies Support**: Full parsing and model generation from `components.requestBodies`. The generator now extracts schemas from request bodies and creates appropriate Rust models, supporting both inline schemas and `$ref` references.
- **Custom Type Extension (`x-rust-type`)**: Added support for the `x-rust-type` OpenAPI vendor extension. When present on a schema, the generator creates a Rust type alias instead of generating a full struct or enum. This allows:
- Reusing existing domain models instead of generating duplicates
- Integration with types from other crates
- Clean separation between API models and domain models
- Works with any schema type (object, enum, oneOf, anyOf, allOf)
- **Custom Attributes Extension (`x-rust-attrs`)**: Added support for the `x-rust-attrs` OpenAPI vendor extension. Allows adding arbitrary Rust attributes to generated types:
- Custom derives (e.g., additional traits)
- Serde rules (rename_all, deny_unknown_fields, etc.)
- Conditional compilation attributes (cfg, cfg_attr)
- Works with structs, enums, unions, compositions, and type aliases
- Preserves attribute order
- Compatible with `x-rust-type` extension
### Fixed
- **Nullable Fields in Referenced Schemas**: Fixed handling of `nullable` flag for fields that use `$ref` to reference other schemas. The nullable flag is now correctly resolved from the target schema.
- **Required Fields in `allOf` Compositions**: Fixed merging of `required` fields in `allOf` compositions. Previously, only the `required` fields from the last schema were considered. Now all `required` fields from all schemas in the composition are properly collected and merged.
## [0.3.1] - 2025-11-04
### Fixed
- **Response generation**: Fixed issue with response generation. [GitHub issue](https://github.com/denislituev/openapi-model-generator/issues/12)
## [0.3.0] - 2025-10-21
### Added
- **Enum Support**: The generator now automatically creates Rust enums from OpenAPI string schemas that include an enum constraint. This provides type-safe representations for fixed sets of values.
### Fixed
- **Nullable Field Handling in allOf**: Resolved a critical issue where nullable fields within allOf compositions were incorrectly generating Option<Option<T>> types. The parser and generator now correctly produce a single Option<T>.
- **oneOf Serialization**: Fixed the generation of oneOf schemas to use #[serde(untagged)] instead of the default tagged serialization. This ensures that the generated Rust enums correctly serialize and deserialize according to the OpenAPI oneOf specification, which does not require a discriminator field.
## [0.2.2] - 2025-09-11
### Fixed
- **Name Normalization**: Fixed parser to consistently normalize schema, model, and variant names into PascalCase
- **Idiomatic Rust Naming**: All generated Rust types now follow proper naming conventions
- **Better Word Separation**: Improved `to_pascal_case` function to handle `-` and `_` as word separators
- **Schema Reference Naming**: Applied PascalCase normalization when resolving `$ref` schema references
- **Union Variant Naming**: Fixed naming of union variants to follow PascalCase conventions
### Changed
- Schema names with dashes or underscores (e.g., `user-name`, `list_roles`) now generate idiomatic Rust identifiers (`UserName`, `ListRoles`)
- Prevents compilation errors from invalid Rust identifiers in generated code
## [0.2.1] - 2025-09-06
### Added
- **Nullable Field Support**: Fields with `nullable: true` now generate `Option<T>` type correctly
- **Smart Option Generation**: Fields become `Option<T>` when either not required OR nullable
- **Enhanced Type Safety**: Better representation of optional vs nullable fields in generated Rust code
## [0.2.0] - 2025-08-26
### Added
- **UUID Format Support**: Fields with `type: string, format: uuid` now generate `Uuid` type instead of `String`
- **DateTime Format Support**: Fields with `type: string, format: date-time` now generate `DateTime<Utc>` type
- **Schema Composition Support**: Full support for OpenAPI composition patterns:
- `allOf`: Combines multiple schemas into a single struct with merged fields
- `oneOf`: Generates tagged union enum for exclusive choice between schemas
- `anyOf`: Generates tagged union enum for inclusive choice between schemas
- **Improved Code Generation**:
- Smart naming for union variants (uses schema names for `$ref`, auto-generates for inline schemas)
- PascalCase naming for request/response models (follows Rust conventions)
- Proper `$ref` reference resolution in complex schema hierarchies
- **Library API**: Export of main functions (`parse_openapi`, `generate_models`) for use as a library
## [0.1.0] - Initial Release
### Added
- Basic OpenAPI 3.0 specification parsing
- Simple struct generation for OpenAPI schemas
- Support for basic Rust types (String, i64, bool, etc.)
- Serde integration with proper field renaming
- Command-line interface with input/output options
- Support for required and optional fields
- Array type generation with `Vec<T>`
- Basic error handling and validation