OpenAPITools / OpenAPITools/openapi-generator

Springboot codegen : Compilation error in generated controllers if the skipDefaultInterface tag is set to true

Open
#3,894 17 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

Springboot codegen : Compilation error in generated controllers if the skipDefaultInterface tag is set to true

openapi-generator version

3.0.2

OpenAPI declaration file content or url

petstore.yaml

Command line used for generation

spring boot
maven plugin config
<configOptions> <java8>true</java8> <library>spring-boot</library> <dateLibrary>java8</dateLibrary> <sourceFolder>src/main/java</sourceFolder> <useBeanValidation>true</useBeanValidation> <configPackage>com.sample.config</configPackage> <swaggerDocketConfig>true</swaggerDocketConfig> <skipDefaultInterface>true</skipDefaultInterface> </configOptions>

Steps to reproduce

Set skipdefaultInterface flag as true

Error message

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project openapi-spring: Compilation failure: Compilation failure: [ERROR] Downloads/Codebase/openapipoc/src/main/java/com/sample/api/UserApiController.java:[11,8] com.sample.api.UserApiController is not abstract and does not override abstract me thod updateUser(java.lang.String,@javax.validation.Valid com.sample.model.User) in com.sample.api.UserApi [ERROR] /Downloads/Codebase/openapipoc/src/main/java/com/sample/api/UserApiController.java:[20,5] method does not override or implement a method from a supertype [ERROR] /Downloads/Codebase/openapipoc/src/main/java/com/sample/api/PetApiController.java:[11,8] com..sample.api.PetApiController is not abstract and does not override abstract meth od uploadFile(java.lang.Long,java.lang.String,@javax.validation.Valid org.springframework.web.multipart.MultipartFile) in com.sample.api.PetApi [ERROR] /Downloads/Codebase/openapipoc/src/main/java/com/sample/api/PetApiController.java:[20,5] method does not override or implement a method from a supertype [ERROR] /Downloads/Codebase/openapipoc/src/main/java/com/sample/api/StoreApiController.java:[11,8] com.sample.api.StoreApiController is not abstract and does not override abstract method placeOrder(@javax.validation.Valid com.sample.model.Order) in com.sample.api.StoreApi [ERROR] /Downloads/Codebase/openapipoc/src/main/java/com/sample/api/StoreApiController.java:[20,5] method does not override or implement a method from a supertype

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by generating the controllers from petstore.yaml with the shown Maven plugin configuration, including skipDefaultInterface=true, then run Maven compilation to reproduce the errors in UserApiController, PetApiController, and StoreApiController. Compare the generated controllers with their corresponding API interfaces. Done means the generated Spring Boot project compiles successfully with the option enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.