async-graphql/docs/en/src/sdl_export.md

24 lines
439 B
Markdown
Raw Normal View History

2021-04-03 09:41:37 +00:00
# SDL Export
You can export your schema in Schema Definition Language (SDL) by using the `Schema::sdl()` method.
```rust
# extern crate async_graphql;
2021-04-03 09:41:37 +00:00
use async_graphql::*;
struct Query;
#[Object]
impl Query {
async fn add(&self, u: i32, v: i32) -> i32 {
u + v
}
}
let schema = Schema::build(Query, EmptyMutation, EmptySubscription).finish();
2021-04-03 09:41:37 +00:00
// Print the schema in SDL format
println!("{}", &schema.sdl());
2021-04-03 09:41:37 +00:00
```