Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logEntity function #405

Merged
merged 6 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ run_script = "0.9"
regex = "1.5.4"
serde_yaml = "0.8.21"
graphql-parser = "0.4.0"
serde = "1.0.139"

[dev-dependencies]
serial_test = "0.5.1"
15 changes: 7 additions & 8 deletions src/context/derived_schema.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
use std::collections::HashMap;

use graph::data::graphql::ext::DirectiveFinder;
use graph_graphql::graphql_parser::schema;

use crate::context::{MatchstickInstanceContext, SCHEMA};
use crate::context::MatchstickInstanceContext;

pub(crate) fn derive_schema<C: graph::blockchain::Blockchain>(
context: &mut MatchstickInstanceContext<C>,
) {
SCHEMA.definitions.iter().for_each(|def| {
if let schema::Definition::TypeDefinition(schema::TypeDefinition::Object(o)) = def {
let entity_type = &o.name;
let derived_fields = o.fields.iter().filter(|&f| f.is_derived());
context
.schema
.iter()
.for_each(|(entity_type, entity_object)| {
let derived_fields = entity_object.fields.iter().filter(|&f| f.is_derived());
for virtual_field in derived_fields {
// field type is received as: '[ExampleClass!]!' and needs to be reduced to a class string
let derived_from_entity_type = virtual_field
Expand Down Expand Up @@ -49,6 +49,5 @@ pub(crate) fn derive_schema<C: graph::blockchain::Blockchain>(
.insert(entity_type.to_string(), entity_virtual_fields);
}
}
}
});
});
}
Loading