Given that path parameter must be required according to the OpenAPI/Swagger spec, you can consider adding 2 separate endpoints with the following paths:
/get/{param1}/{param2}
when param2 is provided/get/{param1}/
when param2 is not provided
More Related Contents:
- Swagger: How to have a property reference a model in OpenAPI 2.0 (i.e. nest the models)?
- How to specify if a field is optional or required in OpenAPI/Swagger?
- How to return an array of objects in SwaggerHub?
- How to document dynamic query parameter names in OpenAPI (Swagger)?
- How to define a mixed-type array (with different element types) in OpenAPI 2.0?
- How to define a property that can be string or null in OpenAPI (Swagger)?
- Swagger schema properties ignored when using $ref – why?
- How to define mutually exclusive query parameters in Swagger (OpenAPI)?
- Swagger 2.0: Multiple Path objects with different paths but same request and response
- Swagger/OpenAPI – use $ref to pass a reusable defined parameter
- How to convert OpenAPI 2.0 to OpenAPI 3.0? [closed]
- Swagger: wildcard path parameters
- Swagger: “equivalent path already exists” despite different parameters
- Re-using model with different required properties
- How to write OpenAPI 3 (Swagger) specification for property name in `map` object?
- How not to copy-paste 3 generic error responses in almost all paths?
- How to define global parameters in OpenAPI?
- Schema object without a type attribute in Swagger 2.0
- Swagger: take one or more values from enum
- How to export swagger.json (or yaml)
- How to add multiple example values in swagger properties?
- How can I represent ‘Authorization: Bearer ‘ in a Swagger Spec (swagger.json)
- Swagger HashMap property type
- Post a json body with swagger
- Swagger API which is having query string
- OpenAPI query string parameter with list of objects
- How to add multiple example values for an array in OpenAPI/Swagger?
- OpenAPI path/query parameters nested structure serialization
- Sending cookie session id with Swagger 3.0
- Why `additionalProperties` is the way to represent Dictionary/Map in Swagger/OpenAPI 2.0