[英]How can hide some parameter from swagger spring boot?
I have a Student class and I need id
, name
, email
, dob
, age
parameters.我有一个 Student 类,我需要id
、 name
、 email
、 dob
、 age
参数。 These parameters are shown on swagger as below.这些参数显示在 swagger 上,如下所示。
I do not want id appear on the swagger documentation.我不希望 id 出现在 swagger 文档中。 How can I do that?我怎样才能做到这一点?
I have tried我试过了
I want to see only below parameters on swagger我只想在 swagger 上看到以下参数
{
"name": "string",
"email": "string",
"dob": "2022-12-19",
"age": 0
}
Can anyone help me about that, please?有人可以帮我吗?
For me, ApiModelProperty and ApiParam didn't exist.对我来说,ApiModelProperty 和 ApiParam 不存在。 I found the solution on documentation .我在文档中找到了解决方案。 The solution is as below;解决方法如下;
public class Student {
@Schema(accessMode = Schema.AccessMode.READ_ONLY)
private Long id;
}
Also thanks to @Waled Ahmad也感谢@Waled Ahmad
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.