Table: openapi_path - Query OpenAPI Paths using SQL
OpenAPI is a specification for machine-readable interface files for describing, producing, consuming, and visualizing RESTful web services. It provides a way to describe the capabilities of a service in a standard, language-agnostic manner. This allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic.
Table Usage Guide
The openapi_path
table provides insights into the paths defined within an OpenAPI specification. As a developer or API designer, explore path-specific details through this table, including the available operations, parameters, and responses. Utilize it to uncover information about the API's structure, such as the available endpoints, the HTTP methods they support, and the expected request and response formats.
Examples
Basic info
Explore the API paths in a project to determine if any are outdated or no longer in use. This can assist in maintaining the efficiency of your code by identifying and removing unnecessary elements.
select api_path, deprecated, description, tags, pathfrom openapi_path;
select api_path, deprecated, description, tags, pathfrom openapi_path;
List all deprecated endpoints
Uncover the details of outdated API endpoints in your application. This can help you identify areas that may need updates or replacement, ensuring your application stays current and secure.
select api_path, description, tags, pathfrom openapi_pathwhere deprecated;
select api_path, description, tags, pathfrom openapi_pathwhere deprecated = 1;
List all GET method endpoints
Explore all endpoints that use the GET method to understand how your API interacts with data. This can help optimize the performance and security of your API by identifying potential areas for improvement.
select api_path, description, parameters, pathfrom openapi_pathwhere method = 'GET';
select api_path, description, parameters, pathfrom openapi_pathwhere method = 'GET';
Get the parameters required for a specific endpoint
Explore the required parameters for a specific endpoint to better understand its necessary inputs and structure. This is particularly useful for ensuring proper API calls and data retrieval.
select api_path, p ->> 'name' as param, case when p -> 'required' is not null then true else false end as is_required, jsonb_pretty(p -> 'schema') as schema, pathfrom openapi_path, jsonb_array_elements(parameters) as pwhere api_path = '/org/{org_handle}/audit_log/get';
select api_path, json_extract(p.value, '$.name') as param, case when json_extract(p.value, '$.required') is not null then 1 else 0 end as is_required, p.value as schema, pathfrom openapi_path, json_each(parameters) as pwhere api_path = '/org/{org_handle}/audit_log/get';
Get the success response schema of a specific endpoint
Explore the structure of a successful response from a specific API endpoint. This can be useful to understand the data format and fields returned upon successful API calls, aiding in the development of applications that interact with this endpoint.
select api_path, jsonb_pretty(responses -> '200') as success_response, pathfrom openapi_pathwhere api_path = '/identity/{identity_handle}/get';
select api_path, responses as success_response, pathfrom openapi_pathwhere api_path = '/identity/{identity_handle}/get';
Schema for openapi_path
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
api_path | text | A relative path to an individual endpoint. | |
callbacks | jsonb | A map of possible out-of band callbacks related to the parent operation. | |
deprecated | boolean | True, if the operation to be deprecated. | |
description | text | A verbose explanation of the operation behavior. | |
external_docs | jsonb | Additional external documentation for this operation. | |
method | text | Specify the HTTP method. | |
operation_id | text | Unique string used to identify the operation. | |
parameters | jsonb | A list of parameters that are applicable for this operation. | |
path | text | = | Path to the file. |
request_body | jsonb | The request body applicable for this operation. | |
responses | jsonb | The list of possible responses as they are returned from executing this operation. | |
security | jsonb | A declaration of which security mechanisms can be used for this operation. The list of values includes alternative security requirement objects that can be used. | |
servers | jsonb | An alternative server array to service this operation. If an alternative server object is specified at the Path Item Object or Root level, it will be overridden by this value. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
summary | text | A short summary of what the operation does. | |
tags | jsonb | A list of tags for API documentation control. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- openapi
You can pass the configuration to the command with the --config
argument:
steampipe_export_openapi --config '<your_config>' openapi_path