1.3 KiB
1.3 KiB
Outline
Original rough outline document.
- Json path & schema based
- Select nodes using path
- Validate each using schema (fragment)
Feedback & Output
- message if schema mutates fragment
- message if fragment fails schema
Rules
Metadata
- level (debug, info, warn, error)
- tags
Body
- check (schema)
- filter (jsonpath)
- select (jsonpath)
Arguments
- config file
- dest (file, stdout)
- exclude-level
- exclude-rule
- exclude-tag
- include-level
- include-rule
- include-tag
- mode (check, fix)
- rule paths
- source (file, stdin)
Config
- should have schema and be validated
- support all arguments (except config file)
- parent config
Run
- Load source and copy to state
- Load all fragments in rule paths
- Build list of applicable rules by level, name, tag
- For each rule:
- Select potential nodes
- Filter applicable nodes
- Copy fragment
- Apply schema
- If schema passes and output matches, log success
- If schema passes and output differs, log difference
- If schema fails, log errors and mark error
- If running in fix mode and schema passed, update state
- After all rules:
- If running in fix mode and all rules passed:
- Log differences between source and state
- Write state to dest
Dependencies
- ajv
- jsonpath-plus
- js-yaml