OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
20.84k stars 6.33k forks source link

[Java][jaxrs 2.1/resteasy] compilation error because of @PATCH #2018

Open tnmtechnologies opened 5 years ago

tnmtechnologies commented 5 years ago

Bug Report Checklist

Description

By default, @PATCH annotation is resolved to package io.swagger.jaxrs.* . PATCH annotation was not part of jaxrs 2.0 specifications ( https://jax-rs.github.io/apidocs/2.1/ ) but it is now part of jaxrs 2.1 specifications (https://jax-rs.github.io/apidocs/2.1/).

Compilation with jaxrs 2.1 leads to a compilation failure because of imports with wild cards for both packages io.swagger.jaxrs. and javax.ws.rs. .

openapi-generator version

3.3.3

OpenAPI declaration file content or url
Command line used for generation
Steps to reproduce

The issue occurs when we upgrade our thorntail dependency from 2.2.0 (2.2.0) to 2.3.0 (jarxrs 2.1).

Related issues/PRs
Suggest a fix

The suggested fix is to replace @PATCH in the generated source code by @io.swagger.jaxrs.PATCH. By the way, the generated source will compile for any jaxrs version.

As a work around, we use the com.google.code.maven-replacer-plugin:replacer maven plugin in order to update the generated source code on the fly. Of course we have to apply it everywhere @PATCH is generated.

jmini commented 5 years ago

Thank you for opening this issue.

The JaxRS generator needs some love anyway... See #27.

In thorntail it would be much better to use MicroProfile OpenAPI but we do not have the generator for it yet.


I agree with your idea for the patch, having @io.swagger.jaxrs.PATCH fully qualified.

Can you send a Pull Request for that?

Let me know if you need help.

tnmtechnologies commented 5 years ago

Thanks. I will do my best to send a PR asap.

tnmtechnologies commented 5 years ago

@jmini @wing328 I have sent a Pull Request. Unfortunately the tests failed on CircleCI (https://circleci.com/gh/OpenAPITools/openapi-generator/4576#tests/containers/2) . The errors seem to be related to uncommited changes about php-ze-ph generator which is out of my changes. How could we fix them?

tnmtechnologies commented 5 years ago

@jmini @wing328 CircleCI failure is fixed

sachinpipal commented 5 years ago

Also facing the same issue while generating code thorugh OpenAPI Plugin.

It says "@PATCH" is ambiguous, whicl results in compilation error. Asking for implicitly import for io.swagger.ws.rs.PATCH either javax.ws.rs.PATCH

wutingbupt commented 5 years ago

Hi,

The same problem for us.

Br,

Tim

sachinpipal commented 5 years ago

It is working fine with openapi 4.0.0 beta4 version . Also with version with 3.3.4 +io swagger parser 2.0.Latset_version.

On 09-May-2019 1:41 PM, "Tim wu" notifications@github.com wrote:

Hi,

The same problem for us.

Br,

Tim

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/OpenAPITools/openapi-generator/issues/2018#issuecomment-490798102, or mute the thread https://github.com/notifications/unsubscribe-auth/ALMOSAKMDSIW44AUD4TO5B3PUPMCNANCNFSM4GS7KABA .

wutingbupt commented 5 years ago

Thanks for your info, beta4 haven't uploaded to the Maven central yet, I will wait and test it.

Br, Tim

sachinpipal notifications@github.com 于2019年5月9日周四 下午2:47写道:

It is working fine with openapi 4.0.0 beta4 version . Also with version with 3.3.4 +io swagger parser 2.0.Latset_version.

On 09-May-2019 1:41 PM, "Tim wu" notifications@github.com wrote:

Hi,

The same problem for us.

Br,

Tim

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/OpenAPITools/openapi-generator/issues/2018#issuecomment-490798102 , or mute the thread < https://github.com/notifications/unsubscribe-auth/ALMOSAKMDSIW44AUD4TO5B3PUPMCNANCNFSM4GS7KABA

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/OpenAPITools/openapi-generator/issues/2018#issuecomment-490887259, or mute the thread https://github.com/notifications/unsubscribe-auth/AAI5O7PWBHKKZ3LIS7WITZLPUQL5BANCNFSM4GS7KABA .

sachinpipal commented 5 years ago

Sorry for the typoe its beta3 actually

On 10-May-2019 11:06 AM, "Tim wu" notifications@github.com wrote:

Thanks for your info, beta4 haven't uploaded to the Maven central yet, I will wait and test it.

Br, Tim

sachinpipal notifications@github.com 于2019年5月9日周四 下午2:47写道:

It is working fine with openapi 4.0.0 beta4 version . Also with version with 3.3.4 +io swagger parser 2.0.Latset_version.

On 09-May-2019 1:41 PM, "Tim wu" notifications@github.com wrote:

Hi,

The same problem for us.

Br,

Tim

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/OpenAPITools/openapi-generator/issues/2018# issuecomment-490798102 , or mute the thread < https://github.com/notifications/unsubscribe-auth/ ALMOSAKMDSIW44AUD4TO5B3PUPMCNANCNFSM4GS7KABA

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/OpenAPITools/openapi-generator/issues/2018# issuecomment-490887259, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAI5O7PWBHKKZ3LIS7WITZLPUQL5BANCNFSM4GS7KABA .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/OpenAPITools/openapi-generator/issues/2018#issuecomment-491162558, or mute the thread https://github.com/notifications/unsubscribe-auth/ALMOSAN6C4QTFN5MYKPT7VDPUUCWRANCNFSM4GS7KABA .

wutingbupt commented 5 years ago

Beta3 contains another problem, something related to "duplicated parameters" https://github.com/OpenAPITools/openapi-generator/issues/2631

sachinpipal notifications@github.com 于2019年5月10日周五 上午7:40写道:

Sorry for the typoe its beta3 actually

On 10-May-2019 11:06 AM, "Tim wu" notifications@github.com wrote:

Thanks for your info, beta4 haven't uploaded to the Maven central yet, I will wait and test it.

Br, Tim

sachinpipal notifications@github.com 于2019年5月9日周四 下午2:47写道:

It is working fine with openapi 4.0.0 beta4 version . Also with version with 3.3.4 +io swagger parser 2.0.Latset_version.

On 09-May-2019 1:41 PM, "Tim wu" notifications@github.com wrote:

Hi,

The same problem for us.

Br,

Tim

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/OpenAPITools/openapi-generator/issues/2018# issuecomment-490798102 , or mute the thread < https://github.com/notifications/unsubscribe-auth/ ALMOSAKMDSIW44AUD4TO5B3PUPMCNANCNFSM4GS7KABA

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/OpenAPITools/openapi-generator/issues/2018# issuecomment-490887259, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAI5O7PWBHKKZ3LIS7WITZLPUQL5BANCNFSM4GS7KABA .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/OpenAPITools/openapi-generator/issues/2018#issuecomment-491162558 , or mute the thread < https://github.com/notifications/unsubscribe-auth/ALMOSAN6C4QTFN5MYKPT7VDPUUCWRANCNFSM4GS7KABA

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/OpenAPITools/openapi-generator/issues/2018#issuecomment-491163379, or mute the thread https://github.com/notifications/unsubscribe-auth/AAI5O7NMTWMEY7RKQQMRWSLPUUDGJANCNFSM4GS7KABA .