stixflayer
Fast, strict STIX 2.1 parsing, validation, and serialization in Rust.
stixflayer validates STIX 2.1 JSON against the OASIS specification, including
its MUST/SHOULD distinction. The same engine also powers the Python package and
the stixflayer CLI, so every interface returns the same verdict.
Install
cargo add stixflayer
Parse and validate
Parsing validates. Bundle::from_json returns a parsed bundle or a structured
StixError; there is no separate validate call to forget.
use Bundle;
Validation model
- Structural checks always run: required properties, JSON types, identifiers, timestamps, and closed enumerations.
- MUST violations are errors. SHOULD findings are warnings and never reject a
document.
from_json_outcomereturns both lists as structured entries withkind,message, and optionalproperty,value, andobject_idfields. ValidationOptions::new(allow_custom, strict)controls unknown properties and semantic checks. The default is(false, true): unknown properties are rejected and SHOULD checks run.- Validation collects independent findings instead of stopping at the first
error. Object-scoped findings carry the object's
id.
See the StixError
API documentation for the error and warning kinds.
Command-line validation
The stixflayer binary validates files, directories, and standard input
without a Python or Rust project:
cargo install stixflayer-cli
stixflayer path/to/bundle.json
It exits 0 when every document is valid, 1 when any document is invalid,
and 2 on a usage or I/O failure.
Related packages
- Python library:
pip install stixflayer - CLI:
cargo install stixflayer-cliorpip install stixflayer-cli - Guides and conformance notes: https://osintalex.github.io/stixflayer/
- API reference: https://docs.rs/stixflayer