Skip to content

Commit

Permalink
chore: base on gql spec
Browse files Browse the repository at this point in the history
  • Loading branch information
amitksingh1490 committed Apr 19, 2024
1 parent abf1000 commit 999ac42
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 23 deletions.
8 changes: 0 additions & 8 deletions src/blueprint/blueprint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,6 @@ impl Type {
Type::ListType { non_null, .. } => *non_null,
}
}

/// checks if the type is a list
pub fn is_list(&self) -> bool {
match self {
Type::NamedType { .. } => false,
Type::ListType { .. } => true,
}
}
}

#[derive(Clone, Debug)]
Expand Down
10 changes: 2 additions & 8 deletions src/blueprint/into_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ fn to_type(def: &Definition) -> dynamic::Type {
let field = field.clone();
let type_ref = to_type_ref(&field.of_type);
let field_name = &field.name.clone();
let is_list = field.of_type.is_list();
let mut dyn_schema_field = dynamic::Field::new(
field_name,
type_ref.clone(),
Expand Down Expand Up @@ -73,13 +72,8 @@ fn to_type(def: &Definition) -> dynamic::Type {
expr.eval(ctx, &Concurrent::Sequential).await?;
let p = match const_value {
ConstValue::List(a) => Some(FieldValue::list(a)),
a => {
if a == ConstValue::Null && is_list {
FieldValue::NONE
} else {
Some(FieldValue::from(a))
}
}
ConstValue::Null => FieldValue::NONE,
a => Some(FieldValue::from(a)),
};
Ok(p)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ expression: response
},
"body": {
"data": {
"user": {
"name": null
}
"user": null
},
"errors": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ expression: response
},
"body": {
"data": {
"hi": {
"name": null,
"id": null
}
"hi": null
}
}
}

0 comments on commit 999ac42

Please sign in to comment.