redoc icon indicating copy to clipboard operation
redoc copied to clipboard

Better Presentation of Maximum and Minimum String Length of An Optional Field

Open APIWriter opened this issue 1 year ago • 2 comments

Describe the bug It is confusing what the minimum string length of an optional field is. By definition, the minimum string length of an optional field should be zero. However, if a value is provided, the minimum string length will by definition change to at least 1. There isn't a way to clearly present that situation now.

In the following example, the null valid value indicates the length could be zero, but the next graphic ([5 .. 10]) seems to contradict that. Image

Is there a better way to show this condition?

Expected behavior One simple solution might be to reverse the order and make it "null or string [5 .. 10]".

Or

null
string:
     Minimum string length: 5
     Maximum string length: 10

Minimal reproducible OpenAPI snippet(if possible)

Screenshots Image

APIWriter avatar Dec 09 '24 02:12 APIWriter

https://github.com/Redocly/redoc/issues/2630#issuecomment-2648962195

jeremyfiel avatar Feb 10 '25 18:02 jeremyfiel