I have query parameter http://localhost:8080/test?username=User Name . Below is the spec used
/test:
get:
description: Pass name
parameters:
- name: username
in: query
required: true
schema:
type: string
allowReserved: true
the spec validation is failing with "bad request" error when the query parameter contains spaces. how to pass spaces in query paramer in Open API 3
Escape the space!
you can use
encodeURIComponent
to do that:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent