Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 3 additions & 1 deletion graphql_client_cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ 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 [OPTIONS] <schema_location>
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 Authorizaiton header.
Expand Down
5 changes: 4 additions & 1 deletion graphql_client_cli/src/introspect_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub fn introspect_schema(
output: Option<PathBuf>,
authorization: Option<String>,
headers: Vec<Header>,
no_ssl: bool,
) -> anyhow::Result<()> {
use std::io::Write;

Expand All @@ -33,7 +34,9 @@ pub fn introspect_schema(
operation_name: introspection_query::OPERATION_NAME,
};

let client = reqwest::Client::new();
let client = reqwest::Client::builder()
.danger_accept_invalid_certs(no_ssl)
.build()?;

let mut req_builder = client.post(location).headers(construct_headers());

Expand Down
13 changes: 12 additions & 1 deletion graphql_client_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ enum Cli {
/// --header 'X-Name: Value'
#[structopt(long = "header")]
headers: Vec<introspect_schema::Header>,
/// Disable ssl verification.
/// Default value is false.
#[structopt(long = "no-ssl")]
no_ssl: bool,
},
#[structopt(name = "generate")]
Generate {
Expand Down Expand Up @@ -79,7 +83,14 @@ fn main() -> anyhow::Result<()> {
output,
authorization,
headers,
} => introspect_schema::introspect_schema(&schema_location, output, authorization, headers),
no_ssl,
} => introspect_schema::introspect_schema(
&schema_location,
output,
authorization,
headers,
no_ssl,
),
Cli::Generate {
variables_derives,
response_derives,
Expand Down