-
Notifications
You must be signed in to change notification settings - Fork 94
Closed
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
Affected Artifact
io.smallrye:smallrye-open-api-maven-plugin:2.1.1
Problem Context
I use smallrye-open-api to generate OpenAPI Specs from JAX-RS/MP-OpenAPI annotations. I have a method like following:
@GET
@Path("/{pathParam1}/{pathParam2}")
@Parameter(ref = "queryParam1")
String exampleEndpoint(
@PathParam("pathParam1") String pathParam1,
@PathParam("pathParam2") String pathParam2);While there's two @PathParams, there's also a query parameter given as @Parameter with a reference to the definition like following:
@OpenAPIDefinition(
// ...
components = @Components(parameters = {
@Parameter(name = "queryParam1", in = ParameterIn.QUERY)
})
)Expected Behaviour
The generated OpenAPI specs contain all three parameters in the paths: /{pathParam}: get: parameters: section.
Actual Behaviour
The generated OpenAPI specs do only contain the queryParam1 and the pathParam2. The pathParam1 is missing.
Further Observations
- When
queryParam1would not use aref, but was defined directly on the method, it would work and we could see all three parameters in the spec. - When there'd be only
pathParam1in the code, withoutpathParam2, thenqueryParam1would be the only parameter in the generated specs. - When there's no
@Parameterannotation at all, all two path parameters are generated. - When the path params are also given als
@Parameter, the behaviour doesn't change compared to what's given above under "Actual Behaviour":@Parameter(name = "pathParam1", in = ParameterIn.PATH) @Parameter(name = "pathParam2", in = ParameterIn.PATH) @Parameter(ref = "queryParam1")
- If we would declare
pathParam1andpathParam2through@Parameter(ref = ...), we also get similar results. However, if we leave out thequeryParam1, we getpathParam2twice -- once asref, and once as explicit specification.
Reproducer
- Checkout https://github.com/fxnn/reproducer-smallrye-parameter
- Run
mvn package - Open the generated
target/generated/openapi.yaml - Compare the output with what's declared in
src/main/java/ExampleResource.java
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working