#graphql #graphql-schema

codegen-for-async-graphql-renderer

Internal code generation crate for async-graphql

3 releases

0.2.6 Jul 9, 2020
0.2.5 Jul 9, 2020
0.2.1 Jul 6, 2020
0.2.0 Jul 6, 2020
0.1.0 Jul 6, 2020

#22 in #async-graphql


Used in codegen-for-async-graphql

MIT license

59KB
2K SLoC

codegen-for-async-graphql

codecov

Usage

cargo codegen-for-async-graphql --schema {path_to_schema} --output {path_to_output}
# cargo codegen-for-async-graphql --schema ./schema.graphql --output src/models
mod models;

use async_graphql::*;

use models::{
  Mutation, Query,
};

let data_source = DataSource {};
let schema = Schema::build(Query {}, Mutation {}, EmptySubscription)
    .register_type::<User>()
    .data(data_source)
    .finish();
let res = schema.execute(query).await;
let json = serde_json::to_string_pretty(&async_graphql::http::GQLResponse(res));
json.unwrap()

Dependencies

~20–32MB
~572K SLoC