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

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

Open
6 tasks
tnmtechnologies opened this issue Jan 29, 2019 · 10 comments
Open
6 tasks

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

tnmtechnologies opened this issue Jan 29, 2019 · 10 comments

Comments

@tnmtechnologies
Copy link
Contributor

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
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
Copy link
Member

jmini commented Jan 29, 2019

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
Copy link
Contributor Author

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

tnmtechnologies added a commit to b-com/openapi-generator that referenced this issue Jan 30, 2019
@tnmtechnologies
Copy link
Contributor Author

@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
Copy link
Contributor Author

@jmini @wing328 CircleCI failure is fixed

@sachinpipal
Copy link

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
Copy link

Hi,

The same problem for us.

Br,

Tim

@sachinpipal
Copy link

sachinpipal commented May 9, 2019 via email

@wutingbupt
Copy link

wutingbupt commented May 10, 2019 via email

@sachinpipal
Copy link

sachinpipal commented May 10, 2019 via email

@wutingbupt
Copy link

wutingbupt commented May 10, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants