Skip to content

Type encoder

๐Ÿค– AI-Generated Content

This documentation was generated with AI assistance and is still being audited. Some, or potentially a lot, of this information may be inaccurate. Learn more.

pyvider.cty.conversion.type_encoder

Classes

Functions

encode_cty_type_to_wire_json

encode_cty_type_to_wire_json(cty_type: CtyType[Any]) -> Any

Encodes a CtyType into a JSON-serializable structure for the wire format by delegating to the type's own _to_wire_json method.

Source code in pyvider/cty/conversion/type_encoder.py
def encode_cty_type_to_wire_json(cty_type: CtyType[Any]) -> Any:
    """
    Encodes a CtyType into a JSON-serializable structure for the wire format
    by delegating to the type's own `_to_wire_json` method.
    """
    if not isinstance(cty_type, CtyType):
        error_message = ERR_EXPECTED_CTYTYPE.format(type_name=type(cty_type).__name__)
        raise TypeError(error_message)
    return cty_type._to_wire_json()