Skip to content
← All questions

How is the 'key' array converted into the request URL in the Swagger UI?

The Swagger UI serializes the array parameter by repeating the 'key=' query name for each element in the array, appending them to the base URL along with other parameters like 'alpha'.

Conditions

  • The interface is a Swagger UI page.
  • The parameter is defined as an array of strings.

Reasoning, step by step

  1. Identify the base URL and path parameters.
  2. Append the first key element as '?key=value'.
  3. Append subsequent key elements as '&key=value'.
  4. Append other query parameters like '&alpha=value'.

Example

The generated request string repeats the query name for each array element: '?key=-26&key=-52&key=8&key=60&key=76&key=61&key=-81&key=-13&key=-9&key=-106&key=-96&alpha=7'. This is the visible mechanism by which the form inputs become a concrete HTTP GET URL.

Common misconceptions

  • Assuming the array is sent as a single JSON object in the query string; it is flattened into repeated key-value pairs.

Watch the explanation

Connected concepts

Explore next

Related questions

Understand why

↗
Meet the concept

↗
Find a method

↗
Know when to use it

↗
Meet the concept

↗

Answers are generated from source material and independently checked. Consult the original video or creator if something is unclear.