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

fix: Use jakarta.servlet import in generated *Api.java when the jakar… #1168

Merged
merged 4 commits into from
Aug 17, 2023
Merged

fix: Use jakarta.servlet import in generated *Api.java when the jakar… #1168

merged 4 commits into from
Aug 17, 2023

Conversation

tgillain
Copy link
Contributor

@tgillain tgillain commented Jun 8, 2023

Handle the jakarta parameter in the *Api.java generation

@tgillain
Copy link
Contributor Author

Fixes #1167

@HugoMario HugoMario merged commit 2e18294 into swagger-api:master Aug 17, 2023
3 of 6 checks passed
@HugoMario
Copy link
Contributor

Thanks a lot @tgillain for this PR

@Mugibor
Copy link

Mugibor commented Mar 5, 2024

What other config do we need to use @tgillain , @HugoMario ?

<plugin>
                <groupId>io.swagger.codegen.v3</groupId>
                <artifactId>swagger-codegen-maven-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>./api-def/*Api.yaml</inputSpec>
                            <language>spring</language>
                            <output>${project.build.directory}/generated-sources/swagger-codegen</output>
                            <configOptions>
                                <java8>true</java8>
                                <openApiNullable>false</openApiNullable>
                                <modelPackage>x</modelPackage>
                                <apiPackage>Y</apiPackage>
                                <jakarta>true</jakarta>
                            </configOptions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        This also use the javax.servlet package. Do I need to add another dependency?

@dgswan
Copy link

dgswan commented Mar 5, 2024

@Mugibor you should upgrade at least to 3.0.46 to have the jakarta option supported.

<plugin>
  <groupId>io.swagger.codegen.v3</groupId>
  <artifactId>swagger-codegen-maven-plugin</artifactId>
  <version>3.0.46</version>
  ...
</plugin>

@Mugibor
Copy link

Mugibor commented Mar 5, 2024

@Mugibor you should upgrade at least to 3.0.46 to have the jakarta option supported.

<plugin>
  <groupId>io.swagger.codegen.v3</groupId>
  <artifactId>swagger-codegen-maven-plugin</artifactId>
  <version>3.0.46</version>
  ...
</plugin>

@dgswan
Thx, one more question. I'm using currently the 3.0.54 version. While the application running I got an error with the following:
Swagger2SpringBoot class :
java: cannot find symbol
symbol: class WebMvcConfigurerAdapter
location: package org.springframework.web.servlet.config.annotation

Currently I'm migrating from 2.7 to 3.2.3. What should I change to work this java codegen with spring boot v3?

@tgillain tgillain deleted the bug/1167-jakarta-java8 branch March 5, 2024 17:21
@tgillain
Copy link
Contributor Author

tgillain commented Mar 5, 2024

It looks like this is the issue you are facing https://www.baeldung.com/web-mvc-configurer-adapter-deprecated

@Mugibor
Copy link

Mugibor commented Mar 5, 2024

`import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@SpringBootApplication
@componentscan(basePackages = { "io.swagger", "XX" , "io.swagger.configuration"})
public class Swagger2SpringBoot implements CommandLineRunner {`

I'm not sure of that, this class has the error "cannot find symbol"

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 this pull request may close these issues.

4 participants