openapi2callables.parse
Parse module for OpenAPI spec files with enhanced capabilities.
Functions
|
Get the OpenAPI spec from a URL or local file path. |
|
Parse the OpenAPI spec into a dictionary of tools. |
|
Extract type information from a schema object. |
|
Extract validation constraints from a schema object. |
Module Contents
- openapi2callables.parse.get_spec(spec_url_or_path)
Get the OpenAPI spec from a URL or local file path.
- Parameters:
spec_url_or_path (str) – URL or file path to the OpenAPI spec
- Returns:
The parsed OpenAPI spec as a dictionary
- Raises:
ValueError – If the file type is not supported or the file/URL cannot be accessed
- Return type:
Dict[str, Any]
- openapi2callables.parse.parse_spec(spec, tool_prefix=None, include_deprecated=False)
Parse the OpenAPI spec into a dictionary of tools.
- Parameters:
spec (Dict[str, Any]) – The OpenAPI spec as a dictionary
tool_prefix (Optional[str]) – Optional prefix to filter paths
include_deprecated (bool) – Whether to include deprecated operations
- Returns:
A dictionary of tools, keyed by operationId
- Return type:
Dict[str, Dict[str, Any]]
- openapi2callables.parse.extract_type_from_schema(schema)
Extract type information from a schema object.
- Parameters:
schema (Dict[str, Any]) – The schema object
- Returns:
The extracted type information
- Return type:
Union[str, List[str], Dict[str, Any]]
- openapi2callables.parse.extract_constraints(schema)
Extract validation constraints from a schema object.
- Parameters:
schema (Dict[str, Any]) – The schema object
- Returns:
A dictionary of constraints
- Return type:
Dict[str, Any]