dubbo icon indicating copy to clipboard operation
dubbo copied to clipboard

fix:openapi

Open redoom opened this issue 4 weeks ago • 2 comments

Summary

Fix two critical issues in Dubbo REST OpenAPI schema resolution for generic nested types:

  1. Generic nested type resolution incomplete - Schemas for intermediate generic types (e.g., PageResponse in ApiResponse<PageResponse<AccessLogRes>>) were completely missing

  2. Annotated fields disappearing or losing annotation metadata - Fields with @Schema annotations were filtered out, and description/example properties were not displayed

Before Fix

{
  "AccessLogRes": {
    "properties": {
      "userId": { "type": "string" },
      "createTime": { "format": "date-time", "type": "string" }
    }
  }
}

Missing id and action fields No description or example in any field


After Fix

{
  "AccessLogRes": {
    "properties": {
      "id": {
        "type": "string",
        "description": "操作ID",
        "example": "123456"
      },
      "userId": { "type": "string" },
      "action": {
        "type": "string",
        "description": "操作类型",
        "example": "LOGIN"
      },
      "createTime": { "format": "date-time", "type": "string" }
    }
  }
}

All 4 fields present Annotation metadata (description, example) properly displayed


Related Issues

https://github.com/apache/dubbo/issues/15718

redoom avatar Nov 27 '25 12:11 redoom

Codecov Report

:x: Patch coverage is 0% with 79 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 60.70%. Comparing base (47a141c) to head (7648a7e).

Files with missing lines Patch % Lines
.../rpc/protocol/tri/rest/openapi/SchemaResolver.java 0.00% 77 Missing :warning:
.../support/basic/BasicOpenAPIDefinitionResolver.java 0.00% 1 Missing :warning:
...port/swagger/SwaggerOpenAPIDefinitionResolver.java 0.00% 1 Missing :warning:
Additional details and impacted files
@@             Coverage Diff              @@
##                3.3   #15806      +/-   ##
============================================
- Coverage     60.75%   60.70%   -0.05%     
- Complexity    11703    11706       +3     
============================================
  Files          1938     1938              
  Lines         88694    88767      +73     
  Branches      13387    13404      +17     
============================================
  Hits          53886    53886              
- Misses        29275    29355      +80     
+ Partials       5533     5526       -7     
Flag Coverage Δ
integration-tests-java21 32.35% <0.00%> (+0.02%) :arrow_up:
integration-tests-java8 32.36% <0.00%> (-0.17%) :arrow_down:
samples-tests-java21 31.98% <0.00%> (-0.12%) :arrow_down:
samples-tests-java8 29.69% <0.00%> (+0.07%) :arrow_up:
unit-tests-java11 59.01% <0.00%> (-0.04%) :arrow_down:
unit-tests-java17 58.49% <0.00%> (-0.05%) :arrow_down:
unit-tests-java21 58.47% <0.00%> (-0.07%) :arrow_down:
unit-tests-java25 58.44% <0.00%> (-0.06%) :arrow_down:
unit-tests-java8 58.99% <0.00%> (-0.05%) :arrow_down:

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov-commenter avatar Nov 27 '25 12:11 codecov-commenter

@heliang666s PTAL

RainYuY avatar Nov 28 '25 04:11 RainYuY