#graphql #cli #client

app graphql_client_cli

The CLI for graphql-client

9 releases (breaking)

✓ Uses Rust 2018 edition

0.8.0 May 24, 2019
0.7.0 Mar 21, 2019
0.6.1 Jan 19, 2019
0.6.0 Dec 30, 2018
0.1.0 Jul 4, 2018
Download history 6/week @ 2019-11-09 33/week @ 2019-11-16 15/week @ 2019-11-23 24/week @ 2019-11-30 40/week @ 2019-12-07 84/week @ 2019-12-14 4/week @ 2019-12-21 11/week @ 2019-12-28 2/week @ 2020-01-04 119/week @ 2020-01-11 61/week @ 2020-01-18 5/week @ 2020-01-25 5/week @ 2020-02-01 16/week @ 2020-02-08 10/week @ 2020-02-15

111 downloads per month

Apache-2.0 OR MIT

11K SLoC

GraphQL 6.5K SLoC // 0.0% comments Rust 4K SLoC // 0.1% comments

GraphQL client CLI

This is still a WIP, the main use for it now is to download the schema.json from a GraphQL endpoint, which you can also do with apollo-codegen.


cargo install graphql_client_cli --force

introspect schema

Get the schema from a live GraphQL API. The schema is printed to stdout.

    graphql-client introspect-schema [OPTIONS] <schema_location>

    -h, --help       Prints help information
    -V, --version    Prints version information

        --authorization <authorization>    Set the contents of the Authorizaiton header.
        --header <headers>...              Specify custom headers. --header 'X-Name: Value'
        --output <output>                  Where to write the JSON for the introspected schema.

    <schema_location>    The URL of a GraphQL endpoint to introspect.

generate client code

    graphql-client generate [FLAGS] [OPTIONS] <query_path> <schema_path>

    -h, --help             Prints help information
        --no-formatting    If you don't want to execute rustfmt to generated code, set this option. Default value is
                           false. Formating feature is disabled as default installation.
    -V, --version          Prints version information

    -a, --additional-derives <additional_derives>
            Additional derives that will be added to the generated structs and enums for the response and the variables.
    -d, --deprecation-strategy <deprecation_strategy>
            You can choose deprecation strategy from allow, deny, or warn. Default value is warn.

    -m, --module_visibility <module_visibility>
            You can choose module and target struct visibility from pub and private. Default value is pub.

    -o, --selected-operation <selected_operation>
            Name of target query. If you don't set this parameter, cli generate all queries in query file.

    <query_path>     Path to graphql query file.
    <schema_path>    Path to graphql schema file.

If you want to use formatting feature, you should install like this.

cargo install graphql_client_cli --features rustfmt --force


~463K SLoC