English 中文(简体)
Hide uri alias from appearing in open api spec/documenation
原标题:

i have a controller with 2 paths as below, @PostMapping(path = {"/user/vehicle", "/user/car"}) public UserVehicle getUserVehicle(

But i want only "/user/vehicle" to be included in open api doc (and hide the "/user/car") in open api specs/doc. Is there a way to do it?

(i am generating open api specs from code.)

问题回答

Set the hidden parameter to true in the @Operation annotation as shown in the below example

@Operation(hidden = true)
@PostMapping(path = {"/user/vehicle", "/user/car"})

I know this is an old thread, but I stumbled upon it while attempting the same and the solution by @DerbarghaRoy would hide all paths, which dosent answer the question.

To exclude certain paths from your spring boot openapi doc, you can set the path to exclude in your application.yml, such as in the following example:

springdoc:
  pathsToExclude: /user/car

For a more general approach, ant style path patterns or regex can be used to exclude paths here.

Hope this helps anyone looking to accomplish the same





相关问题
WAF FILE could not EXPORT due to no WEB PROJECT option found

I was trying to create a war file on spring tool suite 4 (windows version). But as I was about to export the it to the local file system, I couldn t find the web project (wiseai-console) option of the ...

Combine multiple cb.literal() into 1 Expression

I am working on a Spring Boot project that uses PostgreSQL. I want to create a advanced search feature where user can search through the jsonb column that I have in many of my tables. Somewhere in my ...

Error using criteriaBuilder.max() for LocalDate

I am trying to get max date using criteria builder in a subquery. But I am getting this error Required type: Expression Provided: Expression Subquery<LocalDate> subRoot = criteriaQuery....

热门标签