Free-form query parameters does not seem to work according to spec
See original GitHub issueQ | 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:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi everyone, this was fixed in #4563:
We’ll ship a new version of Swagger-UI tomorrow, which will include this new feature.
Thanks!
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!