-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Description
I know I'm late to the party, but I think this is relevant to this PR. I believe you can have a non-required string array param in the query, with minItems: 1 to represent "either don't pass it at all, or if you do it must include at least 1 item". Well, I think so anyway..
I know you can have a non-required, non-nullable parameter meaning "either don't provide it, or provide a non-null value, but never provide x: null". So I believe you can additionally constrain the array with minItems: 1 IIRC.
I am trying this in https://editor.swagger.io :
openapi: 3.0.3
info:
title: Test
version: 1.0.0
paths:
/test:
get:
parameters:
- name: names
in: query
required: false
schema:
type: array
minItems: 1
items:
type: string
responses:
200:
description: OKI would like to be able to test omitting the names parameter by not providing any elements, but swagger-ui tells me I must provide at least 1 value.
Should these minItems validation checks include whether or not the param is required? Or am I way off here and the spec doesn't allow that?
Originally posted by @dferretti in #7003 (comment)