graphql_schema!() { /* proc-macro */ }Expand description
Write your GraphQL schema directly in your Rust code.
This is mostly useful for testing. Prefer using graphql_schema_from_file for larger
schemas.
§Example
ⓘ
graphql_schema! {
schema {
query: Query
}
type Query {
helloWorld: String! @juniper(ownership: "owned")
}
}
pub struct Query;
impl QueryFields for Query {
fn field_hello_world(
&self,
executor: &Executor<'_, Context>,
) -> FieldResult<String> {
Ok("Hello, World!".to_string())
}
}