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

module xxx reads package io.swagger.v3.oas.annotations from both io.swagger.v3.oas.annotations and io.swagger.v3.oas.models #4167

Closed
lWoHvYe opened this issue Apr 14, 2022 · 7 comments
Assignees

Comments

@lWoHvYe
Copy link

lWoHvYe commented Apr 14, 2022

Hi. My Project is based on Java 9 with named module. When I upgrade to swagger 2.2.0, I catched module xxx reads package io.swagger.v3.oas.annotations from both io.swagger.v3.oas.annotations and io.swagger.v3.oas.models when I compile it . I think it may cased by split package. Is there any way to solve it. Thinks.

Here is the demo of this

@rherrick
Copy link

I ran into the same thing with io.swagger.core.v3:swagger-models:2.2.0. The following classes are in that library:

There's no way that I can determine to work around this other than downgrading to an earlier version.

@vab2048
Copy link

vab2048 commented May 2, 2022

I think this is occurring because split packages are forbidden and are now present in the project:

  • swagger-annotations
    • Automatic-Module-Name: io.swagger.v3.oas.annotations
    • Module contains package named: io.swagger.v3.oas.annotations;
  • swagger-models
    • Automatic-Module-Name: io.swagger.v3.oas.models
    • Module contains package named: io.swagger.v3.oas.annotations;

Work will need to be done to make sure that there are no split packages.... otherwise the library will not work with Java modules.

@leolcao
Copy link

leolcao commented May 4, 2022

For now, downgrading to 2.1.12 version can solve this bug.
BTW, I find this bug by using springdoc-openapi-ui 1.6.8 (1.6.7+, starting supporting the 2.2.0 version), so I downgrade it to 1.6.6 version, then works.

@ALekseiMokhov
Copy link

io.swagger.v3.core.util.AnnotationsUtils.class throws java.lang.NoSuchMethodError: 'io.swagger.v3.oas.annotations.media.Schema$AdditionalPropertiesValue io.swagger.v3.oas.annotations.media.Schema.additionalProperties()'
Version springdoc-openapi-ui 1.6.8. And as was said above, it could be fixed by downgrading to 1.6.6

rherrick pushed a commit to WurstWorks/swagger-core that referenced this issue Jun 3, 2022
…rom swagger-models to swagger-annotations, added dependency on swagger-annotations to swagger-models
rherrick pushed a commit to WurstWorks/swagger-core that referenced this issue Jun 3, 2022
…swagger-annotations dependency to swagger-models
@rherrick
Copy link

rherrick commented Jun 7, 2022

I submitted the PR #4195 a couple days ago. Since then I've built and run my project with Springdoc 1.6.9 and Swagger 3 v2.2.1-SNAPSHOT (built and deployed on my private dev server and repo) and Swagger works properly.

@frantuma frantuma self-assigned this Jun 12, 2022
@frantuma
Copy link
Member

Thanks all for reporting and working on this! It has been indeed a mistake in package use for the introduce model specific annotations. Thanks @rherrick for the PR, we would however keep swagger-models package not dependent on other packages (specifically annotations), we would go therefore for package renaming as implemented in #4200. This solution has its drawback in "slightly" breaking backwards compatibility with 2.2.0, but being "minor" and limited to the newly introduced annotations, we would think this is still the best way to go.

Any comment welcome, would otherwise merge #4200 and cut a release in the next days

@frantuma
Copy link
Member

fixed in #4200

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

Successfully merging a pull request may close this issue.

6 participants