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
|
2022-06-02 21:32:12 +00:00
|
|
|
# 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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-02 21:32:12 +00:00
|
|
|
let schema = Schema::build(Query, EmptyMutation, EmptySubscription).finish();
|
2021-04-03 09:41:37 +00:00
|
|
|
|
2022-06-02 21:32:12 +00:00
|
|
|
// Print the schema in SDL format
|
|
|
|
println!("{}", &schema.sdl());
|
2021-04-03 09:41:37 +00:00
|
|
|
```
|