Dfx.json schema is finally available!

The much-requested dfx.json schema is finally available! You can find it in the documentation right here.

Starting with dfx 0.11.1, the dfx schema command will be available, which will display the schema for the currently active version of dfx. With the --outfile path/to/file.json flag, it will be possible to output the schema directly to a file.

Of course, the first iteration of the schema will not be perfect. Open topics:

  • Schema improvements. The schema gets auto-generated from our config types (mostly located in this file). Changes to the schema should go through the SDK repo in the mentioned file if you’re willing to do a PR yourself, or through this thread so that I can make the P. The portal repo (where the docs themselves are located at) has no influence over the schema.
  • Publication of the schema. There are ways to publish common schemas, e.g. through schemastore. I will be able to figure out the common places myself, but if someone already knows the best places to publish such a schema, please let me know.

In relation to this schema. Is there a comprehensive documentation for dfx.json? I can find documentation for all dfx command and subcommands but that does not replace documentation for dfx.json itself. Going by the schema and the doc strings in there it looks like there are many interesting things one can do with dfx.json if only one understood them or saw an example.

We don’t really have something nicer at the moment. I tried my best to improve the doc strings, but it’s still not the best. Another sometimes-nice way to figure out what to do with some options is to look at the changelog. In there we have some use cases covered most of the time. Also, if you feel something’s under documented, I’d love to approve a PR :smile: