How to make query paramater in Shared Parameters section required

On, I defined a few query parameters in the Shared Parameters.
I do not see any option to make them required in the resource section where this parameter is being used.
The required option is disabled.

Thanks in advance!

Hey Maneesh,

We, unfortunately, don’t support it in Design View but you can add it to the query parameter in write view by adding

"required": true

Like this?
“parameters”: [
“$ref”: “#/parameters/last-batch-id”,
“required”: true

I added the required at the ref and it did not work. Do I have to add it to the shared parameter? If yes, how can i used it as required for some requests and not required for some requests?

Hey Maneesh,

It would have to be added to the shared parameter. So for this case, I would suggest creating two shared query parameters, one that is required and the other not required.

1 Like