A structured, testable system for defining, validating, and documenting logging events using Jsonnet.
This repository provides a central source of truth for CIO mobile SDKs log definitions across features and platforms.
- Each feature has its own
.jsonnet
definition underfeatures/<feature-name>/
- These files are compiled into machine-readable
.json
files - Unit tests verify the structure and content of each feature’s output
.json
files
.
├── features/ # Jsonnet definitions per feature
│ ├── push/
│ │ └── push.jsonnet
│ ├── init/
│ │ └── core.jsonnet
│ └── ...
├── generated/ # Compiled JSON output
│ └── json/
│ └── push/
│ └── push.json
├── scripts/ # Helper scripts
│ ├── ...
├── __tests__/ # Jest unit tests per feature
│ ├── ...
Install dependencies for building and testing:
brew install jsonnet
npm install
Run the build script to generate .json
files from all .jsonnet
files in the features/
directory:
npm run buildJson
Run the build script to generate .mmd
diagrams from all .json
files in the generated/json
directory:
npm run buildDiagrams
Check that all .jsonnet
files have corresponding .json
outputs:
npm run validateGeneration
To define a new logging feature:
- Create a
.jsonnet
file underfeatures/<your-feature>/
- Run
npm run buildJson
to generate the.json
file - Run
npm run buildDiagrams
to generate the.mmd
file - Add a test under
__tests__/<your-feature>.test.js
- Run
npm test
to validate
Each .jsonnet
feature must have a corresponding Jest test file under __tests__/
that:
- Verifies required keys
- Checks for uniqueness of IDs
- Ensures optional fields like
success
,error
,next
are valid if present
Run all tests:
npm test
MIT