swagger-api / swagger-api/swagger-core
openapi.json fails to take into account servlet context path, produces bad spec file
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 7.5k
- Forks
- 2.3k
- Avg merge
- 18h 1m
- Merged PRs (30d)
- 10
Description
i have a jax-rs application, packaged in a war, deployed on tomcat with a non-empty context path (so at http://host:port/war-name). the ApplicationPath is /api
the openapi.json generated currently looks like this:
{
"openapi": "3.0.1",
"paths": {
"/api/someResourcePath": {
"get": { }
}
}
}
this produces a non-working descriptor as it fails to take into account the context path my war is deployed at. it should probably look like:
{
"openapi": "3.0.1",
"servers":[
{"url": "/war-name"}
],
"paths": {
"/api/someResourcePath": { }
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing OpenAPI generation through the servlet deployment integration and locate where the request context path is available. Reproduce the WAR deployment under a non-empty Tomcat context path, then verify that the generated descriptor includes a server URL for that context while retaining the ApplicationPath in its paths.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100