swagger-api / swagger-api/swagger-core
Swagger duplicates operation in spec
Open
Nobody has claimed this yet.
backlog
- Dominant language
- Java
- Stars
- 7.5k
- Forks
- 2.3k
- Avg merge
- 18h 1m
- Merged PRs (30d)
- 10
Description
| Q | A |
|---|---|
| Bug or feature request? | Bug |
| Which Swagger-Core version? | 2.2.8 |
| Which Java version? | 1.8.0_362 |
| Which JAX-RS framework & version? | jax-rs 2.1.1 & jersey 2.39 |
We have an interface defined in this way:
public interface OperationSpec {
@Operation(
operationId = "spec.random")
@GET
@Path("/operation")
@Produces(ApiMediaType.JSON)
Response getOperation();
}
And an implementation of OperationSpec:
@Path("/operations")
public class Operation implements OperationSpec {
@Override
@JsonView(Views.API.V1.class)
public Response getOperation() {
...
}
}
For no reason, swagger is generating a spec file with two duplicate operations:
'/operations/operation':
get:
operationId: spec.random
...
'/operation':
get:
operationId: spec.random_1
Is there any reason for this?
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
No repository file or test is named. Start by reproducing the duplicate paths with Swagger-Core 2.2.8, JAX-RS 2.1.1, and Jersey 2.39 using the interface and implementation shown; trace how both resource declarations are discovered. Done means identifying the cause and preventing the duplicate operation or documenting the required configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100