Skip to content

Conversation

@redoom
Copy link
Contributor

@redoom redoom commented Nov 27, 2025

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

#15718

@codecov-commenter
Copy link

codecov-commenter commented Nov 27, 2025

Codecov Report

❌ Patch coverage is 0% with 79 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.72%. Comparing base (7b48706) to head (90b20cb).

Files with missing lines Patch % Lines
.../rpc/protocol/tri/rest/openapi/SchemaResolver.java 0.00% 77 Missing ⚠️
.../support/basic/BasicOpenAPIDefinitionResolver.java 0.00% 1 Missing ⚠️
...port/swagger/SwaggerOpenAPIDefinitionResolver.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                3.3   #15806      +/-   ##
============================================
- Coverage     60.75%   60.72%   -0.04%     
- Complexity    11695    11700       +5     
============================================
  Files          1938     1938              
  Lines         88679    88752      +73     
  Branches      13386    13403      +17     
============================================
+ Hits          53877    53892      +15     
- Misses        29270    29326      +56     
- Partials       5532     5534       +2     
Flag Coverage Δ
integration-tests-java21 32.34% <0.00%> (-0.03%) ⬇️
integration-tests-java8 32.41% <0.00%> (-0.03%) ⬇️
samples-tests-java21 32.03% <0.00%> (-0.04%) ⬇️
samples-tests-java8 29.67% <0.00%> (+0.02%) ⬆️
unit-tests-java11 59.01% <0.00%> (-0.05%) ⬇️
unit-tests-java17 58.49% <0.00%> (-0.04%) ⬇️
unit-tests-java21 58.52% <0.00%> (-0.05%) ⬇️
unit-tests-java25 58.45% <0.00%> (-0.08%) ⬇️
unit-tests-java8 59.03% <0.00%> (-0.02%) ⬇️

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.

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

@RainYuY
Copy link
Contributor

RainYuY commented Nov 28, 2025

@heliang666s PTAL

schema.setDeprecated(anno.deprecated() ? Boolean.TRUE : null);

return chain.resolve(parameter, context);
return schema;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove it?

Copy link
Contributor Author

@redoom redoom Nov 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it has already been called once here, if it is called again, it will be called twice. So I directly returned the schema. I believe the schema annotation is failing because it's being called an extra time at the end, which prevents the preceding set methods from taking effect.
@oxsean

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.

4 participants