API Reference

This page provides detailed API documentation for the JSONCrack Sphinx extension.

Extension Module

Backward compatibility module for jsoncrack_for_sphinx.extension

This module provides backward compatibility for old imports. All functionality has been moved to core.extension.

jsoncrack_for_sphinx.extension.setup(app: Sphinx) Dict[str, Any][source]

Set up the Sphinx extension.

Configuration Module

Configuration management for JSONCrack Sphinx extension.

class jsoncrack_for_sphinx.config.ContainerConfig(direction: Directions = Directions.RIGHT, height: int | str = '500', width: int | str = '100%')[source]

Bases: object

Container configuration.

class jsoncrack_for_sphinx.config.Directions(value)[source]

Bases: Enum

JSONCrack visualization directions.

DOWN = 'DOWN'
LEFT = 'LEFT'
RIGHT = 'RIGHT'
TOP = 'TOP'
class jsoncrack_for_sphinx.config.JsonCrackConfig(render: RenderConfig | None = None, container: ContainerConfig | None = None, theme: Theme = Theme.AUTO, search_policy: SearchPolicy | None = None, disable_autodoc: bool = False, autodoc_ignore: List[str] | None = None)[source]

Bases: object

Main JSONCrack configuration.

class jsoncrack_for_sphinx.config.PathSeparator(value)[source]

Bases: Enum

Path separator options for schema file search.

DOT = '.'
NONE = 'none'
SLASH = '/'
class jsoncrack_for_sphinx.config.RenderConfig(mode: OnClick | OnLoad | OnScreen)[source]

Bases: object

Render configuration.

class jsoncrack_for_sphinx.config.RenderMode[source]

Bases: object

Render mode configuration classes.

class OnClick[source]

Bases: object

Click to load mode - loads when user clicks the button.

class OnLoad[source]

Bases: object

Immediate load mode - loads when page loads.

class OnScreen(threshold: float = 0.1, margin: str = '50px')[source]

Bases: object

Viewport load mode - loads when element becomes visible.

class jsoncrack_for_sphinx.config.SearchPolicy(include_package_name: bool = False, include_path_to_file: bool = True, path_to_file_separator: PathSeparator = PathSeparator.DOT, path_to_class_separator: PathSeparator = PathSeparator.DOT, custom_patterns: list | None = None)[source]

Bases: object

Schema file search policy configuration.

class jsoncrack_for_sphinx.config.Theme(value)[source]

Bases: Enum

Theme options.

AUTO = None
DARK = 'dark'
LIGHT = 'light'
jsoncrack_for_sphinx.config.get_config_values(config: JsonCrackConfig) Dict[str, Any][source]

Extract configuration values for HTML generation.

jsoncrack_for_sphinx.config.parse_config(config_dict: Dict[str, Any]) JsonCrackConfig[source]

Parse configuration dictionary into JsonCrackConfig object.

Utilities Module

Utility functions and common types.

jsoncrack_for_sphinx.utils.__getattr__(name: str) Any[source]

Lazy import for backward compatibility.

jsoncrack_for_sphinx.utils.create_function_schema(temp_dir: Path, function_name: str, schema_data: Dict[str, Any]) Path[source]

Create a schema file for a function.

jsoncrack_for_sphinx.utils.create_method_schema(temp_dir: Path, class_name: str, method_name: str, schema_data: Dict[str, Any]) Path[source]

Create a schema file for a method.

jsoncrack_for_sphinx.utils.create_option_schema(temp_dir: Path, base_name: str, option_name: str, schema_data: Dict[str, Any]) Path[source]

Create a schema file for an option.

Fixtures Module

Backward compatibility module for fixtures

This module provides backward compatibility for old imports. All functionality has been moved to utils.fixtures.

jsoncrack_for_sphinx.fixtures.create_function_schema(temp_dir: Path, function_name: str, schema_data: Dict[str, Any]) Path[source]

Create a schema file for a function.

jsoncrack_for_sphinx.fixtures.create_method_schema(temp_dir: Path, class_name: str, method_name: str, schema_data: Dict[str, Any]) Path[source]

Create a schema file for a method.

jsoncrack_for_sphinx.fixtures.create_option_schema(temp_dir: Path, base_name: str, option_name: str, schema_data: Dict[str, Any]) Path[source]

Create a schema file for an option.

jsoncrack_for_sphinx.fixtures.schema_to_rst(schema_path: Path, title: str | None = None) str[source]

Convert a JSON schema file to reStructuredText format.

This function is provided as a fixture for tests to convert schema files to reStructuredText format.

Parameters:
  • schema_path – Path to the JSON schema file

  • title – Optional title for the schema section

Returns:

reStructuredText representation of the schema