feat: Add Java Dubbo code generator for Apache Dubbo microservices#21918
Closed
redoom wants to merge 3 commits intoOpenAPITools:masterfrom
Closed
feat: Add Java Dubbo code generator for Apache Dubbo microservices#21918redoom wants to merge 3 commits intoOpenAPITools:masterfrom
redoom wants to merge 3 commits intoOpenAPITools:masterfrom
Conversation
- Add comprehensive Dubbo microservice code generator - Support Zookeeper and Nacos registries with auto-dependency selection - Implement version-aware dependency management (Dubbo 3.2 vs 3.3+) - Generate service interfaces, implementations, and Spring Boot REST controllers - Include complete Spring Boot application structure with configuration - Add detailed documentation and usage examples - Support async operations and generic response wrappers - Provide flexible configuration options for packages, versions, and features
Adds a new sample generator configuration for dubbo. The existing GitHub workflow for Java samples is updated to build and test this new sample automatically.
- Set registry address to N/A to avoid ZooKeeper dependency - Change protocol from 'triple' to 'tri' to resolve extension loading error
Member
|
please follow step 3 to update the samples and doc |
6 tasks
Member
|
i've filed #21968 based on this PR with
tests passed. please have a look |
Member
|
closed via #21968 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Dubbo Code Generator
Feature Overview
A new Java Dubbo code generator has been added to OpenAPI Generator, enabling automatic generation of Apache Dubbo-based microservice project code from OpenAPI specifications.
Key Features
Complete Project Generation
Multi-Version Support
Supports multiple versions of Apache Dubbo with automatic dependency adaptation:
dubbo-dependencies-zookeeperdubbo-registry-*+dubbo-remoting-*Registry Center Support
Supports mainstream registry centers with automatic client version selection:
zookeeper://127.0.0.1:2181nacos://127.0.0.1:8848Rich Configuration Options
titlebasePackagedubboVersionjavaVersioninterfaceOnlyserviceInterfaceserviceImplementationuseGenericResponseuseTagsregistry-addressGenerated Project Structure
Usage Examples
Basic Usage
Using Nacos Registry Center
Generate Interfaces Only
Technical Implementation
Core Class Structure
java-dubbo/directoryapi.mustache: Service interface templateapiDubbo.mustache: Service implementation templateapiController.mustache: Controller templatemodel.mustache: Data model templatepom.mustache: Maven configuration templateapplication.mustache: Application configuration templateIntelligent Dependency Management
The generator automatically selects appropriate dependencies based on Dubbo version and registry address:
Package Structure Optimization
interfaces: Pure interface package, can be independently published for consumer referenceprovider: Service provider implementationsconsumer: HTTP gateway controllersTest Coverage
Generated projects include:
Documentation Support
Auto-generated README.md includes:
Compatibility