Using the Exclude Field
Sometimes provided CSS selectors, no matter how specific, still select unwanted elements. This litters the resulting OpenAPI schema. When required HTML elements cannot be picked apart simply through CSS selectors, the Exclude field can be used to filter them by tag content.
The Exclude field works by ignoring the operation, request body, parameter, or response currently being crawled when the provided CSS selector picks up a value for a field that meets any of its conditions1 for exclusion.
true for the value.
This is the HTML element matching the provided CSS selector.
The text obtained from
This is a read-only object containing the current plugin configuration (including crawled data).
This is also a read-only object, but contains API operation data instead; particularly the API operation tied to the field being currently crawled. This is only available in the Request Body, Parameter, and Response tabs.
log(String:text)- use this to print text to your browser's console
error(String:text)- use this to print text to your browser's console in red to signal the occurrence of an error
Consider the following HTML table defining supported path and body parameters together:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
<table class="parameters"> <thead> <tr> <th>Name</th> <th>Located In</th> <th>Description</th> <th>Required</th> <th>Schema</th> </tr> </thead> <tbody> <tr> <td>threadId</td> <td>path</td> <td>The ID of the thread where the comment belongs to</td> <td>Yes</td> <td>integer</td> </tr> <tr> <td>body</td> <td>body</td> <td>The comment to create</td> <td>Yes</td> <td> <pre> <!-- Sample JSON payload --> <!-- Omitted for briefness --> </pre> </td> </tr> </tbody> </table>
In the plugin's Parameter tab, we would only need to scan path and query parameters; so our task for this example is to exclude body parameters. To do this, we'll be using the Exclude field:
The above configuration tells the Crawler to look for the location of a parameter in the second column of each row
(every row describes one parameter). If the second column's value is the string
"body", then the Crawler would ignore
the current parameter entry. For our example, this means it would ignore the
body parameter, but would still take in
The Exclude field can hold multiple conditions for exclusion. ↩