Skip to content

Commit

Permalink
support graphqls schema extension (#480)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsetso-spread authored Mar 20, 2024
1 parent ef53897 commit 5163824
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions graphql_client_codegen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ fn get_set_schema_from_file(schema_path: &std::path::Path) -> Schema {
.unwrap_or("<no extension>");
let schema_string = read_file(schema_path).unwrap();
match schema_extension {
"graphql" | "gql" => {
"graphql" | "graphqls"| "gql" => {
let s = graphql_parser::schema::parse_schema::<&str>(&schema_string).map_err(|parser_error| GeneralError(format!("Parser error: {}", parser_error))).unwrap();
Schema::from(s)
}
"json" => {
let parsed: graphql_introspection_query::introspection_response::IntrospectionResponse = serde_json::from_str(&schema_string).unwrap();
Schema::from(parsed)
}
extension => panic!("Unsupported extension for the GraphQL schema: {} (only .json and .graphql are supported)", extension)
extension => panic!("Unsupported extension for the GraphQL schema: {} (only .json, .graphql, .graphqls and .gql are supported)", extension)
}
})
}
Expand Down

0 comments on commit 5163824

Please sign in to comment.