gtopt/json_schema.hpp file

JSON Schema dump for the gtopt input data model.

Provides a single diagnostic entry point that renders a JSON Schema (draft 2020-12) for the gtopt input data model directly from the daw_json_link json_data_contract mappings. No input file is needed — the schema is generated purely from the compile-time type descriptions, mirroring the --list-dialects "dump-and-exit" diagnostic.

CLI integration

Invoked by the --json-schema flag of the gtopt binary:

  • gtopt --json-schema dumps the full Planning input scheme (options, simulation, system and every element type).
  • gtopt --json-schema options only PlanningOptions.
  • gtopt --json-schema gas_pipe any contract type by its snake_case name (or its C++ name, case-insensitive).

The output holds one $defs entry per contract type reachable from the selected root (properties in contract order, required = the non-nullable members, additionalProperties: false) and $ref links between them; field schedules render as oneOf of a scalar, nested arrays and a file-name string. scripts/gtopt_shared's contract snapshot and the igtopt template generator consume it.

Namespaces

namespace gtopt