Releases: vgerbot-libraries/propify
v3.0.0
🚀 New Features
Schema-Based POJO Generation (@SchemaGen)
The headline feature of 3.0.0 is the addition of schema-based code generation through the new @SchemaGen annotation. This allows you to automatically generate Java model classes (POJOs/DTOs) from schema definitions.
Key Capabilities:
- Multiple Schema Formats: Support for JSON Schema (draft-07+) and OpenAPI 3.x specifications
- Mutable POJOs: Generates classes with getters and setters for runtime data binding
- Builder Pattern: Fluent object construction out of the box
- Jackson Integration: Optional Jackson annotations for JSON serialization/deserialization
- Bean Validation: Optional validation annotations (
@NotNull,@Email,@Size,@Min,@Max, etc.) - Enum Support: Full support for enum types with proper code generation
- Nested Objects: Complex nested types are automatically generated as nested classes
- Compile-Time Safety: Invalid schemas fail the build early
Quick Example:
// 1. Define schema
@SchemaGen(
location = "classpath:schemas/user.schema.json",
type = SchemaType.JSON_SCHEMA
)
public interface UserSchema {}
// 2. Use generated POJO
User user = User.builder()
.username("johndoe")
.email("john@example.com")
.age(30)
.build();
// 3. JSON serialization with Jackson
ObjectMapper mapper = new ObjectMapper();
String json = mapper.writeValueAsString(user);Distinction from @Propify:
| Feature | @Propify |
@SchemaGen |
|---|---|---|
| Input | Config files with data | Schema files (structure only) |
| Output | Read-only classes + data | Mutable POJOs |
| Fields | private final |
private (mutable) |
| Methods | Getters only | Getters + Setters |
| Constructor | Private (singleton) | Public + Builder |
| Use Case | Application configuration | API data models |
| Data Source | Compile-time (fixed) | Runtime (dynamic) |
Configuration Options:
@SchemaGen(
location = "schemas/api.yaml", // Schema file location
type = SchemaType.AUTO, // AUTO, JSON_SCHEMA, OPENAPI
schemaRef = "Pet", // For OpenAPI: which schema
builder = true, // Generate builder (default: true)
jacksonAnnotations = true, // Add Jackson annotations (default: true)
validationAnnotations = true, // Add validation annotations (default: true)
serializable = true, // Implement Serializable (default: true)
generateHelperMethods = true // equals/hashCode/toString (default: true)
)Use Cases:
- REST API DTOs from OpenAPI specifications
- Microservices communication with shared schemas
- Database entity generation
- Contract-first API development
- Schema registry integration
📖 Complete SchemaGen Documentation
🐛 Bug Fixes
Java 17 Compatibility
- Fixed: Reflection access to javac internal
Listin Java 17- Resolved compatibility issues with newer Java versions
- Ensures smooth operation on Java 8-17+
📦 Examples & Demos
New Schema Examples
Added comprehensive examples demonstrating schema-based generation:
EnumCodeGeneratorDemo.java- Enum type generation from schemasEnumUsageExample.java- Using generated enum typesEnumExample.java- Complete enum support demonstrationExampleFilesDemo.java- Working with schema filesSchemaGenExample.java- End-to-end schema generation example
Example schemas included:
schemas/user.schema.json- JSON Schema exampleschemas/petstore.yaml- OpenAPI 3.0 example
🔄 Migration Guide
Upgrading from 2.x to 3.0.0
Maven:
<dependency>
<groupId>com.vgerbot</groupId>
<artifactId>propify</artifactId>
<version>3.0.0</version>
</dependency>Gradle:
dependencies {
implementation 'com.vgerbot:propify:3.0.0'
annotationProcessor 'com.vgerbot:propify:3.0.0'
}Breaking Changes:
None. Version 3.0.0 is fully backward compatible with 2.x. All existing @Propify and @I18n code will continue to work without modifications.
The new @SchemaGen feature is purely additive.
Full Changelog: v2.0.0...v3.0.0
Propify 2.0.0 Release
I'm excited to announce the release of Propify 2.0.0, a major update that brings powerful new features to make your configuration management even more flexible and robust.
What's New in 2.0.0
🔄 Apache Commons Configuration2 Support
Propify now leverages Apache Commons Configuration2 for configuration file loading, providing a more robust and flexible foundation for handling configuration data. This integration enables:
- Enhanced configuration interpolation
- Improved error handling
- Better support for complex configuration structures
📄 Extended File Format Support
In addition to Java .properties files, Propify now supports multiple configuration formats:
- YAML (.yml, .yaml) - For hierarchical configurations
- INI (.ini) - For simple sectioned configurations
- Properties files remain fully supported
🌐 Internationalization (I18N) Support
Propify now includes comprehensive internationalization capabilities:
- Type-safe access to localized messages
- Support for multiple locales with automatic fallback
- Integration with ICU4J for advanced message formatting
- Compile-time validation of message keys and format patterns
🧠 Enhanced Property Type Inference
The type inference system has been significantly improved:
- More accurate detection of property types
- Support for complex generic types (e.g.,
List<Map<String, Integer>>) - Better handling of nested properties in all supported formats
- Improved conversion between configuration values and Java types
Upgrading from 1.0.0
Propify 2.0.0 maintains backward compatibility with 1.0.0, so existing code should continue to work without changes. To take advantage of the new features, simply update your dependency version:
<dependency>
<groupId>com.vgerbot</groupId>
<artifactId>propify</artifactId>
<version>2.0.0</version>
</dependency>Documentation
For detailed documentation and examples of the new features, please visit our GitHub repository and check out the updated README.