12个重大版本发布

0.14.0 2024年3月26日
0.13.0 2023年5月30日
0.12.0 2023年1月12日
0.11.0 2022年6月21日
0.2.0 2018年7月22日

#1 in #introspect

Download history 112/week @ 2024-04-26 192/week @ 2024-05-03 345/week @ 2024-05-10 426/week @ 2024-05-17 330/week @ 2024-05-24 435/week @ 2024-05-31 426/week @ 2024-06-07 342/week @ 2024-06-14 337/week @ 2024-06-21 226/week @ 2024-06-28 236/week @ 2024-07-05 243/week @ 2024-07-12 309/week @ 2024-07-19 402/week @ 2024-07-26 414/week @ 2024-08-02 403/week @ 2024-08-09

1,570 每月下载量

Apache-2.0 OR MIT

445KB
11K SLoC

GraphQL 6.5K SLoC // 0.0% comments Rust 4.5K SLoC // 0.0% comments

GraphQL客户端CLI

这还是一个工作进展中的项目,目前其主要用途是从GraphQL端点下载schema.json,你也可以使用Apollo CLI来完成。

安装

cargo install graphql_client_cli --force

检查模式

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

USAGE:
    graphql-client introspect-schema [FLAGS] [OPTIONS] <schema_location>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information
        --no-ssl     Set this option to disable ssl certificate verification. Default value is false.
                     ssl verification is turned on by default.

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

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

生成客户端代码

USAGE:
    graphql-client generate [FLAGS] [OPTIONS] <query_path> --schema-path <schema_path>

FLAGS:
    -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.
    -V, --version          Prints version information

OPTIONS:
    -I, --variables-derives <variables_derives>
            Additional derives that will be added to the generated structs and enums for the variables.
            --variables-derives='Serialize,PartialEq'
    -O, --response-derives <response_derives>
            Additional derives that will be added to the generated structs and enums for the response.
            --response-derives='Serialize,PartialEq'            
    -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, --output-directory <output_directory>            The directory in which the code will be generated
    -s, --schema-path <schema_path>                      Path to GraphQL schema file (.json or .graphql).
    -o, --selected-operation <selected_operation>
            Name of target query. If you don't set this parameter, cli generate all queries in query file.
	--fragments-other-variant
            Generate an Unknown variant for enums generated by fragments.


ARGS:
    <query_path>    Path to the GraphQL query file.

如果你想使用格式化功能,应该按以下方式安装。

cargo install graphql_client_cli

依赖

~8–22MB
~333K SLoC