swagger-api / swagger-api/swagger-codegen

Wildcard annotations in @PATH dropped in swagger

Open
#12,147 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

When I use the plugin swagger-maven-plugin-jakarta to create swagger from my java annotations, any wildcards in @path annotations are dropped. For instance:

@path("/sws/{var:.*}")
@get
@produces(MediaType.TEXT_XML)

results in:

/v1/sws/{var}:
get:
description: Proxy banner SOAP GET
operationId: serveGet
etc

Which means that I get a 404 when calling a path such as https://myserver.com/api/v1/sws/housing/studentAccountService.xml

Note that jakarta has no problem handling this; when I hit the application on my desktop it works just fine, but because I am generating swagger dynamically to populate my 3scale gateway, 3scale does not understand that it is a wildcard path because swagger-maven-plugin-jakarta has removed the wildcard.

Is there any way to retain the wildcards when the swagger is generated?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The payload names no source file or test. Start by reproducing the issue with swagger-maven-plugin-jakarta and inspect how @Path templates are converted into the generated OpenAPI path; done means preserving {var:.*} so 3scale recognizes the wildcard route instead of returning 404.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.