Forum Discussion

thebrokenspecto's avatar
thebrokenspecto
Occasional Visitor
4 years ago

Validating atleast one query Parameter

I want to Validate atleast one query parameter is  passed in GET request.Is there any way out that I will be able to achieve this?Any help will be appreciated!!!

  • thebrokenspecto,

     

    Yes this is easily acheivable!

     

    The example below shows how to do this

      parameters:
        skipParam:
          name: skip
          in: query
          description: number of items to skip
          required: true
          schema:
            type: integer
            format: int32

    The most important parts are "in: query" and "required: true". This means this parameter (the skipParam) needs to be provided in the query AND it is required, the operation won't operate properly without it.

     

    Let me know if you have any further questions!