-
Notifications
You must be signed in to change notification settings - Fork 67
Add library with storage integration to replace graphql-lib
#1309
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Wow, obviously a ton of good work here thanks so much for this 🥲 🥇
- Left some comments (obviously no way I can possibly digest the entire 33K line change 😆 )
- And again, obviously none of this feedback has to be addressed before merging into the feature branch
- But some of it will have to be addressed before merging into develop
Float, | ||
Boolean, | ||
List(Box<DynDataTypeId>), | ||
// Option(Box<DynDataTypeId>), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dead code?
Float, | ||
Boolean, | ||
List(Box<DynDataType>), | ||
// Option(Box<DynDataTypeId>), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dead code?
"Int" => Ok(Self::Int), | ||
"Float" => Ok(Self::Float), | ||
"Boolean" => Ok(Self::Boolean), | ||
// List(Box<DynDataTypeId>), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dead code?
Self::Int => write!(f, "Int"), | ||
Self::Float => write!(f, "Float"), | ||
Self::List(ty) => write!(f, "[{}]", ty), | ||
// Self::Option(ty) => write!(f, "{}", ty), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dead code?
Self::Int => Name::new_pascal("Int"), | ||
Self::Float => Name::new_pascal("Float"), | ||
Self::List(ty) => Name::new_pascal(format!("[{}]", ty.name())), | ||
// Self::Option(ty) => Name::new_pascal(&format!("{}!", ty)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dead code?
.or_insert(DynDataTypeBuilder::Object(DynObjectTypeBuilder::new(name))) | ||
{ | ||
DynDataTypeBuilder::Object(builder) => builder, | ||
_ => unreachable!(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add a message to unreachable!
that explains why this is unreachable? (In case the path gets hit) - or at least a comment
|
||
impl Data { | ||
pub fn r#type(&self) -> &DataTypeId { | ||
todo!() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this pending anything in particular?
.iter_mut() | ||
.find(|(_, data)| data.name() == name) | ||
.map(|(id, data)| (id.clone(), data)) | ||
.unwrap_or_else(|| panic!("Data not found: {}", name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway we can fail gracefully here with Result
rather than panic
? (similar thoughts for the rest of the panic
in this module)
@@ -0,0 +1,127 @@ | |||
--- | |||
source: packages/fuel-indexer-graphql-dyn/src/testing/schema.rs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lovely 👌🏽
use insta::*; | ||
|
||
#[tokio::test] | ||
async fn test() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
@ra0x3 thanks for having a look! Most (if not all) unpolished parts are pending a discussion as you've guessed and it is about In We should discuss and decide what types we should have. We already have an When we finalize |
@AlicanC Gonna merge this so I can put up my PR on Monday - feel free to revert if you want :) |
fuel-indexer-graphql-dyn
GraphQL Dyn is a library for building executable dynamic GraphQL schemas.
Dyn has two main parts: the
store::Store
and theschema::DynSchemaBuilder
. The schema builder is responsible for creating executableasync_graphql_dynamic::dynamic::Schema
instances from a dynamically definedschema::DynSchemaType
. Built schema executes GraphQL queries by fetching data from the store. The store is responsible for communicating with the underlying data source.Usage
Users of Dyn will need three things to get started:
With these implemented, you can create a dynamic schema and execute queries: