From b6f6d48027f3c530a5ac3b7dbaf376a1de2b7353 Mon Sep 17 00:00:00 2001 From: Daniel Harvey Date: Tue, 26 Mar 2024 08:54:34 +0000 Subject: [PATCH] better name for `resolve_data_connector_type_mappings` in metadata resolver (#401) ## Description Addressing https://github.com/hasura/v3-engine/pull/398#discussion_r1538623981 V3_GIT_ORIGIN_REV_ID: 8f9c4f95fd2c57246693168c901640872b479741 --- v3/crates/engine/src/metadata/resolved/metadata.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/v3/crates/engine/src/metadata/resolved/metadata.rs b/v3/crates/engine/src/metadata/resolved/metadata.rs index d7338171397..5c3507e96fe 100644 --- a/v3/crates/engine/src/metadata/resolved/metadata.rs +++ b/v3/crates/engine/src/metadata/resolved/metadata.rs @@ -126,7 +126,8 @@ pub fn resolve_metadata(metadata: open_dds::Metadata) -> Result > = HashMap::new(); // resolve object types - let data_connector_type_mappings = resolve_data_connector_type_mappings( + // TODO: make this return more values rather than blindly mutating it's inputs + let data_connector_type_mappings = resolve_data_connector_type_mappings_and_objects( &metadata_accessor, &data_connectors, &mut types, @@ -297,8 +298,10 @@ fn resolve_data_connectors( Ok(data_connectors) } -/// resolve object types -fn resolve_data_connector_type_mappings( +/// resolve object types, matching them to that in the data connectors +/// this currently works by mutating `types` and `existing_graphql_types`, we should try +/// and change this to return new values here and make the caller combine them together +fn resolve_data_connector_type_mappings_and_objects( metadata_accessor: &open_dds::accessor::MetadataAccessor, data_connectors: &HashMap, DataConnectorContext>, types: &mut HashMap, TypeRepresentation>, @@ -318,6 +321,7 @@ fn resolve_data_connector_type_mappings( { let qualified_object_type_name = Qualified::new(subgraph.to_string(), object_type_definition.name.clone()); + let mut resolved_type = resolve_object_type( object_type_definition, existing_graphql_types,