odcslint¶
Lint your data contracts against the standard and your own rules.
odcslint is a linter for Open Data Contract Standard (ODCS) contracts, written in Rust. It checks every contract against the official schema and against the conventions your team agrees on. Where it can, it fixes problems for you and leaves your formatting alone.
What it checks¶
-
Schema validation
Each contract is validated against the official ODCS JSON Schema for its
apiVersion(see the supported versions). The schemas ship inside the binary, so nothing is downloaded, and every error points at a line and column. -
Your own rules
Rules turn team conventions into checks: approved owners, known domains, column order, naming, and required descriptions and tags. There are 11 rules to choose from, and you enable them in
odcslint.yml.
Autofix¶
odcslint check --fix repairs fixable findings in place. Instead of rewriting the file, it moves the original text, so comments, block scalars and blank lines stay where you put them.
properties:
- # Load metadata, added by the ingestion framework.
- - name: _loaded_at
- name: order_id
primaryKey: true
primaryKeyPosition: 1
- name: amount
+ # Load metadata, added by the ingestion framework.
+ - name: _loaded_at
Example output¶
$ odcslint check contracts/
contracts/orders.odcs.yaml
13:17 error approved_owners team member username `mallory` is not allowed; allowed values: alice, bob
20:9 error property_order expected `order_id` at position 1 of `orders`, found `_loaded_at` [*]
40:13 error property_order expected `street` at position 1 of `shipping_address`, found `_source_hash` [*]
contracts/payments.odcs.yaml
6:1 error schema unexpected property `owner`
Found 4 errors and 0 warnings (2 files checked). 2 findings marked [*] can be fixed with `odcslint check --fix`.
Speed, output and integrations¶
-
Fast
10,000 contracts take 0.4 s. Files are checked in parallel, and each schema is compiled only once.
-
Precise
Every finding has a line and column. Messages stay short and never print whole objects from your contract.
-
Runs everywhere
The same binary works on the command line, as a prek hook and as a GitHub Action that annotates pull requests.
-
Machine-readable
Output comes as
text,json,ndjson,csvorgithub, and the exit codes are documented.
Quick start¶
-
Install odcslint:
-
Check every
*.odcs.yamlbelow the current directory against the ODCS schema: -
Write a starter
odcslint.yml, then enable and tune the rules you want: -
Fix what can be fixed: