-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Open
Labels
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When using the cli generator with the spec provided using kotlin-spring generator it produces code that does not compile due to inline comments introduced with version 7.18.0.
openapi-generator version
I tested with multiple versions and looks like the issues starts happening with version 7.18.0
Generated code with version 7.17.0
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.17.0).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.api
import io.swagger.v3.oas.annotations.*
import io.swagger.v3.oas.annotations.enums.*
import io.swagger.v3.oas.annotations.media.*
import io.swagger.v3.oas.annotations.responses.*
import io.swagger.v3.oas.annotations.security.*
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.*
import org.springframework.validation.annotation.Validated
import org.springframework.web.context.request.NativeWebRequest
import org.springframework.beans.factory.annotation.Autowired
import jakarta.validation.constraints.DecimalMax
import jakarta.validation.constraints.DecimalMin
import jakarta.validation.constraints.Email
import jakarta.validation.constraints.Max
import jakarta.validation.constraints.Min
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
import jakarta.validation.constraints.Size
import jakarta.validation.Valid
import kotlinx.coroutines.flow.Flow
import kotlin.collections.List
import kotlin.collections.Map
@RestController
@Validated
interface ProxyApi {
@Operation(
tags = ["Proxy",],
summary = "Proxies all GET requests",
operationId = "proxyAllGet",
description = """""",
responses = [
]
)
@RequestMapping(
method = [RequestMethod.GET],
value = ["/foo/**"]
)
suspend fun proxyAllGet(): ResponseEntity<Unit> {
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
}
}Generated code with version 7.18.0
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.18.0).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.api
import io.swagger.v3.oas.annotations.*
import io.swagger.v3.oas.annotations.enums.*
import io.swagger.v3.oas.annotations.media.*
import io.swagger.v3.oas.annotations.responses.*
import io.swagger.v3.oas.annotations.security.*
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.*
import org.springframework.validation.annotation.Validated
import org.springframework.web.context.request.NativeWebRequest
import org.springframework.beans.factory.annotation.Autowired
import jakarta.validation.constraints.DecimalMax
import jakarta.validation.constraints.DecimalMin
import jakarta.validation.constraints.Email
import jakarta.validation.constraints.Max
import jakarta.validation.constraints.Min
import jakarta.validation.constraints.NotNull
import jakarta.validation.constraints.Pattern
import jakarta.validation.constraints.Size
import jakarta.validation.Valid
import kotlinx.coroutines.flow.Flow
import kotlin.collections.List
import kotlin.collections.Map
@RestController
@Validated
interface ProxyApi {
@Operation(
tags = ["Proxy",],
summary = "Proxies all GET requests",
operationId = "proxyAllGet",
description = """""",
responses = [
]
)
@RequestMapping(
method = [RequestMethod.GET],
value = [PATH_PROXY_ALL_GET /* "/foo/**" */]
)
suspend fun proxyAllGet(@Parameter(hidden = true) exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity<Unit> {
return ResponseEntity(HttpStatus.NOT_IMPLEMENTED)
}
companion object {
//for your own safety never directly reuse these path definitions in tests
const val PATH_PROXY_ALL_GET: String = "/foo/**"
}
}OpenAPI declaration file content or url
openapi: 3.1.1
info:
title: OAS
version: 1.0.0
servers:
- url: http://localhost:8080
paths:
'/foo/**':
get:
tags:
- Proxy
summary: Proxies all GET requests
operationId: proxyAllGet
responses: {}Generation Details
openapi-generator-cli generate -i spec.yaml -g kotlin-spring --additional-properties=includeHttpRequestContext=true,interfaceOnly=true,reactive=true,useSpringBoot3=true,useTags=trueSteps to reproduce
Use the CLI to generate the code using the provided spec.