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

Register server exception mapper method of the Rest-Interface implementation class #36873

Merged
merged 1 commit into from
Nov 7, 2023
Merged

Register server exception mapper method of the Rest-Interface implementation class #36873

merged 1 commit into from
Nov 7, 2023

Conversation

andrejpetras
Copy link
Contributor

@andrejpetras andrejpetras commented Nov 4, 2023

Motivation:
We generate server endpoints for our Rest-Interfaces from openapi.yaml files. Generator generates interfaces, and we need to write only the implementation classes. We do have multiple versions (v1, v2, ...) of rest interface (multiple openapi.yaml files) in one application. We would like to have a custom server exception mapper for each version, which will create a valid response to the corresponding version.

Closes: #36872

@geoand
Copy link
Contributor

geoand commented Nov 6, 2023

Thanks for this.

Can you add a test that covers the use case you have in mind?

@quarkus-bot quarkus-bot bot added area/core area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/gradle Gradle area/oidc area/rest labels Nov 6, 2023
@andrejpetras
Copy link
Contributor Author

@geoand I added my test case to the PR

Copy link
Contributor

@geoand geoand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@geoand geoand added triage/waiting-for-ci Ready to merge when CI successfully finishes and removed area/gradle Gradle area/core area/oidc area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins labels Nov 7, 2023
Copy link

quarkus-bot bot commented Nov 7, 2023

✔️ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

@geoand geoand merged commit 46744fe into quarkusio:main Nov 7, 2023
43 checks passed
@quarkus-bot quarkus-bot bot added the kind/enhancement New feature or request label Nov 7, 2023
@quarkus-bot quarkus-bot bot added this to the 3.6 - main milestone Nov 7, 2023
@quarkus-bot quarkus-bot bot removed the triage/waiting-for-ci Ready to merge when CI successfully finishes label Nov 7, 2023
@andrejpetras
Copy link
Contributor Author

@geoand Could we select this for version 3.5.1 as well?

@geoand
Copy link
Contributor

geoand commented Nov 7, 2023

I am a little hesitant to do that honestly.

@andrejpetras
Copy link
Contributor Author

@geoand I totally understand.

I am not sure if the current workaround (duplicate the @Path annotation also on implementation class) have any side-effects on running application.

I can only see the warning logs when starting the applications

[WARNING] [io.smallrye.openapi.runtime.scanner.spi] SROAP07903: Duplicate operationId: getPortalByUrl produced by Class:
 io.github.onecx.portal.rs.external.v1.controllers.PortalRestController, Method: jakarta.ws.rs.core.Response 
getPortalByUrl(java.lang.String url) and Class: gen.io.github.onecx.portal.rs.external.v1.PortalV1Api, Method: 
jakarta.ws.rs.core.Response getPortalByUrl(java.lang.String url)

Do you see a problem with the workaround?

@geoand
Copy link
Contributor

geoand commented Nov 7, 2023

It should be just fine

@andrejpetras
Copy link
Contributor Author

@geoand thx, I'll stick with it and wait for 3.6.0.

@geoand
Copy link
Contributor

geoand commented Nov 7, 2023

👌🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rest kind/enhancement New feature or request
Projects
None yet
2 participants