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

Duplicate operationId #2010

Open
nimo23 opened this issue Oct 3, 2024 · 2 comments
Open

Duplicate operationId #2010

nimo23 opened this issue Oct 3, 2024 · 2 comments

Comments

@nimo23
Copy link

nimo23 commented Oct 3, 2024

According to #1688, it should be resolved, but I am getting also the "SROAP07903: Duplicate operationId"-error.

I have MyResource which makes use of an Interface:

@Path("/myResource")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@ApplicationScoped
public class MyResource implements MyInterface<User>{

        @GET
	@Path("/{id}")
	@APIResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(type = SchemaType.OBJECT, implementation = User.class)))
	@Override
	public Response getById(Integer id) {
		return MyInterfae.super.byId(id);
	}

}

The interface:

interface MyInterface<T> {

	@GET
	@Path("/{id}")
        default Response getById(@PathParam("id") Integer id) {
		// implemenation
	}

}

and the operationId is generated by Quarkus (version 3.15.1) by using the following property:

mp.openapi.extensions.smallrye.operationIdStrategy=CLASS_METHOD

when running in dev or test mode, it prints:

[io.sma.ope.run.sca.spi] (build-9) SROAP07903:
Duplicate operationId:
MyResource_getById produced by Class: com.acme.MyResource, Method: jakarta.ws.rs.core.Response getById(java.lang.Integer id)
and Class: com.acme.MyResource, Method: jakarta.ws.rs.core.Response getById(Integer id)

If I interpret the error message correctly:
It complains about a operationId even though it is the same class (it compares the MyResource class with itself which does not make sense), or?

@MikeEdgar MikeEdgar changed the title duplicateOerationId Duplicate operationId Oct 7, 2024
@MikeEdgar
Copy link
Member

@nimo23 is the getById method in your interface defined as a default method? Just curious because the code snippet shows a method body.

@nimo23
Copy link
Author

nimo23 commented Oct 8, 2024

is the getById method in your interface defined as a default method?

Yes, I corrected it above. It is:

@GET
@Path("/{id}")
default Response getById(@PathParam("id") Integer id) {
	// implemenation
}

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

2 participants