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.

Free-form query parameters does not seem to work according to spec

See original GitHub issue
Q A
Bug or feature request? Bug
Which Swagger/OpenAPI version? 3.0.0
Which Swagger-UI version? 3.4.2
How did you install Swagger-UI? https://hub.docker.com/r/swaggerapi/swagger-ui/
Which browser & version? Firefox 56.0
Which operating system? Fedora 26

Demonstration API definition

openapi: 3.0.0                                                                                                                                                                                                       
paths:                                                                                                                                                                                                               
  /search:                                                                                                                                                                                                           
    get:                                                                                                                                                                                                             
      description: search                                                                                                                                                                                            
      operationId: search                                                                                                                                                                                            
      parameters:                                                                                                                                                                                                    
      - description: Free form query parameters as json object                                                                                                                                                       
        in: query                                                                                                                                                                                                    
        name: freeForm                                                                                                                                                                                               
        explode: True                                                                                                                                                                                                
        allowEmptyValue: True                                                                                                                                                                                        
        schema:                                                                                                                                                                                                      
          type: object                                                                                                                                                                                               
          additionalProperties:                                                                                                                                                                                      
            type: string                                                                                                                                                                                             
        style: form                                                                                                                                                                                                  
servers:                                                                                                                                                                                                             
- {url: 'https://encrypted.google.com'}

Configuration (browser query string, constructor, config.yaml)

{ "hl": "en", "q": "google" }

Expected Behavior

Based on my understanding of the style examples in the spec a free-form query parameter as described in the parameter object examples should produce a query string from a json object.

Meaning { "R": 100, "G": 200, "B": 150 } should be turned into R=100&G=200&B=150. (From examples)

Using the provided spec one can try with: { "hl": "en", "q": "google" } which should have produced a URL such as: https://encrypted.google.com/search?hl=en&q=google

Current Behavior

Using the provided spec a URL like this is produced: https://encrypted.google.com/search?freeForm={%20%22hl%22:%20%22en%22,%20%22q%22:%20%22google%22%20}

Possible Solution

Context

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
shockeycommented, May 17, 2018

Hi everyone, this was fixed in #4563:

image

We’ll ship a new version of Swagger-UI tomorrow, which will include this new feature.

Thanks!

0reactions
lock[bot]commented, Jul 2, 2019

Locking due to inactivity.

This is done to avoid resurrecting old issues and bumping long threads with new, possibly unrelated content.

If you think you’re experiencing something similar to what you’ve found here: please open a new issue, follow the template, and reference this issue in your report.

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to document dynamic query parameter names in ...
Free-form query parameters can be described using OpenAPI 3.x, but not OpenAPI 2.0 (Swagger 2.0). The parameter must have type: object with ...
Read more >
OpenAPI Specification - Version 3.0.3 - Swagger
The patch version SHOULD NOT be considered by tooling, making no ... A free-form query parameter, allowing undefined parameters of a specific type:....
Read more >
Query Parameters - Redash
Yes, with one exception. If a query uses a Text type parameter it cannot be embedded because Text parameters are not safe from...
Read more >
GraphQL specification
The goal of this specification is to provide a foundation and framework for an ecosystem of GraphQL tools, client libraries, and server implementations...
Read more >
Step 3: Parameters (API reference tutorial) | Documenting APIs
Request bodies are closely similar to parameters but are not ... for each of these parameter types comes from the OpenAPI specification, ...
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