We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Using io.swagger:swagger-codegen-cli:2.4.19 with configuration:
{ "modelPackage": "irrellevant", "apiPackage": "irrellevant", "invokerPackage": "irrellevant", "library": "spring-boot", "interfaceOnly" : true, "defaultInterfaces" : false, "dateLibrary": "java8", "hideGenerationTimestamp": true }
An interface is produced that's missing the semicolon after the operation/method definition.
Sounds very similar to #8976
io.swagger:swagger-codegen-cli:2.4.19
swagger: '2.0' info: title: minimal basePath: /v1/minimal parameters: paths: /: get: responses: 200: description: Successful type: string
Via https://plugins.gradle.org/plugin/org.hidetake.swagger.generator
Command line from debug output:
Starting process 'command 'C:\Program Files\Java\jdk-11.0.9\bin\java.exe''. Working directory: **** Command: C:\Program Files\Java\jdk-11.0.9\bin\java.exe -Dapis -Dmodels -Dorg.slf4j.simpleLogger.defaultLogLevel=INFO -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -cp C:\***\.gradle\caches\modules-2\files-2.1\io.swagger\swagger-codegen-cli\2.4.19\709dba4857869f264c61f533f34f964c24ccc456\swagger-codegen-cli-2.4.19.jar io.swagger.codegen.SwaggerCodegen generate -l spring -i C:\git\****\src\main\swagger\minimal.yaml -o C:\git\****\build\generated\src\main\java -c C:\git\*****\swagger-gen-config.json
Generate code from above YAML.
Produces the following Java code, which is missing a semicolon on the third last line (after rootGet()):
rootGet()
/** * NOTE: This class is auto generated by the swagger code generator program (2.4.19). * https://github.com/swagger-api/swagger-codegen * Do not edit the class manually. */ package irrelevant; import com.fasterxml.jackson.databind.ObjectMapper; import io.swagger.annotations.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; import javax.validation.constraints.*; import java.io.IOException; import java.util.List; import java.util.Optional; @Validated @Api(value = "default", description = "the default API") @RequestMapping(value = "/v1/minimal") public interface DefaultApi { Logger log = LoggerFactory.getLogger(DefaultApi.class); default Optional<ObjectMapper> getObjectMapper() { return Optional.empty(); } default Optional<HttpServletRequest> getRequest() { return Optional.empty(); } default Optional<String> getAcceptHeader() { return getRequest().map(r -> r.getHeader("Accept")); } @ApiOperation(value = "", nickname = "rootGet", notes = "", tags={ }) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful") }) @RequestMapping(value = "/", method = RequestMethod.GET) ResponseEntity<Void> rootGet() }
#8976
The text was updated successfully, but these errors were encountered:
FYI: Workaround for Gradle that works for my specific case. Might need tweaking if there's more than one operation in each XxxApi.java file.
XxxApi.java
var swaggerPojos by extra("${buildDir}/generated/src/main/java/") //... tasks { register("correctSwaggerStubs") { dependsOn("generateSwaggerCode") doLast { ant.withGroovyBuilder(){ "replaceregexp"("match" to "^}$", "replace" to ";}", "flags" to "g", "byline" to "true" ) { "fileset"("dir" to swaggerPojos, "includes" to "**/*Api.java") } } } } compileJava { dependsOn("correctSwaggerStubs") } //... }
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Description
Using io.swagger:swagger-codegen-cli:2.4.19 with configuration:
An interface is produced that's missing the semicolon after the operation/method definition.
Sounds very similar to #8976
Swagger-codegen version
io.swagger:swagger-codegen-cli:2.4.19
Swagger declaration file content or url
Command line used for generation
Via https://plugins.gradle.org/plugin/org.hidetake.swagger.generator
Command line from debug output:
Steps to reproduce
Generate code from above YAML.
Produces the following Java code, which is missing a semicolon on the third last line (after
rootGet()
):Related issues/PRs
#8976
Suggest a fix/enhancement
The text was updated successfully, but these errors were encountered: