Forum Discussion

marcschacher's avatar
marcschacher
New Contributor
4 years ago
Solved

Array items

Hi, i've a question about arrays and the number of valid elements. are the following assumptions correct?   example1:   example1: type: object properties: name: type: string ...
  • HKosova's avatar
    4 years ago

    By default, arrays can have any number of elements including none - that is, an empty array [ ] is valid. Array length can be restricted by minItems (default is 0) and maxItems.

     

    The required attribute doesn't control the array length, it just means that the array property must be present in the payload, regardless of the number of elements.

     

    1 - correct

    2 - no, it's also 0 - n.

    3 - correct

    4 - correct

    5 - correct

    6 - correct