Repository navigation
Commit 0301e5b
committed
feat(ocsf): add JSON Schema validator for OCSF events
Add openshell-ocsf-validate, which validates an OCSF event against the
JSON Schema the OCSF schema server exports for the event's version,
class, and declared profiles. The exports encode required attributes,
at_least_one constraints, undefined attributes, types, and enum values,
so the crate delegates to the jsonschema crate and only selects the
schema.
An exported schema covers one fixed set of profiles, so the crate vendors
one export per class and profile combination that OpenShell emits, under
schemas/v<version>/<class>@<profiles>.json. An event whose version or
combination has no vendored schema fails with the schemas/update.sh
command that vendors it. Keying on the event's version lets a new OCSF
version's schemas land before the emitters switch to it. The build
embeds every vendored file.
Top-level container is accepted unvalidated, as OCSF does not define it
at the event level (#4915).
Signed-off-by: Kris Hicks <khicks@nvidia.com>1 parent c5850d7 commit 0301e5b
28 files changed
Lines changed: 145685 additions & 25 deletions
File tree
- crates/openshell-ocsf-validate
- schemas
- v1.8.0
- src
- tests
- suites/conformance
- testkit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| |||
0 commit comments