Fix playground loading.
@@ -40,8 +40,7 @@ impl<'a> ObjectTypeBuilder<'a> {
}
pub fn map_model_object_type(&self, model: &ModelRef) -> ObjectTypeRef {
- self
- .get_cache()
+ self.get_cache()
.get(&model.name)
.expect("Invariant violation: Initialized object type skeleton for each model.")
}
@@ -49,8 +48,7 @@ impl<'a> ObjectTypeBuilder<'a> {
/// Initializes model object type cache on the query schema builder.
fn compute_model_object_types(self) -> Self {
// Compute initial cache.
- self
- .internal_data_model
+ self.internal_data_model
.models()
.iter()
.for_each(|m| self.cache(m.name.clone(), Arc::new(init_object_type(m.name.clone()))));
@@ -130,7 +128,9 @@ impl<'a> ObjectTypeBuilder<'a> {
match field {
f if !f.is_visible() => vec![],
ModelField::Scalar(_) => vec![],
- ModelField::Relation(rf) if rf.is_list && !rf.related_model().is_embedded => self.many_records_arguments(model),
+ ModelField::Relation(rf) if rf.is_list && !rf.related_model().is_embedded => {
+ self.many_records_arguments(model)
+ }
ModelField::Relation(rf) if rf.is_list && rf.related_model().is_embedded => vec![],
ModelField::Relation(rf) if !rf.is_list => vec![],
_ => unreachable!(),
@@ -192,10 +192,9 @@ impl<'a> ObjectTypeBuilder<'a> {
pub fn map_enum_field(scalar_field: &Arc<ScalarField>) -> EnumType {
match scalar_field.type_identifier {
TypeIdentifier::Enum => {
- let internal_enum = scalar_field
- .internal_enum
- .as_ref()
- .expect("Invariant violation: Enum fields are expected to have an internal_enum associated with them.");
+ let internal_enum = scalar_field.internal_enum.as_ref().expect(
+ "Invariant violation: Enum fields are expected to have an internal_enum associated with them.",
+ );
internal_enum.into()
}
@@ -206,7 +205,10 @@ impl<'a> ObjectTypeBuilder<'a> {
pub fn batch_payload_object_type(&self) -> ObjectTypeRef {
return_cached!(self.get_cache(), "BatchPayload");
- let object_type = Arc::new(object_type("BatchPayload", vec![]));
+ let object_type = Arc::new(object_type(
+ "BatchPayload",
+ vec![field("count", vec![], OutputType::int())],
+ ));
self.cache("BatchPayload".into(), Arc::clone(&object_type));
Arc::downgrade(&object_type)
