Skip to main content

dfx schema

Reference

The dfx schema command prints the schema for dfx.json.

Basic usage

dfx schema [option] [flag]

Options

You can use the following option with the dfx schema command.

OptionDescription
--for <which>Display schema for which JSON file. (default: dfx)
--outfile <outfile>Specifies a file to output the schema to instead of printing it to stdout.

The parameter passed to --for can be one of the following:

<for> optionCorresponds To
dfxdfx.json
networksnetworks.json
dfx-metadatadfx-related metadata stored in canister and accessible with dfx canister metadata <canister> dfx
extension-manifestextension.json example
extension-dependenciesdependencies.json example

Examples

You can print the schema for dfx.json by running the following command:

dfx schema

You can print the schema for networks.json by running the following command:

dfx schema --for networks

You can print the schema for the "dfx" metadata JSON (which contains fields such as "pullable", "tech_stack", etc) by running the following command:

dfx schema --for dfx-metadata

If you want to write the schema for dfx.json to path/to/file/schema.json, you can do so by running the following command:

dfx schema --outfile path/to/file/schema.json