Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/atsuhiro/codegen-for-async-graphql
Generate code from GraphQL schema
https://github.com/atsuhiro/codegen-for-async-graphql
async-graphql graphql rust scaffolding
Last synced: 2 months ago
JSON representation
Generate code from GraphQL schema
- Host: GitHub
- URL: https://github.com/atsuhiro/codegen-for-async-graphql
- Owner: atsuhiro
- License: mit
- Archived: true
- Created: 2020-06-17T16:17:59.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-04-25T08:42:12.000Z (over 2 years ago)
- Last Synced: 2024-11-06T20:21:11.997Z (2 months ago)
- Topics: async-graphql, graphql, rust, scaffolding
- Language: Rust
- Homepage:
- Size: 244 KB
- Stars: 30
- Watchers: 3
- Forks: 15
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-list - codegen-for-async-graphql
README
# codegen-for-async-graphql
[![codecov](https://codecov.io/gh/atsuhiro/codegen-for-async-graphql/branch/master/graph/badge.svg)](https://codecov.io/gh/atsuhiro/codegen-for-async-graphql)
## Usage
```bash
cargo codegen-for-async-graphql --schema {path_to_schema} --output {path_to_output}
# cargo codegen-for-async-graphql --schema ./schema.graphql --output src/models
``````rust
mod models;use async_graphql::*;
use models::{
Mutation, Query,
};let data_source = DataSource {};
let schema = Schema::build(Query {}, Mutation {}, EmptySubscription)
.register_type::()
.data(data_source)
.finish();
let res = schema.execute(query).await;
let json = serde_json::to_string_pretty(&async_graphql::http::GQLResponse(res));
json.unwrap()
```