question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Swagger UI query parameters array of custom object get request

See original GitHub issue

I have a customer array object in my get request with below query parameter

          {
            "name": "filters",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/ColumnFilter"
              }
            }
          }

schema of custom object is:

      "ColumnFilter": {
        "type": "object",
        "properties": {
          "column": {
            "type": "string",
            "nullable": true
          },
          "value": {
            "type": "string",
            "nullable": true
          }
        }

I swagger UI what should i pass as value for this custom object below manual url works for me: https://localhost:8989/…?filters[0].Column=Site ID&filters[0].Value=Site_1

when i mention the below values in swagger UI for filters (array[objec]) column=“Horizontal Beamwidth”&value=“100” it is generating the below invalid url https://localhost:8989/…?filters=column%3D%22Horizontal%20Beamwidth%22%26value%3D%22100%22

What should i enter in the swagger UI to generate a valid query parameter?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
hkosovacommented, Nov 18, 2019

@dsr301 This is a limitation of the OpenAPI Specification (not Swagger UI) - currently it does not provide a way to serialize an array of objects into a query string like ?filters[0].Column=Site ID&filters[0].Value=Site_1. There’s an existing feature request to support this serialization method as part of the deepObject style: https://github.com/OAI/OpenAPI-Specification/issues/1706.

1reaction
m-hicks-OHcommented, May 26, 2020

So… is there a workaround for this at all. Can I use swagger without OpenAPI… this is a pretty big limitation to swagger-ui.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parameter Serialization - Swagger
OpenAPI 3.0 supports arrays and objects in operation parameters (path, query, header, and cookie) and lets you specify how these parameters should be ......
Read more >
Use object type query param in swagger documentation
The request query param having an object value would be encoded in an actual request. Even though swagger shows an error at the...
Read more >
How to pass array of objects using query string in SwaggerUI
Operator=Equal&filter... it works properly but when i use SwaggerUI 2019-04-11 16_09_09-Swagger UI.png it bind empty model and pass query ...
Read more >
OpenAPI Specification v3.1.0 | Introduction, Definitions, & More
servers, [Server Object], An array of Server Objects, ... the query parameter is id . header - Custom headers that are expected as...
Read more >
Types and Parameters - OpenAPI - Documentation | NestJS
The SwaggerModule searches for all @Body() , @Query() , and @Param() ... the @ApiProperty() decorator allows setting various Schema Object properties:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found