# Dfx.json schema is finally available!

**URL:** <https://forum.dfinity.org/t/dfx-json-schema-is-finally-available/14668>\
**Category:** Command Line Tools\
**Created:** [August 3, 2022, 9:12am UTC](https://forum.dfinity.org/t/dfx-json-schema-is-finally-available/14668 "2022-08-03T09:12:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [August 3, 2022, 9:12am UTC](https://forum.dfinity.org/t/dfx-json-schema-is-finally-available/14668/1 "2022-08-03T09:12:37Z")

</div>

The much-requested dfx.json schema is finally available! You can find it in the documentation [right here](https://internetcomputer.org/docs/current/references/dfx-json-reference).

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](https://github.com/dfinity/sdk/blob/master/src/dfx/src/config/dfinity.rs)). 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](https://github.com/dfinity/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](https://www.schemastore.org/json/). 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.

---

<div class="post-metadata">

**Author:** ![timo](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/timo/32/5543_2.png) [@timo](https://forum.dfinity.org/u/timo)\
**Post date:** [November 12, 2022, 7:11am UTC](https://forum.dfinity.org/t/dfx-json-schema-is-finally-available/14668/2 "2022-11-12T07:11:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [November 14, 2022, 8:45am UTC](https://forum.dfinity.org/t/dfx-json-schema-is-finally-available/14668/3 "2022-11-14T08:45:31Z")

</div>

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 😄

---

<div class="post-metadata">

**Author:** ![timo](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/timo/32/5543_2.png) [@timo](https://forum.dfinity.org/u/timo)\
**Post date:** [February 14, 2023, 11:21am UTC](https://forum.dfinity.org/t/dfx-json-schema-is-finally-available/14668/4 "2023-02-14T11:21:09Z")

</div>

Wasn’t there a way to specify the compiler version to use for moc inside dfx.json? I can’t find it.

Or is it fixed such that a given version of dfx uses one and only one moc version? Which means I would have to move a different binary to the path `~/.cache/dfinity/versions/<dfx version>/moc` to change it.

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [February 21, 2023, 9:17am UTC](https://forum.dfinity.org/t/dfx-json-schema-is-finally-available/14668/5 "2023-02-21T09:17:57Z")

</div>

In dfx.json you can only add arguments to a canister’s compilation. I think the field is called `"args"` and should work in any canister of type `motoko`.

To use a different compiler version with dfx, set the env var `DFX_MOC_PATH` to point to your other `moc`. I’ll make a PR to add this to the [dfx env var docs](https://internetcomputer.org/docs/current/references/cli-reference/dfx-envars).
