使用招摇,如何定义持续时间参数?

Using swagger, how can I define a duration parameter?

在我使用的一个请求中,我希望某个属性是持续时间。

如何在 Swagger 描述符中定义它?

据我了解,类似

type: string
format: iso8601

会很好。但这是正确的做法吗?

EDIT 持续时间将使用 ISO8601 durations 表示。这意味着它们将采用

形式

我选择了以下方案

 warrantyDuration:
   type: string
   format: iso8601
   description: Warranty duration expressed as an iso8601 duration. Typical values are P1Y, P2Y, ...
   example: P1Y

我使用 string 类型作为值作为字符串传输,以及 iso8601 格式,这是日期和持续时间的父格式。