java - 用于第三方类的 Spring Boot swagger ApiModel
问题描述
有最新的spring boot、swagger和maven。有简单的 REST 控制器:
@ApiOperation(value = "Simple controller")
@GetMapping("/resource/{id}")
public Money findMoney(@PathVariable String id) {
return moneyService.findMoneyById(id);
}
金钱是我无法改变的外部阶级。但我不想显示它的所有字段。我还想在必填字段上添加一些详细信息。我想要类似的东西:
@ApiModel(description = "Money model")
public class Money {
@ApiModelProperty(notes = "Just ignore it, hidden = true)
private String notImportantProperty;
@ApiModelProperty(notes = "Currency")
private String currency;
etc...
}
解决方案
推荐阅读
- decision-tree - 如何在我们的数据集上训练决策树时为 min_samples_leaf 和 min_samples_split 选择值
- ruby-on-rails - 在 Ruby on Rails 中生成现有表的 html 视图
- java - 在片段中使用 MediaScannerConnection.scanFile()?
- azure-functions - Azure Functions with Consumption plan - 创建任务并返回
- python - Python QT改变按钮的背景颜色,而不仅仅是边框
- javascript - 在 JavaScript 中,无论如何都可以忽略函数调用中的某些参数?
- ruby - 如何将 ruby 程序作为自己的命令运行?
- python - 在 Azure 数据工厂上运行 .Net 和 Python 应用程序?
- monads - Scala Cats:用于任务 [Validated[String,?] 的 Monad 实例的尾递归 tailRecM 方法
- python - Django Microsoft Office 365 登录