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

Incorrect Import Statement for Resource Class in Generated Code with Swagger Codegen v3.0.46 #12516

Open
yamireh opened this issue Jan 12, 2025 · 0 comments

Comments

@yamireh
Copy link

yamireh commented Jan 12, 2025

Description

I have a swagger that has "Resource" on of it's swagger models.

When generating code using Swagger Codegen v3.0.46 and above, the generated ApiApi class includes the following incorrect import statement:

import org.springframework.core.io.Resource;

However, the application requires the import to point to a custom class which is part of my swagger:

import com.org.web.dto.Resource;

This issue occurs specifically for the Resource class, which conflicts with org.springframework.core.io.Resource due to naming overlap.

Swagger-codegen version

v3.0.46

Swagger declaration file content or url
Command line used for generation

JDK21
spring boot 3.4.1
io.swagger.codegen.v3
swagger-codegen-maven-plugin
3.0.46

Steps to reproduce

generate the swagger model classes and it won't compile due to importing the wrong Resource class.

Related issues/PRs
Suggest a fix/enhancement
@yamireh yamireh closed this as completed Jan 12, 2025
@yamireh yamireh changed the title Incorrect Import Statement for Resource Class in Generated Code with Swagger Codegen v3.0.47 and above Incorrect Import Statement for Resource Class in Generated Code with Swagger Codegen v3.0.46 Jan 12, 2025
@yamireh yamireh reopened this Jan 12, 2025
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

1 participant