dagger-rs/src/schema.rs

26 lines
638 B
Rust
Raw Normal View History

2023-01-28 13:33:30 +01:00
use graphql_introspection_query::introspection_response::IntrospectionResponse;
use crate::{config::Config, engine::Engine, session::Session};
pub fn get_schema() -> eyre::Result<IntrospectionResponse> {
let cfg = Config::new(None, None, None, None);
2023-01-28 13:36:19 +01:00
//TODO: Implement context for proc
2023-01-28 16:19:57 +01:00
let (conn, _proc) = Engine::new().start(&cfg)?;
2023-01-28 13:33:30 +01:00
let session = Session::new();
2023-01-28 20:21:19 +01:00
let req_builder = session.start(&cfg, &conn)?;
2023-01-28 13:33:30 +01:00
let schema = session.schema(req_builder)?;
Ok(schema)
}
#[cfg(test)]
mod tests {
use super::get_schema;
#[test]
fn can_get_schema() {
let _ = get_schema().unwrap();
}
}