spring-boot - 隐藏 uri 别名,使其不出现在打开的 api 规范/文档中
问题描述
我有一个带有 2 条路径的控制器,如下所示,@PostMapping(path = {"/user/vehicle", "/user/car"}) public UserVehicle getUserVehicle(
但我只想将“/user/vehicle”包含在 open api 文档中(并隐藏“/user/car”)在 open api specs/doc 中。有没有办法做到这一点?
(我正在从代码生成开放 api 规范。)
解决方案
在注解中设置hidden
参数为,如下例所示true
@Operation
@Operation(hidden = true)
@PostMapping(path = {"/user/vehicle", "/user/car"})
推荐阅读
- r - 如果间隙超过特定时间,则查找持续时间并创建阈值
- c# - 如何使用 foreach 在 Razor 中设置 Viewbag 值?
- java - 依赖注入:应该先做哪个?属性(字段)或依赖项?
- python - Python 类:在将 True 切换为 False 时无法增加自维护以来的行程计数器,也无法在修复后将计数器重置为零
- svelte - 使用 Svelte 没有箭头函数的复选框验证
- c++ - C++ - unordered_map 运算符 [],意外行为
- python - 在 Python 程序中循环我的 IF 语句
- git - 尝试从 ghithub 进行 git clone 时出现 HTTP 407
- wpf - 在 XAML 中创建组合框时如何在 PowerShell 中显示数组中的选项
- prolog - 我想使用 Prolog 来订购一些东西,但我不断收到堆栈溢出错误