OpenAPIToolkit
parse_openapi_file
prance.ResolvingParser
to parse and
resolve the given OpenAPI specification file, returning the parsed
OpenAPI specification as a dictionary.
Parameters:
- openapi_spec_path (str): The file path or URL to the OpenAPI specification.
None
if the package is not installed.
openapi_spec_to_openai_schemas
- api_name (str): The name of the API, used to prefix generated function names.
- openapi_spec (Dict[str, Any]): The OpenAPI specification as a dictionary.
openapi_function_decorator
apiKey
type security schemes and automatically injects the necessary
API keys from environment variables. Parameters in path
, query
,
header
, and cookie
are also supported.
Parameters:
- api_name (str): The name of the API, used to retrieve API key names and URLs from the configuration.
- base_url (str): The base URL for the API.
- path (str): The path for the API endpoint, relative to the base URL.
- method (str): The HTTP method (e.g., ‘get’, ‘post’) for the request.
- openapi_security (List[Dict[str, Any]]): The global security definitions as specified in the OpenAPI specs.
- sec_schemas (Dict[str, Dict[str, Any]]): Detailed security schemes.
- operation (Dict[str, Any]): A dictionary containing the OpenAPI operation details, including parameters and request body definitions.
generate_openapi_funcs
openapi_function_decorator
, which configures them to construct and
send the HTTP requests with appropriate parameters, headers, and body
content.
Parameters:
- api_name (str): The name of the API, used to prefix generated function names.
- openapi_spec (Dict[str, Any]): The OpenAPI specification as a dictionary.
apinames_filepaths_to_funs_schemas
- apinames_filepaths (List[Tuple[str, str]]): A list of tuples, where each tuple consists of: - The API name (str) as the first element. - The file path (str) to the API’s OpenAPI specification file as the second element.