Generate code from JSON Schema
Bring Scryr’s architecture model into the language your tools already use. Generate types for dashboards, service integrations, and investigation scripts from one shared schema.
Generate the schema
Section titled “Generate the schema”With the Scryr CLI installed, run this from your manifest project:
scryr inspect schema --path index.scry > scryr-schema.jsonThe output contains three model schemas: Manifest, Forge, and Diagram. Select the one your tool needs with jq. These examples use Manifest, keeping its nested definitions together:
jq '.models.Manifest' scryr-schema.json > manifest.schema.jsonmkdir -p generatedUse .models.Forge or .models.Diagram to generate those models instead. The schema describes Scryr’s data types; the generators below turn those definitions into source files for your project.
TypeScript
Section titled “TypeScript”Use json-schema-to-typescript. It produces TypeScript declarations from schema properties, references, and enums—useful for giving Scryr dashboards and editor tools autocomplete and compile-time checks without maintaining interfaces by hand.
With the Scryr CLI installed and jq available, run these commands from your manifest project. scryr inspect schema exports the JSON schemas; jq selects Manifest with its nested definitions. Replace index.scry with your manifest entrypoint.
scryr inspect schema --path index.scry > scryr-schema.jsonjq '.models.Manifest' scryr-schema.json > manifest.schema.jsonmkdir -p generated
npm install --save-dev json-schema-to-typescriptnpx json2ts -i manifest.schema.json -o generated/manifest.d.tsImport the generated types in your frontend or Node.js tooling.
Use quicktype. Its Go output provides structs and JSON conversion helpers, making Scryr’s model straightforward to consume in service inventory tools and operational CLIs.
With the Scryr CLI installed and jq available, run these commands from your manifest project. scryr inspect schema exports the JSON schemas; jq selects Manifest with its nested definitions. Replace index.scry with your manifest entrypoint.
scryr inspect schema --path index.scry > scryr-schema.jsonjq '.models.Manifest' scryr-schema.json > manifest.schema.jsonmkdir -p generated
npx --yes --package quicktype quicktype \ --src-lang schema --lang go --top-level Manifest \ --package architecture \ --out generated/manifest.go manifest.schema.jsonUse the generated architecture package in your Go project.
Use quicktype. It generates Java model classes with Jackson serialization support, a useful fit for bringing Scryr’s architecture data into JVM services and internal tooling.
With the Scryr CLI installed and jq available, run these commands from your manifest project. scryr inspect schema exports the JSON schemas; jq selects Manifest with its nested definitions. Replace index.scry with your manifest entrypoint.
scryr inspect schema --path index.scry > scryr-schema.jsonjq '.models.Manifest' scryr-schema.json > manifest.schema.jsonmkdir -p generated/java
npx --yes --package quicktype quicktype \ --src-lang schema --lang java --top-level Manifest \ --package com.example.architecture \ --out generated/java/Manifest.java manifest.schema.jsonAdd the generated Java files to your project’s source tree and include the Jackson dependencies described in the generated converter.
Use Typify, through its cargo-typify CLI. It creates Rust structs and enums with Serde support, giving Scryr-based CLIs typed model access and JSON serialization within the Rust ecosystem.
With the Scryr CLI installed and jq available, run these commands from your manifest project. scryr inspect schema exports the JSON schemas; jq selects Manifest with its nested definitions. Replace index.scry with your manifest entrypoint.
scryr inspect schema --path index.scry > scryr-schema.jsonjq '.models.Manifest' scryr-schema.json > manifest.schema.jsonmkdir -p generated
rustup component add rustfmtcargo install cargo-typify --lockedcargo typify manifest.schema.json --output generated/manifest.rsInclude the generated module in your crate and add the crates referenced by its generated types, including serde and serde_json.
Use quicktype. Its Swift output uses Codable models, making Scryr architecture data convenient to load in native macOS investigation tools or iOS service dashboards.
With the Scryr CLI installed and jq available, run these commands from your manifest project. scryr inspect schema exports the JSON schemas; jq selects Manifest with its nested definitions. Replace index.scry with your manifest entrypoint.
scryr inspect schema --path index.scry > scryr-schema.jsonjq '.models.Manifest' scryr-schema.json > manifest.schema.jsonmkdir -p generated
npx --yes --package quicktype quicktype \ --src-lang schema --lang swift --top-level Manifest \ --out generated/Manifest.swift manifest.schema.jsonAdd Manifest.swift to your app target and decode model JSON with Swift’s JSONDecoder.
Python
Section titled “Python”Use datamodel-code-generator. It generates Pydantic models from JSON Schema, bringing typed fields and runtime validation to scripts that consume Scryr data in a separate Python project.
With the Scryr CLI installed and jq available, run these commands from your manifest project. scryr inspect schema exports the JSON schemas; jq selects Manifest with its nested definitions. Replace index.scry with your manifest entrypoint.
scryr inspect schema --path index.scry > scryr-schema.jsonjq '.models.Manifest' scryr-schema.json > manifest.schema.jsonmkdir -p generated
uvx --from datamodel-code-generator datamodel-codegen \ --input manifest.schema.json --input-file-type jsonschema \ --output-model-type pydantic_v2.BaseModel \ --output generated/manifest.pyRun the generator with uv, then use the generated models in a project with Pydantic v2 installed.
Use quicktype. It generates C++ model types and JSON conversion code for nlohmann/json, giving native tools a convenient way to read Scryr’s architecture data.
With the Scryr CLI installed and jq available, run these commands from your manifest project. scryr inspect schema exports the JSON schemas; jq selects Manifest with its nested definitions. Replace index.scry with your manifest entrypoint.
scryr inspect schema --path index.scry > scryr-schema.jsonjq '.models.Manifest' scryr-schema.json > manifest.schema.jsonmkdir -p generated
npx --yes --package quicktype quicktype \ --src-lang schema --lang c++ --top-level Manifest \ --out generated/manifest.hpp manifest.schema.jsonInclude the generated header in your project and make nlohmann’s json.hpp available on its include path.
Keep the code in sync
Section titled “Keep the code in sync”Regenerate the schema and source files when you update the Scryr SDK. Put these commands in your build tasks so your tools follow the same model definitions as Scryr.