XetoCLI
XetoCLI
A client interface to Haxall's Xeto CLI tools for type checking and analysis of Haystack records.
This API is experimental and subject to change in future releases.
XetoCLI can be directly imported as follows:
from phable import XetoCLI
Source code in src/phable/xeto_cli.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |
__init__
__init__(*, io_format='zinc')
Initialize a XetoCLI instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
io_format
|
typing.Literal['json', 'zinc']
|
Data serialization format for communication with Haxall. Either |
'zinc'
|
Source code in src/phable/xeto_cli.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
validate
validate(recs, graph=True)
Validate records against Xeto type specifications.
This method executes the Haxall xeto validate command to determine whether
the provided records conform to their declared Xeto types. It returns a grid
of validation errors and warnings, including any type mismatches or missing
required tags.
Example:
from phable import Marker, Number, Ref, XetoCLI
cli = XetoCLI()
recs = [
{
"dis": "Site 1",
"site": Marker(),
"area": Number(1_000, "square_foot"),
"spec": Ref("ph::Site"),
}
]
result = cli.validate(recs)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recs
|
list[dict[str, typing.Any]]
|
List of Haystack record dictionaries to analyze. Each record should
specify a Xeto type with a |
required |
graph
|
bool
|
If |
True
|
Returns:
| Type | Description |
|---|---|
phable.Grid
|
|
phable.Grid
|
|
Source code in src/phable/xeto_cli.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |