How to change query parameter name in swagger?

Multi tool use
Multi tool use


How to change query parameter name in swagger?



I am trying to get this url:



https://search.me/Search/api/search?map=%7B%22query%22:%22CSCI+250%22,%22rows%22:500,%22term%22:%222181%22,%22career%22:%22%22,%7D


https://search.me/Search/api/search?map=%7B%22query%22:%22CSCI+250%22,%22rows%22:500,%22term%22:%222181%22,%22career%22:%22%22,%7D



without converting special characters to HEX to URL would be:



https://search.me/Search/api/search?map={query:CSCI-250,rows:500,term:2181,career:}


https://search.me/Search/api/search?map={query:CSCI-250,rows:500,term:2181,career:}



I know it is not possible to serialize special characters as hex in openapi 3.0.0, so I am fine with the full JSON in the query parameter.



Where the parameter is a JSON -> URI
The JSON is:


{
map: {
"query": "CSCI 250",
"rows": 500,
"term": 2181,
"career": ""
}
}



but swagger instead renders:



https://search.me/search/api/search?query=CSCI-250&rows=500&term=2181&career=


https://search.me/search/api/search?query=CSCI-250&rows=500&term=2181&career=



As you can see, special characters are then converted into HEX.



Below is my path. What exactly am I doing wrong?


paths:
/search:
get:
summary: Search
parameters:
- in: query
name: map
description: JSON for lookup
required: true
schema:
$ref: '#/components/schemas/QueryParams'
responses:
200:
description: Course search response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/QueryResults'
400:
description: Bad request





Is the expected example .../map?=CSCI-250 correct? It has = directly after ? so the first parameter name seems to be missing.
– Helen
Jul 2 at 14:01


.../map?=CSCI-250


=


?





I added the correct URL that I need. @Helen
– Pants
Jul 2 at 14:17





I don't mind not converting to hex as I documented this, I just want the correct parameter name to be displayed. Should be map not query
– Pants
Jul 2 at 14:20


map


query





Possible duplicate of Defining an API with swagger: GET call that uses JSON in parameters
– Helen
Jul 2 at 14:40





My answer there is for OpenAPI 3.0.
– Helen
Jul 2 at 14:59









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

6LJFw,o550YePKJeok
wH7 bk0dDy8LIqNZTp7x5ALh 6,TLKHgS 1L0Tyqb5QjySSiF nfhuzoqraAV HGtB6hx,l48063i

Popular posts from this blog

PHP contact form sending but not receiving emails

Do graphics cards have individual ID by which single devices can be distinguished?

Create weekly swift ios local notifications