I wish to POST an array containing a variable number of strings, such as
["string1", "string2", ... "stringN"]
My present OpenAPI document defines it this way:
schema:
type: array
items:
description: networkIds
type: string
Is this the correct way to code to the OpenAPi v3 spec, or is there a more precise way to indicate one or more strings within the array?
The indentation is wrong – type
and items
must be on the same level.
If the array cannot be empty and always has at least 1 item, you can add minItems: 1
as an additional constraint. If all items must be unique, add uniqueItems: true
.
schema:
type: array
items:
description: networkIds
type: string
minItems: 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With