Using swagger, how can I define a duration parameter? Using swagger, how can I define a duration parameter? json json

Using swagger, how can I define a duration parameter?


I chose the following solution

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

I use the string type as values are transferred as strings, and the iso8601 format, which is the parent format for dates and durations.