How to document Spring Data rest endpoints using swagger 3 spring boot

269 Views Asked by At

I have a spring boot application with spring data rest included.i want to document spring data rest endpoint with swagger 3.I have done the following implementation.

@RepositoryRestResource
@SecurityRequirement(name = "bearer")
public interface AccountRepository extends CrudRepository<Account, Long> {

    /**
     * Returns all accounts belonging to the given {@link Customer}.
     *
     * @param customer
     * @return
     */
    List<Account> findByCustomer(@Param("customer") Customer customer);
}

but when i open swagger ui. spring data rest endpoints are not shown in the ui.

1

There are 1 best solutions below

0
On

There are no swagger (opensource api) annotations in your code. But these are neccessary to build the swagger ui!

A small example how these annotations work can be found here: https://www.baeldung.com/swagger-set-example-description