Skip to content

Add Swagger and relation splitting features#23

Merged
omar-dulaimi merged 2 commits intomasterfrom
feature/swagger-relation-splitting
Jul 21, 2025
Merged

Add Swagger and relation splitting features#23
omar-dulaimi merged 2 commits intomasterfrom
feature/swagger-relation-splitting

Conversation

@omar-dulaimi
Copy link
Owner

Summary

  • ✨ Add swagger flag to generate @ApiProperty decorators alongside class-validator decorators
  • ✨ Add separateRelationFields flag to split models into base/relation classes for better NestJS integration
  • 🔧 Support for all Prisma types including proper Float handling with @IsNumber
  • 🧪 Comprehensive test coverage for both new features
  • 📚 Updated documentation with examples and usage patterns
  • ✅ Backward compatible - existing schemas work unchanged

Configuration Examples

Swagger Support

generator class_validator {
  provider = "prisma-class-validator-generator"
  swagger  = "true"
}

Relation Splitting

generator class_validator {
  provider               = "prisma-class-validator-generator"
  separateRelationFields = "true"
}

Full NestJS Integration

generator class_validator {
  provider               = "prisma-class-validator-generator"
  swagger                = "true"
  separateRelationFields = "true"
}

Test plan

  • All existing tests pass (backward compatibility)
  • New Swagger generation tests
  • New relation splitting tests
  • Documentation updated with examples
  • Both flags work independently and together

Fixes #18

- Add swagger flag to generate @ApiProperty decorators alongside class-validator decorators
- Add separateRelationFields flag to split models into base/relation classes for better NestJS integration
- Support for all Prisma types including proper Float handling with @IsNumber
- Comprehensive test coverage for both new features
- Updated documentation with examples and usage patterns
- Backward compatible - existing schemas work unchanged

Fixes #18
@omar-dulaimi omar-dulaimi merged commit f2fabac into master Jul 21, 2025
6 checks passed
@omar-dulaimi omar-dulaimi deleted the feature/swagger-relation-splitting branch September 2, 2025 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Swagger implementation

1 participant

Comments