According to the tket json schema Operation field should support the classical field for some kinds of Operations. Attached is an example of what a python implementation might look like.
class Conditional(BaseModel):
"""Used in Operation. Defines gate operation conditionally on classical registers.
Based on pytket.circuit.Conditional."""
op: "Operation"
width: int
value: int
class GenericClassical(BaseModel):
"""Type that encompasses all the classical operations listed in generic_classical_types.
Those operations are described in https://cqcl.github.io/tket/pytket/api/optype.html, but
they all have the same fields and so can be serialised and deserialised using this
GenericClassical type."""
n_i: Optional[int] = None
n_io: Optional[int] = None
name: Optional[str] = None
values: Optional[Union[List[int], List[bool]]] = None
upper: Optional[int] = None
lower: Optional[int] = None
Classical = Union[
MultiBit, # If the Classical has an `n` field we know it's a MultiBit operation.
GenericClassical,
]
https://github.com/CQCL/tket/blame/a47578ec5d79bb5caf23ef2edee3f587bc3c7d14/schemas/circuit_v1.json#L127
According to the tket json schema Operation field should support the
classical
field for some kinds of Operations. Attached is an example of what a python implementation might look like.