Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

JSON Schemas

The following JSON Schema files describe the structure of each JSON input file in a Cobre case directory. Download them and point your editor’s JSON Schema validation setting at the appropriate file to get autocompletion, hover documentation, and inline error highlighting while authoring case inputs.

For a complete description of each file’s fields and validation rules, see the Case Directory Format reference page.

Available schemas

Schema fileInput fileDescription
config.schema.jsonconfig.jsonStudy configuration: training parameters, stopping rules, cut selection, simulation settings, and export flags
penalties.schema.jsonpenalties.jsonGlobal penalty cost defaults for bus deficit, line exchange, hydro violations, and non-controllable source curtailment
stages.schema.jsonstages.jsonTemporal structure of the study: stage sequence, load blocks, policy graph horizon, and scenario source configuration
buses.schema.jsonsystem/buses.jsonElectrical bus registry: bus identifiers, names, and optional entity-level deficit cost tiers
lines.schema.jsonsystem/lines.jsonTransmission line registry: line identifiers, source/target buses, and directional MW capacity bounds
hydros.schema.jsonsystem/hydros.jsonHydro plant registry: reservoir bounds, outflow limits, generation model parameters, and cascade linkage
thermals.schema.jsonsystem/thermals.jsonThermal plant registry: generation bounds and linear cost coefficients
energy_contracts.schema.jsonsystem/energy_contracts.jsonBilateral energy contract registry (optional entities)
non_controllable_sources.schema.jsonsystem/non_controllable_sources.jsonIntermittent (non-dispatchable) generation source registry (optional entities)
pumping_stations.schema.jsonsystem/pumping_stations.jsonPumping station registry (optional entities)

Using schemas in your editor

VS Code

Add a json.schemas entry to your workspace .vscode/settings.json:

{
  "json.schemas": [
    {
      "fileMatch": ["config.json"],
      "url": "https://cobre.dev/schemas/v2/config.schema.json"
    },
    {
      "fileMatch": ["system/hydros.json"],
      "url": "https://cobre.dev/schemas/v2/hydros.schema.json"
    }
  ]
}

Alternatively, add a $schema key directly inside each JSON file:

{
  "$schema": "https://cobre.dev/schemas/v2/config.schema.json",
  "training": {
    "forward_passes": 192,
    "stopping_rules": [{ "type": "iteration_limit", "limit": 200 }]
  }
}

Neovim (via jsonls)

Configure json.schemas in your nvim-lspconfig setup for jsonls following the same URL pattern shown above.

JetBrains IDEs

Go to Preferences > Languages & Frameworks > Schemas and DTDs > JSON Schema Mappings, add a new mapping, paste the schema URL, and select the file pattern.

Regenerating schemas

The schema files in book/src/schemas/ are generated from the Rust type definitions in cobre-io. To regenerate them after modifying the input types, run:

cargo run -p cobre-cli -- schema export --output-dir book/src/schemas/