Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions extensions/vendors.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,31 @@ payload. Behavior defined only in `data` is non-portable.
Quoted and unquoted values under `data` are shown in
[`nonportable_extensions.md`](nonportable_extensions.md).

## Validating a vendor's payload

`validation/validate.py` does not interpret `data` unless a vendor is named. With
`--vendor THOUGHTSPOT` it hands the `data` object of every `THOUGHTSPOT` entry in
a semantic model or a mapping document to the validator the vendor's own package
registers under the entry point group `ossie.vendor_validators`, with the token
from the table below as the entry point name. The validator is a callable
`check(payload, site)`: `payload` is a copy of the `data` object, and `site` has
`kind` (one of `model`, `dataset`, `field`, `metric`, `relationship`, `mapping`),
`name` (for `model` and `mapping`, the name of the document), and `dataset` (the
owning dataset of a field or a dataset-scoped metric, otherwise `None`). It
returns the messages to report, a single string for one message, or `None` for
none; the script prefixes each with the vendor and the site (`[Vendor
THOUGHTSPOT] Field 'orders.amount' in model 'sales': ...`) and counts it as an
error. A validator that raises, or exits, is reported the same way, with the
traceback on stderr. Vendor checks run on a document that passed the schema and
the other checks. Only the entries of the file being validated are handed over,
not those of a document it references, and entries of other vendors are not
handed over at all. The package has to be installed where the script runs; for a
uv run that is:

```sh
uv run --with <package> validation/validate.py --vendor THOUGHTSPOT model.yaml
```

## Known vendors

| Vendor | Description |
Expand Down
2 changes: 1 addition & 1 deletion validation/tests/test_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -1862,7 +1862,7 @@ def test_cli_reports_a_check_that_raises_and_goes_on(tmp_path, monkeypatch, caps
good = _write_document(tmp_path, "good.json", _document([_CUSTOMERS], []))
bad = _write_document(tmp_path, "bad.json", _document([_ORDERS], []))

def explode(data, schema, base=None):
def explode(data, schema, base=None, vendors=None):
if "orders" in json.dumps(data):
raise KeyError("dialect")
return []
Expand Down
Loading
Loading