Macro juniper_from_schema::graphql_schema
source · 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 {
"#[ownership(owned)]"
helloWorld: String!
}
}
pub struct Query;
impl QueryFields for Query {
fn field_hello_world(
&self,
executor: &Executor<'_, Context>,
) -> FieldResult<String> {
Ok("Hello, World!".to_string())
}
}