[BUG] JavaSpring: Class in OpenAPI2SpringBoot.java does not fully implement interface
Created by: keithchong
Bug Report Checklist
See 'secondary' bug from https://github.com/OpenAPITools/openapi-generator/issues/1164
-
Have you provided a full/minimal spec to reproduce the issue? No. Simply generate using the spring server generator to see the issue -
Have you validated the input using an OpenAPI validator (example)? No. I used the standard petstore example -
What's the version of OpenAPI Generator used? 4.0.3 (but, the master code of that template still shows the problem) -
Have you search for related issues/PRs? Originally reported in https://github.com/OpenAPITools/openapi-generator/issues/1164 See description starting with:
Note: In addition to the above problem and unrelated to this there is a generated code in the generated OpenAPI2SpringBoot.java
-
What's the actual output vs expected output? When you generate the code, you will immediately see Java compile errors (I was using Eclipse and VS Code with the Java extension)
Description
The spring server generated code has compilation errors because the class does not fully implement an interface:
@bean public WebMvcConfigurer webConfigurer() { return new WebMvcConfigurer() { /* @override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**") .allowedOrigins("") .allowedMethods("") .allowedHeaders("Content-Type"); } */ }; }
openapi-generator version
4.0.1. The template in the master branch does not have the entire method commented out, as this was the proposed solution.
OpenAPI declaration file content or url
Use the petstore.yaml sample
Command line used for generation
generate -g spring -i petstore.yaml -o
Steps to reproduce
Simply generate and import the project into your favourite IDE (I can reproduce in Eclipse as well as VS Code with the Java extension added)
Related issues/PRs
See 'secondary' bug from https://github.com/OpenAPITools/openapi-generator/issues/1164
Suggest a fix
As described in the related issue, you can simply comment out the entire method (or implement the interface properly).