JSON / YAML Code Generation
Serialize constant values to JSON or YAML.
Synopsis
paradox generate --json <CONSTANT> [--out FILEPATH] [--path PATH]
paradox generate --yaml <CONSTANT> [--out FILEPATH] [--path PATH]
Description
Unlike other code generation targets, --json and --yaml serialize a specific named constant rather than generating type definitions. The constant must be a fully-evaluated value (not a function).
Examples
Given:
config: Config
Config:
host: "localhost"
port: 8080
debug: true
Generate JSON:
paradox generate --json config --path .
Output:
{
"host": "localhost",
"port": 8080,
"debug": true
}
Generate YAML:
paradox generate --yaml config --path .
Output:
host: localhost
port: 8080
debug: true
Write YAML to a file:
paradox generate --yaml config --out config.yaml --path .
Options
<CONSTANT>-
The name of the constant to serialize (required).
--out FILEPATH-
Write output to a file instead of stdout.
--path PATH-
Directory containing
.doxsource files.