[BUGFIX][kotlin-spring] Fix generatedAnnotation to use the javaxPackage variable instead of jakarta to fix spring boot 2 codegen (#15944)

* Update generatedAnnotation.mustache

Without this, it generates a jakarta annotation in the controllers of a spring boot 2 project.

* Updated examples
This commit is contained in:
Ben Kolera 2023-07-10 13:13:22 +10:00 committed by GitHub
parent 94d76ff5d4
commit f34e42b249
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 19 additions and 10 deletions

View File

@ -1 +1 @@
@jakarta.annotation.Generated(value = ["{{generatorClass}}"]{{^hideGenerationTimestamp}}, date = "{{generatedDate}}"{{/hideGenerationTimestamp}}) @{{javaxPackage}}.annotation.Generated(value = ["{{generatorClass}}"]{{^hideGenerationTimestamp}}, date = "{{generatedDate}}"{{/hideGenerationTimestamp}})

View File

@ -10,7 +10,8 @@ import io.swagger.v3.oas.models.info.License
import io.swagger.v3.oas.models.Components import io.swagger.v3.oas.models.Components
import io.swagger.v3.oas.models.security.SecurityScheme import io.swagger.v3.oas.models.security.SecurityScheme
@jakarta.annotation.Generated(value = ["org.openapitools.codegen.languages.KotlinSpringServerCodegen"]) @javax.annotation.Generated(value = ["org.openapitools.codegen.languages.KotlinSpringServerCodegen"])
@Configuration @Configuration
class SpringDocConfiguration { class SpringDocConfiguration {

View File

@ -4,7 +4,8 @@ import org.springframework.stereotype.Controller
import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RequestMapping
import java.util.Optional import java.util.Optional
@jakarta.annotation.Generated(value = ["org.openapitools.codegen.languages.KotlinSpringServerCodegen"]) @javax.annotation.Generated(value = ["org.openapitools.codegen.languages.KotlinSpringServerCodegen"])
@Controller @Controller
@RequestMapping("\${openapi.openAPIPetstore.base-path:/v2}") @RequestMapping("\${openapi.openAPIPetstore.base-path:/v2}")
class PetApiController( class PetApiController(

View File

@ -14,7 +14,8 @@ import java.util.Optional
* A delegate to be called by the {@link PetApiController}}. * A delegate to be called by the {@link PetApiController}}.
* Implement this interface with a {@link org.springframework.stereotype.Service} annotated class. * Implement this interface with a {@link org.springframework.stereotype.Service} annotated class.
*/ */
@jakarta.annotation.Generated(value = ["org.openapitools.codegen.languages.KotlinSpringServerCodegen"]) @javax.annotation.Generated(value = ["org.openapitools.codegen.languages.KotlinSpringServerCodegen"])
interface PetApiDelegate { interface PetApiDelegate {
fun getRequest(): Optional<NativeWebRequest> = Optional.empty() fun getRequest(): Optional<NativeWebRequest> = Optional.empty()

View File

@ -4,7 +4,8 @@ import org.springframework.stereotype.Controller
import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RequestMapping
import java.util.Optional import java.util.Optional
@jakarta.annotation.Generated(value = ["org.openapitools.codegen.languages.KotlinSpringServerCodegen"]) @javax.annotation.Generated(value = ["org.openapitools.codegen.languages.KotlinSpringServerCodegen"])
@Controller @Controller
@RequestMapping("\${openapi.openAPIPetstore.base-path:/v2}") @RequestMapping("\${openapi.openAPIPetstore.base-path:/v2}")
class StoreApiController( class StoreApiController(

View File

@ -13,7 +13,8 @@ import java.util.Optional
* A delegate to be called by the {@link StoreApiController}}. * A delegate to be called by the {@link StoreApiController}}.
* Implement this interface with a {@link org.springframework.stereotype.Service} annotated class. * Implement this interface with a {@link org.springframework.stereotype.Service} annotated class.
*/ */
@jakarta.annotation.Generated(value = ["org.openapitools.codegen.languages.KotlinSpringServerCodegen"]) @javax.annotation.Generated(value = ["org.openapitools.codegen.languages.KotlinSpringServerCodegen"])
interface StoreApiDelegate { interface StoreApiDelegate {
fun getRequest(): Optional<NativeWebRequest> = Optional.empty() fun getRequest(): Optional<NativeWebRequest> = Optional.empty()

View File

@ -4,7 +4,8 @@ import org.springframework.stereotype.Controller
import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RequestMapping
import java.util.Optional import java.util.Optional
@jakarta.annotation.Generated(value = ["org.openapitools.codegen.languages.KotlinSpringServerCodegen"]) @javax.annotation.Generated(value = ["org.openapitools.codegen.languages.KotlinSpringServerCodegen"])
@Controller @Controller
@RequestMapping("\${openapi.openAPIPetstore.base-path:/v2}") @RequestMapping("\${openapi.openAPIPetstore.base-path:/v2}")
class UserApiController( class UserApiController(

View File

@ -13,7 +13,8 @@ import java.util.Optional
* A delegate to be called by the {@link UserApiController}}. * A delegate to be called by the {@link UserApiController}}.
* Implement this interface with a {@link org.springframework.stereotype.Service} annotated class. * Implement this interface with a {@link org.springframework.stereotype.Service} annotated class.
*/ */
@jakarta.annotation.Generated(value = ["org.openapitools.codegen.languages.KotlinSpringServerCodegen"]) @javax.annotation.Generated(value = ["org.openapitools.codegen.languages.KotlinSpringServerCodegen"])
interface UserApiDelegate { interface UserApiDelegate {
fun getRequest(): Optional<NativeWebRequest> = Optional.empty() fun getRequest(): Optional<NativeWebRequest> = Optional.empty()

View File

@ -10,7 +10,8 @@ import io.swagger.v3.oas.models.info.License
import io.swagger.v3.oas.models.Components import io.swagger.v3.oas.models.Components
import io.swagger.v3.oas.models.security.SecurityScheme import io.swagger.v3.oas.models.security.SecurityScheme
@jakarta.annotation.Generated(value = ["org.openapitools.codegen.languages.KotlinSpringServerCodegen"]) @javax.annotation.Generated(value = ["org.openapitools.codegen.languages.KotlinSpringServerCodegen"])
@Configuration @Configuration
class SpringDocConfiguration { class SpringDocConfiguration {

View File

@ -16,7 +16,8 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2
import javax.servlet.ServletContext import javax.servlet.ServletContext
@jakarta.annotation.Generated(value = ["org.openapitools.codegen.languages.KotlinSpringServerCodegen"]) @javax.annotation.Generated(value = ["org.openapitools.codegen.languages.KotlinSpringServerCodegen"])
@Configuration @Configuration
@EnableSwagger2 @EnableSwagger2
class SpringFoxConfiguration { class SpringFoxConfiguration {