Adding parameters to the OpenAPI descriptor
Use the context menu to add parameter objects to the OpenAPI descriptor.
Procedure
- Right-click in the OpenAPI Editor and click New > Parameter Object.
-
In the tree, select the level where you want to create the parameter.
The wizard shows a tree for all existing paths, methods, and operationIDs within the OpenAPI descriptor that you edit. The Path column contains the following items:You can create a parameter globally for the whole OpenAPI descriptor, on a specified path, or for a specified operation.
- The root or basepath. This is the only path that never has children and it is the first entry in the table.
- Additional path entries with the OpenAPI descriptor are listed after the root or basepath entry.
- To create the parameter globally, select the basePath in the table. If no basePath is defined in the OpenAPI descriptor, select root.
- To create the parameter for a specified path, select one of the path names in the table.
- To create the parameter for a specified operation, expand the path to where the operation is defined and select the operation.
- Specify a name for the parameter.
-
Select how you want to pass the parameter from the In list.
- If the swagger does not contain a definition object, the body parameter is not available in the list.
- When you select a value in the In list, an additional list is displayed:
- For the path, query, or header parameter, a Type list is displayed. Select the type of parameter to be created.
- For the body parameter, a Definition name list is displayed. Select a definition for the body parameter to reference.
-
Specify whether the parameter is required.
By default, path parameters are set to Required regardless of the checkbox because path parameters are always required.