kotlin - 如何为对象生成附加属性为假的 swagger json?
问题描述
我有以下带有招摇描述的对象:
/**
* Response about request failure
*/
@Schema(description = "Response about request failure")
data class ErrorDtoRs(
@field:Schema(description = "Error type", maxLength = 64)
val type: String? = null,
@field:Schema(description = "Error message", maxLength = 255)
val message: String?)
此对象的 Swagger json:
"components": {
"schemas": {
"ErrorDtoRs": {
"type": "object",
"properties": {
"type": {
"maxLength": 64,
"type": "string",
"description": "Error type"
},
"message": {
"maxLength": 255,
"type": "string",
"description": "Error message"
}
},
"description": "Response about request failure"
},
如何为对象生成附加属性为 false 的 swagger json,如下所示:
"components": {
"schemas": {
"ErrorDtoRs": {
"type": "object",
"additionalProperties": "false",
"properties": {
"type": {
"maxLength": 64,
"type": "string",
"description": "Error type"
},
"message": {
"maxLength": 255,
"type": "string",
"description": "Error message"
}
},
"description": "Response about request failure"
},
招摇:2.1.4 OpenApi:3.0.1
解决方案
推荐阅读
- multithreading - JMeter 5.0:在树侦听器中查看结果仅显示最后 100 个线程的结果
- ios - react-native pjsip 模块 - iOS 背景没有接收
- spotify-docker-client - 如何将卷挂载到容器?
- sas - SAS:使用索引列作为提示的哈希表查找
- css - 仅使用 CSS 从中心旋转三角形图像?
- azure - 在 Azure AD Enterprise 应用程序中跳过 Home Realm Discovery Page 或 Microsoft 登录页面
- javascript - 函数调用内的javascript内联注释
- javascript - 使用最新 jQuery 的视差滚动不起作用
- r - 为 mlogit 设置 data.frame - 错误消息:`row.names<-.data.frame`(`*tmp*`, value = paste(chid, alt, sep = ".")) 中的错误:
- java - 如何解决此问题 (.getDownloadUrl()) 未出现在新版本的 Firebase 数据库中