Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Triple Rest Openapi Support #14924

Merged
merged 24 commits into from
Dec 11, 2024
Merged

Triple Rest Openapi Support #14924

merged 24 commits into from
Dec 11, 2024

Conversation

oxsean
Copy link
Collaborator

@oxsean oxsean commented Nov 22, 2024

What is the purpose of the change?

Add OpenAPI support for Triple REST protocol, enabling automatic OpenAPI documentation generation
for dubbo services. The implementation includes:

  • Dynamic OpenAPI spec generation from service metadata
  • Support for JSON/YAML formats
  • Configurable schema naming strategy
  • Document caching and merging
  • Group/Version/Tag filtering
  • Customizable documentation through annotations

How to testing

Automatically generates OpenAPI documentation for all Dubbo services with zero configuration:

  1. Access Swagger UI:

    http://host:port/dubbo/openapi
    
  2. Access OpenAPI Spec:

    http://host:port/dubbo/openapi/api-docs
    
  3. Supported formats:

    • JSON (default): /dubbo/openapi/api-docs
    • YAML: /dubbo/openapi/api-docs.yaml
  4. Optional filters:

    • Group: /dubbo/openapi/api-docs/{group}
    • Version: /dubbo/openapi/api-docs?version=1.0.0
    • Tags: /dubbo/openapi/api-docs?tag=user,order

Example

Start dubbo-demo/dubbo-demo-spring-boot/dubbo-demo-spring-boot-servlet
then access:

http://localhost:8082/dubbo/openapi

Show case

image
image
image

@oxsean oxsean force-pushed the openapi branch 6 times, most recently from a282148 to 73eafc1 Compare November 25, 2024 05:31
@oxsean oxsean force-pushed the openapi branch 4 times, most recently from a289a60 to 6dcf7ab Compare November 30, 2024 14:12
@oxsean oxsean force-pushed the openapi branch 3 times, most recently from 32495cd to 2bcfda3 Compare December 1, 2024 02:26
@oxsean oxsean force-pushed the openapi branch 2 times, most recently from a355c96 to a063255 Compare December 1, 2024 11:38
pom.xml Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Dec 9, 2024

Codecov Report

Attention: Patch coverage is 6.66538% with 4831 lines in your changes missing coverage. Please review.

Project coverage is 60.75%. Comparing base (3c43c82) to head (7a9f62c).

Files with missing lines Patch % Lines
...java/org/apache/dubbo/metadata/OpenAPIRequest.java 0.00% 555 Missing ⚠️
...pc/protocol/tri/rest/openapi/DefinitionMerger.java 0.00% 377 Missing ⚠️
.../protocol/tri/rest/openapi/DefinitionResolver.java 0.00% 240 Missing ⚠️
...bo/rpc/protocol/tri/rest/openapi/model/Schema.java 0.00% 240 Missing ⚠️
...pc/protocol/tri/rest/openapi/DefinitionFilter.java 0.00% 231 Missing ⚠️
...in/java/org/apache/dubbo/metadata/OpenAPIInfo.java 0.00% 195 Missing ⚠️
...port/swagger/JavadocOpenAPIDefinitionResolver.java 0.00% 167 Missing ⚠️
...he/dubbo/rpc/protocol/tri/rest/openapi/Helper.java 0.00% 165 Missing ⚠️
.../rpc/protocol/tri/rest/openapi/SchemaResolver.java 0.00% 154 Missing ⚠️
...otocol/tri/rest/openapi/DefaultOpenAPIService.java 0.00% 143 Missing ⚠️
... and 109 more
Additional details and impacted files
@@             Coverage Diff              @@
##                3.3   #14924      +/-   ##
============================================
- Coverage     64.34%   60.75%   -3.60%     
- Complexity    10782    10864      +82     
============================================
  Files          1819     1882      +63     
  Lines         80959    85983    +5024     
  Branches      12039    12876     +837     
============================================
+ Hits          52094    52238     +144     
- Misses        23477    28296    +4819     
- Partials       5388     5449      +61     
Flag Coverage Δ
integration-tests 33.06% <2.74%> (-1.67%) ⬇️
samples-tests 29.22% <1.42%> (-1.81%) ⬇️
unit-tests 58.91% <6.62%> (-3.47%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@oxsean oxsean merged commit 92b1ac1 into apache:3.3 Dec 11, 2024
19 checks passed
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.

3 participants