schema
cheshmhayash schema shows what the loaded schemas contain and how each subject decodes. It reads the [schemas] section of settings.toml and every --schemas file. The schemas guide explains the file format.
| Command | What it does |
|---|---|
schema list [-v] |
Lists the sources, with files, skipped files and message counts. -v explains each skipped file. |
schema messages [FILTER] [--source NAME] |
Lists message names, optionally only those that contain FILTER. |
schema show MESSAGE |
Shows the fields of a message. |
schema resolve SUBJECT... |
Shows which message each subject decodes as. |
schema check |
Fails when a source skipped files or a rule names a missing message. Use it in CI. |
Examples
Section titled “Examples”$ cheshmhayash schema list --schemas schemas.tomlSOURCE TYPE FILES SKIPPED MESSAGES PATHshop proto_dir 2 0 3 proto
1 subject rules$ cheshmhayash schema messages --schemas schemas.tomlshop:google.protobuf.Timestampshop:shop.v1.Itemshop:shop.v1.OrderCreated$ cheshmhayash schema show --schemas schemas.toml shop:shop.v1.OrderCreatedmessage shop:shop.v1.OrderCreated (shop/v1/orders.proto) 1 string order_id 2 string customer_id 3 repeated shop.v1.Item items 4 int64 total_cents 5 google.protobuf.Timestamp created_at$ cheshmhayash schema resolve --schemas schemas.toml shop.orders.created shop.orders.paidSUBJECT RULE MESSAGE STATUSshop.orders.created shop.orders.created shop:shop.v1.OrderCreated okshop.orders.paid - - no rule: decoded as JSON, text, protowire or base64$ cheshmhayash schema check --schemas schemas.tomlok: 1 sources, 1 subject rulesschema check exits non-zero on a problem, so a schemas repository can run it on each merge request.