Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add a comprehensive dfx json reference #2361

Merged
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-10.15, macos-11, ubuntu-20.04]
os: [macos-11, ubuntu-20.04]
rust: ["1.60.0"]
binary_path: ["target/release"]
steps:
Expand Down Expand Up @@ -63,11 +63,11 @@ jobs:
fail-fast: false
matrix:
backend: ["ic-ref", "replica"]
# macos-latest is currently macos-10.15, ubuntu-latest is currently ubuntu-20.04
# macos-latest is currently macos-11 ubuntu-latest is currently ubuntu-20.04
# ubuntu-18.04 not supported due to:
# /home/runner/.cache/dfinity/versions/0.8.3-34-g36e39809/ic-starter:
# /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found
os: [macos-10.15, macos-11, ubuntu-20.04]
os: [macos-11, ubuntu-20.04]
rust: ["1.60.0"]
steps:
- uses: actions/checkout@v1
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/update-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Update Docs
on:
pull_request:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pull_request:
pull_request

the : is unnecessary here


jobs:
update_dfx_json_schema:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
rust: ["1.60.0"]
os: [ ubuntu-20.04 ]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more of a fyi, cause I'm not 100% certain here (help @adamspofford-dfinity), but I think this step is unnecessary since we have rust-toolchain.toml file - cargo should be able to use the correct version here

to verify, you might want to try rustc --version instead and see if its 1.60.0

run: |
rustup update ${{ matrix.rust }} --no-self-update
rustup component add clippy
rustup default ${{ matrix.rust }}

- name: Check cargo build
run: cargo build
- name: Show download worked
run: cargo run -- --version
- name: Update docs/dfx-json-schema.json
run: |
cargo run -- schema --outfile docs/dfx-json-schema.json
cat docs/dfx-json-schema.json
if ! git diff-index --quiet HEAD; then
git config user.name "GitHub Actions Bot"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add docs/dfx-json-schema.json
git commit -m "update dfx-json-schema"
git push
fi
5 changes: 5 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

== DFX

=== feat: print dfx.json schema

dfx is now capable of displaying the schema for `dfx.json`. You can see the schema by running `dfx schema` or write the schema to a file with `dfx schema --outfile path/to/file/schema.json`.

=== feat: support for configuring assets in assets canister
- The `+.ic-assets.json+` file should be placed inside directory with assets, or its subdirectories. Multiple config files can be used (nested in subdirectories). Example of `.ic-assets.json` file format:
Expand Down Expand Up @@ -98,6 +101,8 @@ After `dfx new <project>`, the canister names are:
- `<project>_backend` (previously `<project>`)
- `<project>_frontend` (previously `<project>_assets`)

=== feat: Enable threshold ecdsa signature

=== feat: new command: dfx canister metadata <canister> <name>

For example, to query a canister's candid service definition: `dfx canister metadata hello_backend candid:service`
Expand Down
42 changes: 42 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/cli-reference/dfx-parent.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ For reference information and examples, select an appropriate subcommand.
| [`new`](dfx-new) | Creates a new project. |
| [`ping`](dfx-ping) | Sends a response request to the IC or the local canister execution environment to determine network connectivity. If the connection is successful, a status reply is returned. |
| [`replica`](dfx-replica) | Starts a local canister execution environment. |
| [`schema`](dfx-schema) | Prints the schema for `dfx.json`. |
| [`start`](dfx-start) | Starts the local canister execution environment a web server for the current project. |
| [`stop`](dfx-stop) | Stops the local canister execution environment. |
| [`upgrade`](dfx-upgrade) | Upgrades the version of `dfx` installed on the local computer to the latest version available. |
Expand Down
40 changes: 40 additions & 0 deletions docs/cli-reference/dfx-schema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# dfx schema

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

## Basic usage

``` bash
dfx schema [option] [flag]
```

## Flags

You can use the following optional flags with the `dfx schema` command.

| Flag | Description |
|-------------------|-------------|
| `-h`, `--help` | Displays usage information. |
| `-V`, `--version` | Displays version information. |

## Options

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

| Option | Description |
|---------------|-------------------------------------------------------------------------------------------------------------------|
| `--outfile <outfile>` | Specifies a file to output the schema to instead of printing it to stdout. |

## Examples

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

``` bash
dfx schema
```

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

``` bash
dfx schema --outfile path/to/file/schema.json
```
2 changes: 2 additions & 0 deletions docs/cli-reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ When you have the SDK installed, you can use the following commands to specify t

- [dfx replica](./dfx-replica.md)

- [dfx schema](./dfx-schema.md)

- [dfx start](./dfx-start.md)

- [dfx stop](./dfx-stop.md)
Expand Down
Loading