Sean-Walker0 opened a new pull request, #7332: URL: https://github.com/apache/shenyu/pull/7332
<!-- Describe your PR here; e.g. Fixes #issueNo --> Found by code audit (no existing issue — happy to file one if maintainers prefer). `RequestMappingProcessor` (the spring-mvc extractor) stores an API's media types under the plural property keys `"produces"`/`"consumes"` — it is the **only writer** of these properties in the repository. `ApiDocRegistrarImpl#getProduce`/`getConsume` look up the singular keys `"produce"`/`"consume"`, **which nothing ever writes** (exhaustive grep over `shenyu-client`/`shenyu-register-center`). The lookup therefore always returns blank, and every API document registered through the spring-mvc client falls back to `*/*` no matter what `@RequestMapping(produces = "application/json", consumes = ...)` declares — the api-doc metadata never reflects the endpoint's real media types. <!-- Thank you for proposing a pull request. This template will guide you through the essential steps necessary for a pull request. --> Make sure that: - [x] You have read the [contribution guidelines](https://shenyu.apache.org/community/contributor-guide). - [x] You submit test cases (unit or integration tests) that back your changes. - [x] Your local test passed `./mvnw test -pl shenyu-client/shenyu-client-core -am and ./mvnw checkstyle:check -pl shenyu-client/shenyu-client-core` (module-scoped; full build left to CI). ### Modifications - `getProduce`/`getConsume` now read the plural keys `"produces"`/`"consumes"` that the extractor actually writes (two one-line changes; the blank→`*/*` fallback stays for endpoints that declare nothing). ### Verifying this change - New `testProduceAndConsumeReadTheKeysTheSpringMvcExtractorWrites` (reflection, following the file's existing private-method test pattern) seeds an `ApiDefinition` with the plural keys and asserts both lookups return them. It fails on current master with `expected: <application/json> but was: <*/*>` and passes with this change. - Full `shenyu-client-core` module suite green (158 test classes across the reactor); checkstyle green. ### Notes - Behavior change: api-doc produce/consume now reflect `@RequestMapping` media types instead of always `*/*`. - Orthogonal to open PRs: no open PR touches `ApiDocRegistrarImpl` or `RequestMappingProcessor` (checked against the file lists of all 185 open PRs). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
