OpenAPI query string parameter with list of objects

This is not possible as of OpenAPI 3.1

OpenAPI 3.0/3.1 Specifications currently defines the deepObject behavior only for simple objects (with primitive properties) such as

{
  "id": 5,
  "name": "Bob"
}

but not for arrays and not for nested objects.

Since the behavior for arrays and nested objects is not defined, there’s really no way to describe your query string. Technically, the only way would be to define filtered[0][id], filtered[0][value], etc. as individual query parameters.

If you are designing a new API (rather than describing an existing one), consider passing the array of objects in the request body instead.

Leave a Comment