Skip to content

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

@rbjorklin

Description

@rbjorklin
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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions