spring-bootopenapijava-17springdoc-openapi-uiopenapi-generator-maven-plugin

Upgrading to open api 3 rendering more than required entities and apis


I am using open api with spring boot application. Recently the application was upgraded to use java 17 from java 11 and since then the api stopped working. I upgraded it to open api 3 following official docs and now its running but it is generating an endpoint for every single entity. Previously, it only generated endpoints for APIs which had the annotations like ApiResponse, Operation on it and only objects used in the response or request were shown i.e. dtos.

But now I have all entities showing up there. I want to it to go back to that way. How can I configure that.

For example, the screenshot shows customer info controller and Crud API this does not exist in the code. This is only an internal model with service and repository methods no controller. I have this for all entities. I only want this for my actually written APIs. Hope this makes it clear. enter image description here

I have gone through all the config options in the docs but it is not working. I have not worked with spring boot a lot so any help would be appreciated here. Thank you.

I also get this when I hit the open api endpoint:

enter image description here


Solution

  • Redundant Spring Data REST dependency

    In my case, I had REST endpoints generated for all repositories which lead to the of the spring-boot-starter-data-rest dependency. We had obviously added that somewhere along the way.

    Removing the dependency solved the problem for me. Hope it helps