swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
16.73k stars 6.02k forks source link

[Spring] Wrong class path for DeferredResult #6451

Open sasavilic opened 6 years ago

sasavilic commented 6 years ago
Description

Generated code for Spring is using wrong class path for DeferredResult. Currently, it is used org.springframework.web.context.request.DeferredResult, when actual class path is org.springframework.web.context.request.async.DeferredResult. See here.

Fix should be simple, I will provide PR soon.

Swagger-codegen version

2.2.3. This bug is present since corresponding feature is introduced.

Swagger declaration file content or url
Command line used for generation

I am using swagger-codegen-maven-plugin. Here is the configuration

<configuration>
    <inputSpec>${project.basedir}/src/main/spec/api.yaml</inputSpec>
    <language>spring</language>
    <apiPackage>...removed..</apiPackage>
    <modelPackage>...removed...</modelPackage>
    <configOptions>
        <sourceFolder>java</sourceFolder>
        <dateLibrary>java8</dateLibrary>
        <interfaceOnly>true</interfaceOnly>
        <java8>true</java8>
        <responseWrapper>DeferredResult</responseWrapper>
    </configOptions>
    <library>spring-mvc</library>
    <output>${project.build.directory}/generated-sources/server</output>
</configuration>
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement

I will provide PR.

sanjaygithu commented 2 years ago

please add true in

` / java8-localdatetime false true true DeferredResult true ` add this dependency: ` org.openapitools jackson-databind-nullable 0.1.0 `