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

Endpoints with double-asterisk in the path are excluded from the Swagger output #2895

Closed
mc1arke opened this issue Feb 8, 2025 · 0 comments

Comments

@mc1arke
Copy link
Contributor

mc1arke commented Feb 8, 2025

Describe the bug

Since 2.7.0, a path that contains a double asterisk do not get included in the Swagger output.

To Reproduce
Steps to reproduce the behaviour:

  1. Define an endpoint with a double asterisk in the path matching
@RestController
public class WildcardController {
    @PostMapping("/**")
    @Operation(summary = "My Wildcard Operation")
    public String getItem(HttpServletRequest request) {
        return request.getPathInfo();
    }
}
  1. Check the swagger output

Expected behaviour

The endpoint to be included in the swagger output, e.g.

{
  "openapi": "3.1.0",
  "info": {
    "title": "OpenAPI definition",
    "version": "v0"
  },
  "servers": [
    {
      "url": "http://localhost",
      "description": "Generated server url"
    }
  ],
  "paths": {
    "/**": {
      "post": {
        "tags": [
          "wildcard-controller"
        ],
        "summary": "My Wildcard Operation",
        "operationId": "getItem",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "*/*": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {}
}

Additional context
1a9a1d4 appears to be the cause of this, which presumably was only supposed to filter out actuator endpoints that contained double asterisks, but is also filtering out non-actuator endpoints

mc1arke added a commit to mc1arke/springdoc-openapi that referenced this issue Feb 8, 2025
…gdoc#2895

All endpoints that contain a double-asterisks in the path are currently
being excluded from the output Swagger definition, rather than just
excluding match-all actuator endpoints. The endpoint matching is
therefore being altered to pre-filter the actuator endpoints to remove
any that contain a double-asterisks in the path, and remove the
subsequent filtering of double asterisks in the combined endpoints list
so that non-actuator endpoints aren't dropped by the actuator filtering.
bnasslahsen added a commit that referenced this issue Feb 13, 2025
Only filter out actuator endpoints with double asterisks. Fixes #2895
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

No branches or pull requests

1 participant