我正在尝试为一个时间间隔构建一个 Swagger 模型,使用一个简单的字符串来存储时间(我知道还有日期时间):
definitions:
Time:
type: string
description: Time in 24 hour format "hh:mm".
TimeInterval:
type: object
properties:
lowerBound:
$ref: "#/definitions/Time"
description: Lower bound on the time interval.
default: "00:00"
upperBound:
$ref: "#/definitions/Time"
description: Upper bound on the time interval.
default: "24:00"
Run Code Online (Sandbox Code Playgroud)
出于某种原因,生成的 HTML 没有显示lowerBound 和upperBound“描述”,而只显示原始时间“描述”。这让我觉得我没有正确地做这件事。
所以问题是,是否可以像我尝试的那样使用模型作为类型。