Shawna Matz
Shawna Matz

Reputation: 31

In swagger, is there a recommended way to document a number field with a length limit?

We have some numeric fields, that for legacy reasons have implicit length limits.

Given a number field with a length limit of 5, the obvious route is to set the max to 99999, but then is there any way to specify that 1.111 is ok, and 1.1111 is not, in the swagger spec?

For example:

numberField:
  type: number
  format: float
  minimum: 0
  maximum: 99999

Upvotes: 3

Views: 6595

Answers (1)

ByeBye
ByeBye

Reputation: 6946

Yes, you have to use the property maxLength

 numberField:
   type: number
   format: float
   maxLength: 5

Upvotes: 0

Related Questions