Skip to content

fix: resolve TSF Swagger settings from configuration files - #1852

Open
fuyuwei01 wants to merge 1 commit into
Tencent:2024from
fuyuwei01:codex/fix-tsf-swagger-config-2024
Open

fuyuwei01 wants to merge 1 commit into
Tencent:2024from
fuyuwei01:codex/fix-tsf-swagger-config-2024

Conversation

@fuyuwei01

Copy link
Copy Markdown
Collaborator

PR Type

Bugfix.

Describe what this PR does for and how you did.

TSF Swagger settings in local files or remote configuration could load after TsfCoreEnvironmentPostProcessor had already copied their startup values into contract properties. For example, tsf.swagger.group=my-api was visible in the environment while the generated API group still used polaris.

Resolve the six legacy Swagger settings through placeholders in a low-priority tsf-swagger-properties source: group, enabled, basePackage, excludePath, basePath, and doc.auto-startup. Configuration loaded before Swagger initialization now reaches property binding and API generation. Explicit spring.cloud.polaris.contract.* settings take precedence, and existing TSF deployment bootstrap behavior is preserved.

Validation:

  • 33 targeted tests passed, covering late-loaded properties, real YAML Config Data loading, defaults, source priority, API group/scanning, reporting and document exposure flags, and existing deployment modes.
  • The affected-module reactor build and its Checkstyle validation passed; git diff --check passed.
  • A real local Consul YAML → provider-demo Bootstrap → HTTP check verified the configured API group, scan package/path exclusions, document 403 responses, and disabled API group creation. The demo changes are excluded from this PR.

Adding the issue link (#xxx) if possible.

N/A.

Note

These settings apply when Swagger initializes. Updating remote configuration changes the environment, but does not rebuild an existing GroupedOpenApi; restart the application to apply group or scanning changes.

The local Consul check covers configuration loading and document behavior. Cloud console publication and API metadata upload were not exercised. Full demo packaging encountered existing unrelated Checkstyle violations and used -Ddisable.checks=true; the affected-module validation above passed with normal Checkstyle enabled.

Checklist

  • Add information of this PR to CHANGELOG.md in root of project.
  • Add documentation in javadoc or comment below the PR if necessary.

Signed-off-by: fuyuwei01 <fuyuwei01@qq.com>
@codecov

codecov Bot commented Nov 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.16%. Comparing base (49d67dd) to head (9a071d5).
⚠️ Report is 1 commits behind head on 2024.

Additional details and impacted files
@@             Coverage Diff              @@
##               2024    #1852      +/-   ##
============================================
+ Coverage     55.86%   56.16%   +0.29%     
  Complexity      152      152              
============================================
  Files           487      487              
  Lines         14458    14458              
  Branches       1827     1825       -2     
============================================
+ Hits           8077     8120      +43     
+ Misses         5716     5669      -47     
- Partials        665      669       +4     

☔ View full report in Codecov by Harness.
📢 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.

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.

1 participant