Clarification on swagger validation
I am using swagger for API documentation. We have a JSON file that gets rendered by swagger.
for one of the API we have 3 input parameters
param1 param2 param3
if the user specifies values for param1,param2 then param3 should behave as optional.
if the user specifies values for param3 then the param1,param2 should behave as optional.
either param,param2 are required or only param3 is required.
Any suggestions would be greatly appreciated.
Hey @Maktum_pasha. By default, OpenAPI treats all request parameters as optional. You can add
required: true to mark a parameter as required. Note that path parameters must have
required: true, because they are always required. You can find more information here: https://swagger.io/docs/specification/describing-parameters/. Let me know if this helps!