admin管理员组文章数量:1431413
I have a entity class something like this
@Entity
public class People {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
private String name;
private String email;
// standard getters and setters
}
and the repository is something like this
@RepositoryRestResource(collectionResourceRel = "people", path = "people")
public interface PeopleRepository extends JpaRepository<People, Long> {
List<People> findByName(@Param("name") String name);
}
In the swagger it is showing in the below screenshot
before
i wanted to see description and name for each default method that is created by spring data rest (CRUD methods)
by default it is generating the description something like this
for get -> get-people
for post -> create-people
for getbyid -> get-people
for delete -> delete-people etc
i wanted to change it to my custom description. I wanted to see something like this
expected outcome
Things that i tried:
When i am using @Operation
annotation then only custom method description is showing in the swagger.
Example :
@Operation(name="getbyname", description="fetch all data by name")
List<People> findByName(@Param("name") String name);
Above one is working and it is showing in the swagger with proper description but when i am tring to do the same with the default methods that is generated by spring data rest, then it is not working
i tried something like this
@Override
@Operation(name="getAll", description="fetch all data")
List<People> findAll();
then the description and name is not showing.
Is there any way that i can override the default description and name for all the default spring data rest methods?
I tried multiple ways to override the methods or changed some properites but noting worked for me.
本文标签: How to override springdatarest default methods for swagger openApi documentationStack Overflow
版权声明:本文标题:How to override spring-data-rest default methods for swagger openApi documentation - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745557922a2663297.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论