added scalars

This commit is contained in:
2023-01-29 15:19:21 +01:00
parent 0d6e6e57ae
commit e5874141b3
10 changed files with 170 additions and 35 deletions

View File

@@ -1,5 +1,6 @@
use std::sync::Arc;
use genco::{prelude::rust, quote, quote_in};
use graphql_introspection_query::introspection_response::{
FullType, IntrospectionResponse, Schema,
};
@@ -34,8 +35,10 @@ impl CodeGeneration {
}
fn generate_from_schema(&self, schema: &Schema) -> eyre::Result<String> {
let mut output = String::new();
output.push_str("# code generated by dagger. DO NOT EDIT.");
let mut output = rust::Tokens::new();
output.append(quote! {
$(format!("// code generated by dagger. DO NOT EDIT."))
});
let types = get_types(schema)?;
//let remaining: Vec<Option<String>> = types.into_iter().map(type_name).collect();
@@ -44,12 +47,14 @@ impl CodeGeneration {
for t in types {
if let Some(_) = self.type_name(&t) {
let rendered = handler.render(&t)?;
output.push_str(&rendered)
output.push();
output.append(rendered);
}
}
}
Ok(output)
Ok(output.to_string()?)
}
pub fn group_by_handlers(&self, types: &Vec<&FullType>) -> Vec<(DynHandler, Vec<FullType>)> {