I have a simple API in spring boot using JpaRepository:
public interface UserRepository extends JpaRepository<User, Long> {...}
I'm able to create a user using POST
API:
curl localhost:8080/users -i -X POST -H "Content-Type:application/json" -d '{"firstName": "Alik", "lastName": "Elzin", "username": "kilaka"}'
I'm also able update one of the fields of a user using PATCH:
curl localhost:8080/users/1 -i -X PATCH -H "Content-Type:application/json" -d '{"firstName": "Alikuki"}'
Swagger config:
@Configuration
public class SwaggerConfig {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
}
}
When using swagger to create the API as UI, I see the POST
option and also a PUT
option, but not the working PATCH
API. See screecap below.
Any idea how I can make swagger generate the PATCH API?