Redoc: minItems and maxItems are not renders for array in request body

Created on 8 Dec 2019  路  4Comments  路  Source: Redocly/redoc

Hello,

I am using the following definition to define an array of objects in the request body:

"requestBody": { "content": { "application/json": { "schema": { "type" : "array", "minItems" : 1, "maxItems" : 10, "items" : { 聽 "$ref": "#/components/schemas/gpsProfileUpdate" } } } } }

The minItems and maxItems were not rendered in the generated documentation.

image

bug enhancement

Most helpful comment

Although, option 2 could be nice. It may be more clear with the "items" word added to it:

range:

Array (1-5 items)
[

max == min (exact number)

Array (2 items)

max-only:

Array (5 or less items)

min-only:

Array (1 or more items)

It may be a pain though. You have to worry about pluralizing "item" depending on the number of items.

All 4 comments

Oh. I see.
Do you have any ideas on where to put this info?

Either

  1. above "One Of" with respective labels

    Minimum number of items: 1
    Maximum number of items: 10

    or

  2. something inspired by programming languages where you specify the number of items in brackets (e.g. C: array[5] or Java: new ArrayList(5)):

    Array (1 - 10) [

    or

    Array (no. of items: 1 - 10) [

    Of course, if it's minItems = maxItems it would be better to just render

    Array (5)

Just some ideas...

I think option 1 would be the most clear to understand as a reader.

Although, option 2 could be nice. It may be more clear with the "items" word added to it:

range:

Array (1-5 items)
[

max == min (exact number)

Array (2 items)

max-only:

Array (5 or less items)

min-only:

Array (1 or more items)

It may be a pain though. You have to worry about pluralizing "item" depending on the number of items.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

martnst picture martnst  路  3Comments

jaroslawr picture jaroslawr  路  3Comments

gauravmokhasi picture gauravmokhasi  路  4Comments

vietnguyen010 picture vietnguyen010  路  3Comments

dwilding picture dwilding  路  4Comments