From 4aefdabb65d547c9906cb2b4da7c99ca791fcc8f Mon Sep 17 00:00:00 2001 From: Vamshi Surabhi <0x777@users.noreply.github.com> Date: Mon, 5 Aug 2024 14:59:43 -0700 Subject: [PATCH] avoid using raw `String`s in more places (#923) - `DataConnectorAggregationFunctionName` and `AggregateFunctionName` now use `str_newtype`. - All usages of `String`s for subgraph names are removed. (This is part of a larger effort to remove references in `execute::plan::QueryPlan`). V3_GIT_ORIGIN_REV_ID: d51f0a2335e8dabbc9efdad1d1efff285ddb74c3 --- v3/crates/execute/src/plan/ndc_request/v01.rs | 2 +- v3/crates/execute/src/plan/ndc_request/v02.rs | 2 +- v3/crates/ir/src/model_tracking.rs | 64 ++-- .../metadata-resolve/src/helpers/argument.rs | 12 +- .../src/stages/aggregates/mod.rs | 20 +- .../src/stages/aggregates/types.rs | 2 +- .../src/stages/boolean_expressions/graphql.rs | 2 +- .../src/stages/boolean_expressions/helpers.rs | 2 +- .../src/stages/boolean_expressions/mod.rs | 2 +- .../src/stages/boolean_expressions/object.rs | 17 +- .../command_permissions/command_permission.rs | 3 +- .../src/stages/command_permissions/mod.rs | 2 +- .../src/stages/commands/command.rs | 10 +- .../src/stages/commands/mod.rs | 2 +- .../src/stages/commands/source.rs | 10 +- .../stages/data_connector_scalar_types/mod.rs | 7 +- .../src/stages/data_connectors/mod.rs | 2 +- .../src/stages/model_permissions/mod.rs | 2 +- .../model_permissions/model_permission.rs | 5 +- .../metadata-resolve/src/stages/models/mod.rs | 14 +- .../src/stages/models/source.rs | 9 +- .../src/stages/models_graphql/graphql.rs | 2 +- .../object_boolean_expressions/helpers.rs | 3 +- .../stages/object_boolean_expressions/mod.rs | 16 +- .../src/stages/object_types/mod.rs | 13 +- .../src/stages/relationships/mod.rs | 35 ++- .../stages/scalar_boolean_expressions/mod.rs | 2 +- .../scalar_boolean_expressions/scalar.rs | 5 +- .../src/stages/scalar_types/mod.rs | 3 +- .../src/stages/type_permissions/mod.rs | 6 +- .../metadata-resolve/src/types/subgraph.rs | 22 +- .../relationship/resolved.snap | 296 +++++++++++++----- .../root_field/resolved.snap | 172 +++++++--- .../basic/resolved.snap | 68 +++- .../nested_object/resolved.snap | 156 ++++++--- .../no_graphql/resolved.snap | 44 ++- .../range/resolved.snap | 156 ++++++--- .../two_data_sources/resolved.snap | 52 ++- .../resolved.snap | 18 +- .../resolved.snap | 24 +- .../resolved.snap | 18 +- .../resolved.snap | 24 +- .../resolved.snap | 4 +- .../resolved.snap | 32 +- .../resolved.snap | 36 ++- .../resolved.snap | 44 ++- v3/crates/open-dds/metadata.jsonschema | 6 +- v3/crates/open-dds/src/accessor.rs | 22 +- v3/crates/open-dds/src/aggregates.rs | 38 +-- v3/crates/open-dds/src/identifier.rs | 136 +++++--- v3/crates/open-dds/src/lib.rs | 2 +- v3/crates/open-dds/src/query.rs | 6 +- v3/crates/open-dds/src/relationships.rs | 14 +- .../query_usage_analytics.jsonschema | 10 +- v3/crates/query-usage-analytics/src/lib.rs | 33 +- v3/crates/schema/src/aggregates.rs | 2 +- v3/crates/sql/src/catalog.rs | 2 +- v3/crates/sql/src/catalog/introspection.rs | 8 +- v3/crates/sql/src/catalog/model.rs | 2 +- 59 files changed, 1170 insertions(+), 553 deletions(-) diff --git a/v3/crates/execute/src/plan/ndc_request/v01.rs b/v3/crates/execute/src/plan/ndc_request/v01.rs index 55a324e9dfd..37becaac22a 100644 --- a/v3/crates/execute/src/plan/ndc_request/v01.rs +++ b/v3/crates/execute/src/plan/ndc_request/v01.rs @@ -508,7 +508,7 @@ fn make_aggregates( Some(nested_field_path) }, function: ndc_models_v01::AggregateFunctionName::from( - function_name.0.as_str(), + function_name.as_str(), ), } } diff --git a/v3/crates/execute/src/plan/ndc_request/v02.rs b/v3/crates/execute/src/plan/ndc_request/v02.rs index dec02941898..2beba85ae22 100644 --- a/v3/crates/execute/src/plan/ndc_request/v02.rs +++ b/v3/crates/execute/src/plan/ndc_request/v02.rs @@ -511,7 +511,7 @@ fn make_aggregates( Some(nested_field_path) }, function: ndc_models_v02::AggregateFunctionName::from( - function_name.0.as_str(), + function_name.as_str(), ), } } diff --git a/v3/crates/ir/src/model_tracking.rs b/v3/crates/ir/src/model_tracking.rs index 2c9fe2ba1cd..7e4d3a69816 100644 --- a/v3/crates/ir/src/model_tracking.rs +++ b/v3/crates/ir/src/model_tracking.rs @@ -186,48 +186,48 @@ mod tests { count_command, count_model, extend_usage_count, CommandCount, ModelCount, UsagesCounts, }; use metadata_resolve::Qualified; - use open_dds::{commands::CommandName, identifier, models::ModelName}; + use open_dds::{commands::CommandName, identifier, models::ModelName, subgraph_identifier}; #[test] fn test_extend_usage_count() { let model_count1 = ModelCount { model: Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), ModelName::new(identifier!("model1")), ), count: 1, }; let model_count2 = ModelCount { model: Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), ModelName::new(identifier!("model2")), ), count: 5, }; let model_count3 = ModelCount { model: Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), ModelName::new(identifier!("model3")), ), count: 2, }; let command_count1 = CommandCount { command: Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), CommandName::new(identifier!("command1")), ), count: 2, }; let command_count2 = CommandCount { command: Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), CommandName::new(identifier!("command2")), ), count: 1, }; let command_count3 = CommandCount { command: Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), CommandName::new(identifier!("command3")), ), count: 3, @@ -245,21 +245,21 @@ mod tests { models_used: vec![ ModelCount { model: Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), ModelName::new(identifier!("model2")), ), count: 10, }, ModelCount { model: Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), ModelName::new(identifier!("model3")), ), count: 2, }, ModelCount { model: Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), ModelName::new(identifier!("model1")), ), count: 1, @@ -268,21 +268,21 @@ mod tests { commands_used: vec![ CommandCount { command: Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), CommandName::new(identifier!("command2")), ), count: 2, }, CommandCount { command: Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), CommandName::new(identifier!("command3")), ), count: 3, }, CommandCount { command: Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), CommandName::new(identifier!("command1")), ), count: 2, @@ -297,7 +297,7 @@ mod tests { let mut aggregator = UsagesCounts::new(); count_command( &Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), CommandName::new(identifier!("command1")), ), &mut aggregator, @@ -308,7 +308,7 @@ mod tests { models_used: Vec::new(), commands_used: vec![CommandCount { command: Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), CommandName::new(identifier!("command1")) ), count: 1, @@ -317,7 +317,7 @@ mod tests { ); count_command( &Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), CommandName::new(identifier!("command1")), ), &mut aggregator, @@ -328,7 +328,7 @@ mod tests { models_used: Vec::new(), commands_used: vec![CommandCount { command: Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), CommandName::new(identifier!("command1")) ), count: 2, @@ -337,7 +337,7 @@ mod tests { ); count_model( &Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), ModelName::new(identifier!("model1")), ), &mut aggregator, @@ -347,14 +347,14 @@ mod tests { UsagesCounts { models_used: vec![ModelCount { model: Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), ModelName::new(identifier!("model1")) ), count: 1, }], commands_used: vec![CommandCount { command: Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), CommandName::new(identifier!("command1")) ), count: 2, @@ -363,7 +363,7 @@ mod tests { ); count_model( &Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), ModelName::new(identifier!("model1")), ), &mut aggregator, @@ -373,14 +373,14 @@ mod tests { UsagesCounts { models_used: vec![ModelCount { model: Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), ModelName::new(identifier!("model1")) ), count: 2, }], commands_used: vec![CommandCount { command: Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), CommandName::new(identifier!("command1")) ), count: 2, @@ -389,7 +389,7 @@ mod tests { ); count_model( &Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), ModelName::new(identifier!("model2")), ), &mut aggregator, @@ -400,14 +400,14 @@ mod tests { models_used: vec![ ModelCount { model: Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), ModelName::new(identifier!("model1")) ), count: 2, }, ModelCount { model: Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), ModelName::new(identifier!("model2")) ), count: 1, @@ -415,7 +415,7 @@ mod tests { ], commands_used: vec![CommandCount { command: Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), CommandName::new(identifier!("command1")) ), count: 2, @@ -424,7 +424,7 @@ mod tests { ); count_command( &Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), CommandName::new(identifier!("command2")), ), &mut aggregator, @@ -435,14 +435,14 @@ mod tests { models_used: vec![ ModelCount { model: Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), ModelName::new(identifier!("model1")) ), count: 2, }, ModelCount { model: Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), ModelName::new(identifier!("model2")) ), count: 1, @@ -451,14 +451,14 @@ mod tests { commands_used: vec![ CommandCount { command: Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), CommandName::new(identifier!("command1")) ), count: 2, }, CommandCount { command: Qualified::new( - "subgraph".to_string(), + subgraph_identifier!("subgraph"), CommandName::new(identifier!("command2")) ), count: 1, diff --git a/v3/crates/metadata-resolve/src/helpers/argument.rs b/v3/crates/metadata-resolve/src/helpers/argument.rs index 2e12d2a2558..c8379cec0c9 100644 --- a/v3/crates/metadata-resolve/src/helpers/argument.rs +++ b/v3/crates/metadata-resolve/src/helpers/argument.rs @@ -22,6 +22,7 @@ use open_dds::arguments::ArgumentName; use open_dds::data_connector::{ DataConnectorName, DataConnectorObjectType, DataConnectorOperatorName, }; +use open_dds::identifier::SubgraphName; use open_dds::models::ModelName; use open_dds::permissions; use open_dds::relationships::RelationshipName; @@ -264,7 +265,7 @@ pub(crate) fn resolve_value_expression_for_argument( argument_type: &QualifiedTypeReference, source_argument_type: Option<&ndc_models::Type>, data_connector_link: &data_connectors::DataConnectorLink, - subgraph: &str, + subgraph: &SubgraphName, object_types: &BTreeMap, relationships::ObjectTypeWithRelationships>, scalar_types: &BTreeMap, scalar_types::ScalarTypeRepresentation>, object_boolean_expression_types: &BTreeMap< @@ -401,7 +402,7 @@ pub(crate) fn resolve_model_predicate_with_type( boolean_expression_graphql: Option<&boolean_expressions::BooleanExpressionGraphqlConfig>, data_connector_field_mappings: &BTreeMap, data_connector_link: &data_connectors::DataConnectorLink, - subgraph: &str, + subgraph: &SubgraphName, scalars: &data_connector_scalar_types::ScalarTypeWithRepresentationInfoMap, object_types: &BTreeMap, relationships::ObjectTypeWithRelationships>, scalar_types: &BTreeMap, scalar_types::ScalarTypeRepresentation>, @@ -916,7 +917,7 @@ fn resolve_binary_operator_for_type<'a>( fields: &'a IndexMap, scalars: &'a data_connector_scalar_types::ScalarTypeWithRepresentationInfoMap, ndc_scalar_type: &'a ndc_models::ScalarType, - subgraph: &'a str, + subgraph: &'a SubgraphName, ) -> Result<(DataConnectorOperatorName, QualifiedTypeReference), Error> { let field_definition = fields .get(field_name) @@ -1004,7 +1005,7 @@ fn remove_object_relationships( // in short, should we convert this to an NDC expression before sending it pub fn get_argument_kind( type_obj: &TypeReference, - subgraph: &str, + subgraph: &SubgraphName, object_boolean_expression_types: &BTreeMap< Qualified, object_boolean_expressions::ObjectBooleanExpressionType, @@ -1021,8 +1022,7 @@ pub fn get_argument_kind( BaseType::Named(type_name) => match type_name { TypeName::Inbuilt(_) => ArgumentKind::Other, TypeName::Custom(type_name) => { - let qualified_type_name = - Qualified::new(subgraph.to_string(), type_name.to_owned()); + let qualified_type_name = Qualified::new(subgraph.clone(), type_name.to_owned()); match get_type_representation::( &qualified_type_name, diff --git a/v3/crates/metadata-resolve/src/stages/aggregates/mod.rs b/v3/crates/metadata-resolve/src/stages/aggregates/mod.rs index 039b5395af5..51d25680290 100644 --- a/v3/crates/metadata-resolve/src/stages/aggregates/mod.rs +++ b/v3/crates/metadata-resolve/src/stages/aggregates/mod.rs @@ -4,6 +4,7 @@ use std::collections::{BTreeMap, BTreeSet, HashSet}; use lang_graphql::ast::common as ast; use open_dds::aggregates::{AggregateExpressionName, AggregationFunctionName}; use open_dds::data_connector::{DataConnectorName, DataConnectorObjectType}; +use open_dds::identifier::SubgraphName; use open_dds::types::{CustomTypeName, TypeName}; use crate::helpers::types::{store_new_graphql_type, unwrap_qualified_type_name}; @@ -40,7 +41,7 @@ pub fn resolve( } in &metadata_accessor.aggregate_expressions { let aggregate_expression_name = - Qualified::new(subgraph.to_string(), aggregate_expression.name.clone()); + Qualified::new(subgraph.clone(), aggregate_expression.name.clone()); // Have we seen this aggregate expression name before? // Check this before checking anything else, so we can fail fast @@ -214,7 +215,7 @@ fn resolve_aggregatable_field( .aggregate_expressions .iter() .find(|agg_exp| { - agg_exp.subgraph.as_str() == aggregate_expression_name.subgraph.as_str() + agg_exp.subgraph == aggregate_expression_name.subgraph && agg_exp.object.name == aggregate_field_def.aggregate_expression }) .map(|agg_exp| &agg_exp.object) @@ -412,13 +413,13 @@ fn resolve_aggregation_function( })?; // Check that the mapped data connector aggregate function actually exists - let data_connector_fn = data_connector_scalar_type.aggregate_functions.get(fn_mapping.name.0.as_str()) + let data_connector_fn = data_connector_scalar_type.aggregate_functions.get(fn_mapping.name.as_str()) .ok_or_else(|| AggregateExpressionError::AggregateOperandDataConnectorFunctionNotFound { name: aggregate_expression_name.clone(), function_name: aggregation_function_def.name.clone(), data_connector_name: data_connector_name.clone(), - data_connector_aggregate_function_name: fn_mapping.name.0.clone(), + data_connector_aggregate_function_name: fn_mapping.name.clone(), })?; check_aggregation_function_return_type( @@ -665,7 +666,7 @@ fn resolve_aggregate_expression_graphql_config( .aggregation_functions .iter() .find(|function| { - function.name.0.as_str() == aggregate_config.count_field_name.as_str() + function.name.as_str() == aggregate_config.count_field_name.as_str() }) { return Err(AggregateExpressionError::AggregationFunctionNameConflict { @@ -692,7 +693,7 @@ fn resolve_aggregate_expression_graphql_config( .aggregation_functions .iter() .find(|function| { - function.name.0.as_str() + function.name.as_str() == aggregate_config.count_distinct_field_name.as_str() }) { @@ -730,6 +731,9 @@ fn resolve_aggregate_count( } } -fn qualify(item: &T, subgraph: &str) -> Qualified { - Qualified::new(subgraph.to_owned(), item.clone()) +fn qualify( + item: &T, + subgraph: &SubgraphName, +) -> Qualified { + Qualified::new(subgraph.clone(), item.clone()) } diff --git a/v3/crates/metadata-resolve/src/stages/aggregates/types.rs b/v3/crates/metadata-resolve/src/stages/aggregates/types.rs index 758e6008bd5..9e6451c71da 100644 --- a/v3/crates/metadata-resolve/src/stages/aggregates/types.rs +++ b/v3/crates/metadata-resolve/src/stages/aggregates/types.rs @@ -193,7 +193,7 @@ pub enum AggregateExpressionError { name: Qualified, function_name: AggregationFunctionName, data_connector_name: Qualified, - data_connector_aggregate_function_name: String, + data_connector_aggregate_function_name: DataConnectorAggregationFunctionName, }, #[error("the aggregate expression {name} specifies an aggregation function '{function_name}' which is mapped to the data connector '{data_connector_name}' but the Open DD return type {return_type} is not compatible with the data connector's return type. Reason: {reason}")] diff --git a/v3/crates/metadata-resolve/src/stages/boolean_expressions/graphql.rs b/v3/crates/metadata-resolve/src/stages/boolean_expressions/graphql.rs index bee2f31bf50..cd05bfee08a 100644 --- a/v3/crates/metadata-resolve/src/stages/boolean_expressions/graphql.rs +++ b/v3/crates/metadata-resolve/src/stages/boolean_expressions/graphql.rs @@ -108,7 +108,7 @@ pub(crate) fn resolve_object_boolean_graphql( ObjectComparisonExpressionInfo { object_type_name: comparable_field_type_name.clone(), underlying_object_type_name: Qualified::new( - (*field_subgraph).to_string(), + (*field_subgraph).clone(), object_operand.r#type.clone(), ), graphql_type_name: graphql_type_name.clone(), diff --git a/v3/crates/metadata-resolve/src/stages/boolean_expressions/helpers.rs b/v3/crates/metadata-resolve/src/stages/boolean_expressions/helpers.rs index ff967ca4dc5..d03a33eac79 100644 --- a/v3/crates/metadata-resolve/src/stages/boolean_expressions/helpers.rs +++ b/v3/crates/metadata-resolve/src/stages/boolean_expressions/helpers.rs @@ -10,7 +10,7 @@ pub(crate) fn lookup_raw_boolean_expression<'a>( raw_boolean_expression_types: &'a super::object::RawBooleanExpressionTypes<'a>, ) -> Result< &'a ( - &'a open_dds::identifier::SubgraphIdentifier, + &'a open_dds::identifier::SubgraphName, &'a open_dds::boolean_expression::BooleanExpressionTypeV1, ), BooleanExpressionError, diff --git a/v3/crates/metadata-resolve/src/stages/boolean_expressions/mod.rs b/v3/crates/metadata-resolve/src/stages/boolean_expressions/mod.rs index f8f16de0406..86cf14f62f6 100644 --- a/v3/crates/metadata-resolve/src/stages/boolean_expressions/mod.rs +++ b/v3/crates/metadata-resolve/src/stages/boolean_expressions/mod.rs @@ -44,7 +44,7 @@ pub fn resolve( } in &metadata_accessor.boolean_expression_types { raw_boolean_expression_types.insert( - Qualified::new(subgraph.to_string(), boolean_expression_type.name.clone()), + Qualified::new(subgraph.clone(), boolean_expression_type.name.clone()), (subgraph, boolean_expression_type), ); } diff --git a/v3/crates/metadata-resolve/src/stages/boolean_expressions/object.rs b/v3/crates/metadata-resolve/src/stages/boolean_expressions/object.rs index bcbb69f3914..965c6dc2efa 100644 --- a/v3/crates/metadata-resolve/src/stages/boolean_expressions/object.rs +++ b/v3/crates/metadata-resolve/src/stages/boolean_expressions/object.rs @@ -8,6 +8,7 @@ pub use super::{ use crate::stages::{graphql_config, object_types, scalar_boolean_expressions, type_permissions}; use crate::types::subgraph::mk_qualified_type_name; use crate::{Qualified, QualifiedBaseType}; +use open_dds::identifier::SubgraphName; use open_dds::{ boolean_expression::{ BooleanExpressionComparableField, BooleanExpressionLogicalOperators, @@ -21,7 +22,7 @@ use std::collections::BTreeMap; pub(crate) type RawBooleanExpressionTypes<'a> = BTreeMap< Qualified, ( - &'a open_dds::identifier::SubgraphIdentifier, + &'a open_dds::identifier::SubgraphName, &'a open_dds::boolean_expression::BooleanExpressionTypeV1, ), >; @@ -36,7 +37,7 @@ pub(crate) fn resolve_object_boolean_expression_type( boolean_expression_type_name: &Qualified, object_boolean_expression_operand: &BooleanExpressionObjectOperand, logical_operators: &BooleanExpressionLogicalOperators, - subgraph: &str, + subgraph: &SubgraphName, graphql: &Option, object_types: &BTreeMap, type_permissions::ObjectTypeWithPermissions>, scalar_boolean_expression_types: &BTreeMap< @@ -47,7 +48,7 @@ pub(crate) fn resolve_object_boolean_expression_type( graphql_config: &graphql_config::GraphqlConfig, ) -> Result { let qualified_object_type_name = Qualified::new( - subgraph.to_string(), + subgraph.clone(), object_boolean_expression_operand.r#type.clone(), ); @@ -117,7 +118,7 @@ fn resolve_comparable_relationships( comparable_relationships: &Vec< open_dds::boolean_expression::BooleanExpressionComparableRelationship, >, - subgraph: &str, + subgraph: &SubgraphName, raw_boolean_expression_types: &RawBooleanExpressionTypes, ) -> Result, BooleanExpressionError> { let mut resolved_comparable_relationships = BTreeMap::new(); @@ -131,7 +132,7 @@ fn resolve_comparable_relationships( let _raw_boolean_expression_type = helpers::lookup_raw_boolean_expression( boolean_expression_type_name, &Qualified::new( - subgraph.to_string(), + subgraph.clone(), target_boolean_expression_type_name.clone(), ), raw_boolean_expression_types, @@ -142,7 +143,7 @@ fn resolve_comparable_relationships( boolean_expression_type: comparable_relationship .boolean_expression_type .as_ref() - .map(|bool_exp| Qualified::new(subgraph.to_string(), bool_exp.clone())), + .map(|bool_exp| Qualified::new(subgraph.clone(), bool_exp.clone())), }; resolved_comparable_relationships.insert( FieldName::new(comparable_relationship.relationship_name.inner().clone()), @@ -164,7 +165,7 @@ fn resolve_comparable_fields( comparable_fields: &Vec, object_type_representation: &object_types::ObjectTypeRepresentation, boolean_expression_type_name: &Qualified, - subgraph: &str, + subgraph: &SubgraphName, raw_boolean_expression_types: &RawBooleanExpressionTypes, ) -> Result { let mut resolved_comparable_fields = BTreeMap::new(); @@ -197,7 +198,7 @@ fn resolve_comparable_fields( } let field_boolean_expression_type_name = Qualified::new( - subgraph.to_string(), + subgraph.clone(), comparable_field.boolean_expression_type.clone(), ); diff --git a/v3/crates/metadata-resolve/src/stages/command_permissions/command_permission.rs b/v3/crates/metadata-resolve/src/stages/command_permissions/command_permission.rs index c53ac6dbac4..05d164d642c 100644 --- a/v3/crates/metadata-resolve/src/stages/command_permissions/command_permission.rs +++ b/v3/crates/metadata-resolve/src/stages/command_permissions/command_permission.rs @@ -1,6 +1,7 @@ use hasura_authn_core::Role; use indexmap::IndexMap; +use open_dds::identifier::SubgraphName; use open_dds::{data_connector::DataConnectorName, models::ModelName, types::CustomTypeName}; use crate::stages::{ @@ -52,7 +53,7 @@ pub fn resolve_command_permissions( Qualified, data_connector_scalar_types::ScalarTypeWithRepresentationInfoMap, >, - subgraph: &str, + subgraph: &SubgraphName, ) -> Result, Error> { let mut validated_permissions = BTreeMap::new(); for command_permission in &permissions.permissions { diff --git a/v3/crates/metadata-resolve/src/stages/command_permissions/mod.rs b/v3/crates/metadata-resolve/src/stages/command_permissions/mod.rs index dada412047d..2a2edcbf2d1 100644 --- a/v3/crates/metadata-resolve/src/stages/command_permissions/mod.rs +++ b/v3/crates/metadata-resolve/src/stages/command_permissions/mod.rs @@ -55,7 +55,7 @@ pub fn resolve( } in &metadata_accessor.command_permissions { let command_name = &command_permissions.command_name; - let qualified_command_name = Qualified::new(subgraph.to_string(), command_name.to_owned()); + let qualified_command_name = Qualified::new(subgraph.clone(), command_name.to_owned()); let command = commands_with_permissions .get_mut(&qualified_command_name) .ok_or_else(|| Error::UnknownCommandInCommandPermissions { diff --git a/v3/crates/metadata-resolve/src/stages/commands/command.rs b/v3/crates/metadata-resolve/src/stages/commands/command.rs index 7a75c2e5dbb..b9c9731d074 100644 --- a/v3/crates/metadata-resolve/src/stages/commands/command.rs +++ b/v3/crates/metadata-resolve/src/stages/commands/command.rs @@ -6,6 +6,7 @@ use crate::stages::{ use crate::types::error::Error; use crate::types::subgraph::{mk_qualified_type_reference, ArgumentInfo, Qualified}; use indexmap::IndexMap; +use open_dds::identifier::SubgraphName; use super::types::{Command, CommandGraphQlApi}; use open_dds::commands::CommandV1; @@ -16,7 +17,7 @@ use std::collections::BTreeMap; pub fn resolve_command( command: &CommandV1, - subgraph: &str, + subgraph: &SubgraphName, object_types: &BTreeMap, type_permissions::ObjectTypeWithPermissions>, scalar_types: &BTreeMap, scalar_types::ScalarTypeRepresentation>, object_boolean_expression_types: &BTreeMap< @@ -26,7 +27,7 @@ pub fn resolve_command( boolean_expression_types: &boolean_expressions::BooleanExpressionTypes, ) -> Result { let mut arguments = IndexMap::new(); - let qualified_command_name = Qualified::new(subgraph.to_string(), command.name.clone()); + let qualified_command_name = Qualified::new(subgraph.clone(), command.name.clone()); let command_description = command.description.clone(); // duplicate command arguments should not be allowed for argument in &command.arguments { @@ -96,7 +97,7 @@ pub fn resolve_command( fn type_exists( type_obj: &TypeReference, - subgraph: &str, + subgraph: &SubgraphName, object_types: &BTreeMap, type_permissions::ObjectTypeWithPermissions>, scalar_types: &BTreeMap, scalar_types::ScalarTypeRepresentation>, object_boolean_expression_types: &BTreeMap< @@ -117,8 +118,7 @@ fn type_exists( BaseType::Named(type_name) => match type_name { TypeName::Inbuilt(_) => true, TypeName::Custom(type_name) => { - let qualified_type_name = - Qualified::new(subgraph.to_string(), type_name.to_owned()); + let qualified_type_name = Qualified::new(subgraph.clone(), type_name.to_owned()); get_type_representation( &qualified_type_name, diff --git a/v3/crates/metadata-resolve/src/stages/commands/mod.rs b/v3/crates/metadata-resolve/src/stages/commands/mod.rs index 148b6ebda1b..d45e71288c3 100644 --- a/v3/crates/metadata-resolve/src/stages/commands/mod.rs +++ b/v3/crates/metadata-resolve/src/stages/commands/mod.rs @@ -58,7 +58,7 @@ pub fn resolve( resolved_command.source = Some(command_source); issues.extend(command_source_issues); } - let qualified_command_name = Qualified::new(subgraph.to_string(), command.name.clone()); + let qualified_command_name = Qualified::new(subgraph.clone(), command.name.clone()); if commands .insert(qualified_command_name.clone(), resolved_command) .is_some() diff --git a/v3/crates/metadata-resolve/src/stages/commands/source.rs b/v3/crates/metadata-resolve/src/stages/commands/source.rs index ffb1765eb25..64fc08d62a3 100644 --- a/v3/crates/metadata-resolve/src/stages/commands/source.rs +++ b/v3/crates/metadata-resolve/src/stages/commands/source.rs @@ -12,7 +12,7 @@ use super::types::CommandsIssue; pub use super::types::{Command, CommandSource}; use open_dds::commands::{self, DataConnectorCommand}; -use open_dds::identifier::SubgraphIdentifier; +use open_dds::identifier::SubgraphName; use open_dds::types::{CustomTypeName, DataConnectorArgumentName}; use std::collections::BTreeMap; @@ -27,7 +27,7 @@ struct CommandSourceResponse { pub fn resolve_command_source( command_source: &commands::CommandSource, command: &Command, - subgraph: &SubgraphIdentifier, + subgraph: &SubgraphName, data_connectors: &data_connectors::DataConnectors, object_types: &type_permissions::ObjectTypesWithPermissions, scalar_types: &BTreeMap, scalar_types::ScalarTypeRepresentation>, @@ -44,10 +44,8 @@ pub fn resolve_command_source( } // check if data_connector for the command exists - let qualified_data_connector_name = Qualified::new( - subgraph.to_string(), - command_source.data_connector_name.clone(), - ); + let qualified_data_connector_name = + Qualified::new(subgraph.clone(), command_source.data_connector_name.clone()); let data_connector_context = data_connectors .0 diff --git a/v3/crates/metadata-resolve/src/stages/data_connector_scalar_types/mod.rs b/v3/crates/metadata-resolve/src/stages/data_connector_scalar_types/mod.rs index fbafab9d1b1..6ffc1bf6185 100644 --- a/v3/crates/metadata-resolve/src/stages/data_connector_scalar_types/mod.rs +++ b/v3/crates/metadata-resolve/src/stages/data_connector_scalar_types/mod.rs @@ -1,6 +1,7 @@ mod error; mod types; pub use error::DataConnectorScalarTypesError; +use open_dds::identifier::SubgraphName; use std::collections::{BTreeMap, BTreeSet}; pub use types::{ ComparisonOperators, DataConnectorWithScalarsOutput, ScalarTypeWithRepresentationInfo, @@ -43,7 +44,7 @@ pub fn resolve<'a>( let scalar_type_name = &scalar_type_representation.data_connector_scalar_type; let qualified_data_connector_name = Qualified::new( - subgraph.to_string(), + subgraph.clone(), scalar_type_representation.data_connector_name.clone(), ); @@ -106,14 +107,14 @@ pub fn resolve<'a>( fn validate_type_name( type_name: &TypeName, - subgraph: &str, + subgraph: &SubgraphName, scalar_types: &BTreeMap, scalar_types::ScalarTypeRepresentation>, scalar_type_name: &DataConnectorScalarType, ) -> Result<(), DataConnectorScalarTypesError> { match type_name { TypeName::Inbuilt(_) => {} // TODO: Validate Nullable and Array types in Inbuilt TypeName::Custom(type_name) => { - let qualified_type_name = Qualified::new(subgraph.to_string(), type_name.to_owned()); + let qualified_type_name = Qualified::new(subgraph.clone(), type_name.to_owned()); let _representation = scalar_types.get(&qualified_type_name).ok_or_else(|| { DataConnectorScalarTypesError::ScalarTypeUnknownRepresentation { scalar_type: scalar_type_name.clone(), diff --git a/v3/crates/metadata-resolve/src/stages/data_connectors/mod.rs b/v3/crates/metadata-resolve/src/stages/data_connectors/mod.rs index 52966ec9f11..80f7e63a816 100644 --- a/v3/crates/metadata-resolve/src/stages/data_connectors/mod.rs +++ b/v3/crates/metadata-resolve/src/stages/data_connectors/mod.rs @@ -26,7 +26,7 @@ pub fn resolve<'a>( } in &metadata_accessor.data_connectors { let qualified_data_connector_name = - Qualified::new(subgraph.to_string(), data_connector.name.clone()); + Qualified::new(subgraph.clone(), data_connector.name.clone()); let (data_connector_context, connector_issues) = types::DataConnectorContext::new(data_connector, &configuration.unstable_features) diff --git a/v3/crates/metadata-resolve/src/stages/model_permissions/mod.rs b/v3/crates/metadata-resolve/src/stages/model_permissions/mod.rs index 83fef177361..ae75f087e2a 100644 --- a/v3/crates/metadata-resolve/src/stages/model_permissions/mod.rs +++ b/v3/crates/metadata-resolve/src/stages/model_permissions/mod.rs @@ -56,7 +56,7 @@ pub fn resolve( object: permissions, } in &metadata_accessor.model_permissions { - let model_name = Qualified::new(subgraph.to_string(), permissions.model_name.clone()); + let model_name = Qualified::new(subgraph.clone(), permissions.model_name.clone()); let model = models_with_permissions .get_mut(&model_name) .ok_or_else(|| Error::UnknownModelInModelSelectPermissions { diff --git a/v3/crates/metadata-resolve/src/stages/model_permissions/model_permission.rs b/v3/crates/metadata-resolve/src/stages/model_permissions/model_permission.rs index 68028379146..3f5f64338c4 100644 --- a/v3/crates/metadata-resolve/src/stages/model_permissions/model_permission.rs +++ b/v3/crates/metadata-resolve/src/stages/model_permissions/model_permission.rs @@ -5,6 +5,7 @@ use crate::stages::{ object_boolean_expressions, object_types, relationships, scalar_types, }; use indexmap::IndexMap; +use open_dds::identifier::SubgraphName; use open_dds::{data_connector::DataConnectorName, models::ModelName, types::CustomTypeName}; use std::collections::BTreeMap; @@ -26,7 +27,7 @@ use open_dds::{ fn resolve_model_predicate_with_model( model_predicate: &open_dds::permissions::ModelPredicate, model: &models::Model, - subgraph: &str, + subgraph: &SubgraphName, boolean_expression_graphql: Option<&boolean_expressions::BooleanExpressionGraphqlConfig>, data_connectors: &data_connectors::DataConnectors, data_connector_scalars: &BTreeMap< @@ -125,7 +126,7 @@ pub fn get_model_source_argument<'a>( pub fn resolve_model_select_permissions( model: &models::Model, - subgraph: &str, + subgraph: &SubgraphName, model_permissions: &ModelPermissionsV1, boolean_expression_graphql: Option<&boolean_expressions::BooleanExpressionGraphqlConfig>, data_connectors: &data_connectors::DataConnectors, diff --git a/v3/crates/metadata-resolve/src/stages/models/mod.rs b/v3/crates/metadata-resolve/src/stages/models/mod.rs index 4efcfee0490..ab9e05f55d5 100644 --- a/v3/crates/metadata-resolve/src/stages/models/mod.rs +++ b/v3/crates/metadata-resolve/src/stages/models/mod.rs @@ -1,3 +1,4 @@ +use open_dds::identifier::SubgraphName; pub use types::{Model, ModelRaw, ModelSource, ModelsIssue, ModelsOutput, NDCFieldSourceMapping}; mod aggregation; mod helpers; @@ -65,7 +66,7 @@ pub fn resolve( object: model, } in &metadata_accessor.models { - let qualified_model_name = Qualified::new(subgraph.to_string(), model.name.clone()); + let qualified_model_name = Qualified::new(subgraph.clone(), model.name.clone()); let mut resolved_model = resolve_model( subgraph, model, @@ -114,7 +115,7 @@ pub fn resolve( .as_ref() .map(|aggregate_expression_name| { aggregation::resolve_aggregate_expression( - &Qualified::new(subgraph.to_string(), aggregate_expression_name.clone()), + &Qualified::new(subgraph.clone(), aggregate_expression_name.clone()), &qualified_model_name, &resolved_model.data_type, &resolved_model.source, @@ -144,7 +145,7 @@ pub fn resolve( } fn resolve_model( - subgraph: &str, + subgraph: &SubgraphName, model: &ModelV1, object_types: &type_permissions::ObjectTypesWithPermissions, object_boolean_expression_types: &BTreeMap< @@ -158,9 +159,8 @@ fn resolve_model( Option>, >, ) -> Result { - let qualified_object_type_name = - Qualified::new(subgraph.to_string(), model.object_type.clone()); - let qualified_model_name = Qualified::new(subgraph.to_string(), model.name.clone()); + let qualified_object_type_name = Qualified::new(subgraph.clone(), model.object_type.clone()); + let qualified_model_name = Qualified::new(subgraph.clone(), model.name.clone()); let object_type_representation = source::get_model_object_type_representation( object_types, &qualified_object_type_name, @@ -294,7 +294,7 @@ fn resolve_model( filter_expression_type: model .filter_expression_type .as_ref() - .map(|filter_name| Qualified::new(subgraph.to_string(), filter_name.clone())), + .map(|filter_name| Qualified::new(subgraph.clone(), filter_name.clone())), graphql: model.graphql.clone(), }; diff --git a/v3/crates/metadata-resolve/src/stages/models/source.rs b/v3/crates/metadata-resolve/src/stages/models/source.rs index 4059a2eca0f..129ce0f23a9 100644 --- a/v3/crates/metadata-resolve/src/stages/models/source.rs +++ b/v3/crates/metadata-resolve/src/stages/models/source.rs @@ -1,5 +1,6 @@ use super::types::{Model, ModelSource, ModelsIssue}; use open_dds::data_connector::{DataConnectorName, DataConnectorObjectType}; +use open_dds::identifier::SubgraphName; use open_dds::types::DataConnectorArgumentName; use crate::helpers::argument::{get_argument_mappings, ArgumentMappingResults}; @@ -25,7 +26,7 @@ use std::iter; pub(crate) fn resolve_model_source( model_source: &models::ModelSource, model: &mut Model, - subgraph: &str, + subgraph: &SubgraphName, data_connectors: &data_connectors::DataConnectors, data_connector_scalars: &BTreeMap< Qualified, @@ -44,10 +45,8 @@ pub(crate) fn resolve_model_source( model_name: model.name.clone(), }); } - let qualified_data_connector_name = Qualified::new( - subgraph.to_string(), - model_source.data_connector_name.clone(), - ); + let qualified_data_connector_name = + Qualified::new(subgraph.clone(), model_source.data_connector_name.clone()); let data_connector_context = data_connectors .0 diff --git a/v3/crates/metadata-resolve/src/stages/models_graphql/graphql.rs b/v3/crates/metadata-resolve/src/stages/models_graphql/graphql.rs index 877d4f69c20..884ec0cdc5a 100644 --- a/v3/crates/metadata-resolve/src/stages/models_graphql/graphql.rs +++ b/v3/crates/metadata-resolve/src/stages/models_graphql/graphql.rs @@ -302,7 +302,7 @@ fn is_model_used_in_any_aggregate_relationship( // And the target of the relationship is this model target .subgraph() - .is_some_and(|subgraph| subgraph == model_name.subgraph.as_str()) + .is_some_and(|subgraph| subgraph == model_name.subgraph) && *name == model_name.name } _ => false, diff --git a/v3/crates/metadata-resolve/src/stages/object_boolean_expressions/helpers.rs b/v3/crates/metadata-resolve/src/stages/object_boolean_expressions/helpers.rs index d3de69b6dbe..1594d09d81e 100644 --- a/v3/crates/metadata-resolve/src/stages/object_boolean_expressions/helpers.rs +++ b/v3/crates/metadata-resolve/src/stages/object_boolean_expressions/helpers.rs @@ -7,6 +7,7 @@ use crate::types::subgraph::{ use ndc_models; use open_dds::data_connector::{DataConnectorName, DataConnectorScalarType}; +use open_dds::identifier::SubgraphName; // helper function to resolve ndc types to dds type based on scalar type representations // this should only be used when we know the underlying type must be a scalar and not an object @@ -14,7 +15,7 @@ pub fn resolve_ndc_type( data_connector: &Qualified, source_type: &ndc_models::Type, scalars: &data_connector_scalar_types::ScalarTypeWithRepresentationInfoMap, - subgraph: &str, + subgraph: &SubgraphName, ) -> Result { match source_type { ndc_models::Type::Named { name } => { diff --git a/v3/crates/metadata-resolve/src/stages/object_boolean_expressions/mod.rs b/v3/crates/metadata-resolve/src/stages/object_boolean_expressions/mod.rs index 6f48702dc1f..d47a78e5ea8 100644 --- a/v3/crates/metadata-resolve/src/stages/object_boolean_expressions/mod.rs +++ b/v3/crates/metadata-resolve/src/stages/object_boolean_expressions/mod.rs @@ -5,6 +5,7 @@ use crate::stages::{ object_types, type_permissions, }; pub use helpers::resolve_ndc_type; +use open_dds::identifier::SubgraphName; use crate::helpers::types::{mk_name, store_new_graphql_type}; use crate::types::subgraph::Qualified; @@ -78,7 +79,7 @@ pub fn resolve( /// Resolves a given object boolean expression type pub(crate) fn resolve_object_boolean_expression_type( object_boolean_expression: &open_dds::types::ObjectBooleanExpressionTypeV1, - subgraph: &str, + subgraph: &SubgraphName, data_connectors: &data_connectors::DataConnectors, data_connector_scalars: &BTreeMap< Qualified, @@ -89,12 +90,11 @@ pub(crate) fn resolve_object_boolean_expression_type( graphql_config: &graphql_config::GraphqlConfig, ) -> Result { // name of the boolean expression - let qualified_name = - Qualified::new(subgraph.to_string(), object_boolean_expression.name.clone()); + let qualified_name = Qualified::new(subgraph.clone(), object_boolean_expression.name.clone()); // name of the object type backing the boolean expression let qualified_object_type_name = Qualified::new( - subgraph.to_string(), + subgraph.clone(), object_boolean_expression.object_type.clone(), ); let object_type_representation = @@ -105,7 +105,7 @@ pub(crate) fn resolve_object_boolean_expression_type( })?; let qualified_data_connector_name = Qualified::new( - subgraph.to_string(), + subgraph.clone(), object_boolean_expression.data_connector_name.clone(), ); @@ -189,10 +189,10 @@ pub(crate) fn resolve_object_boolean_expression_type( } let object_boolean_expression_type = - Qualified::new(subgraph.to_string(), object_boolean_expression.name.clone()); + Qualified::new(subgraph.clone(), object_boolean_expression.name.clone()); let data_connector_name = Qualified::new( - subgraph.to_string(), + subgraph.clone(), object_boolean_expression.data_connector_name.clone(), ); @@ -262,7 +262,7 @@ pub(crate) fn resolve_object_boolean_expression_type( pub fn resolve_boolean_expression_graphql_config( data_connector_name: &Qualified, where_type_name: ast::TypeName, - subgraph: &str, + subgraph: &SubgraphName, scalars: &data_connector_scalar_types::ScalarTypeWithRepresentationInfoMap, type_mappings: &object_types::TypeMapping, graphql_config: &graphql_config::GraphqlConfig, diff --git a/v3/crates/metadata-resolve/src/stages/object_types/mod.rs b/v3/crates/metadata-resolve/src/stages/object_types/mod.rs index 1d43658c65b..39333a2fe04 100644 --- a/v3/crates/metadata-resolve/src/stages/object_types/mod.rs +++ b/v3/crates/metadata-resolve/src/stages/object_types/mod.rs @@ -2,6 +2,7 @@ mod error; pub mod types; pub use error::{ObjectTypesError, TypeMappingValidationError}; +use open_dds::identifier::SubgraphName; use std::borrow::Cow; use std::collections::{BTreeMap, BTreeSet}; @@ -41,7 +42,7 @@ pub(crate) fn resolve( } in &metadata_accessor.object_types { let qualified_object_type_name = - Qualified::new(subgraph.to_string(), object_type_definition.name.clone()); + Qualified::new(subgraph.clone(), object_type_definition.name.clone()); let resolved_object_type = resolve_object_type( object_type_definition, @@ -57,7 +58,7 @@ pub(crate) fn resolve( // resolve object types' type mappings for dc_type_mapping in &object_type_definition.data_connector_type_mapping { let qualified_data_connector_name = Qualified::new( - subgraph.to_string(), + subgraph.clone(), dc_type_mapping.data_connector_name.clone(), ); let type_mapping = resolve_data_connector_type_mapping( @@ -108,7 +109,7 @@ pub(crate) fn resolve( fn resolve_field( field: &open_dds::types::FieldDefinition, - subgraph: &str, + subgraph: &SubgraphName, qualified_type_name: &Qualified, ) -> Result { let mut field_arguments = IndexMap::new(); @@ -140,7 +141,7 @@ pub fn resolve_object_type( object_type_definition: &open_dds::types::ObjectTypeV1, existing_graphql_types: &mut BTreeSet, qualified_type_name: &Qualified, - subgraph: &str, + subgraph: &SubgraphName, global_id_enabled_types: &mut BTreeMap< Qualified, Vec>, @@ -282,12 +283,12 @@ pub fn resolve_object_type( pub fn resolve_data_connector_type_mapping( data_connector_type_mapping: &open_dds::types::DataConnectorTypeMapping, qualified_type_name: &Qualified, - subgraph: &str, + subgraph: &SubgraphName, type_representation: &ObjectTypeRepresentation, data_connectors: &data_connectors::DataConnectors, ) -> Result { let qualified_data_connector_name = Qualified::new( - subgraph.to_string(), + subgraph.clone(), data_connector_type_mapping.data_connector_name.clone(), ); diff --git a/v3/crates/metadata-resolve/src/stages/relationships/mod.rs b/v3/crates/metadata-resolve/src/stages/relationships/mod.rs index afe88c39a19..4a60c72960f 100644 --- a/v3/crates/metadata-resolve/src/stages/relationships/mod.rs +++ b/v3/crates/metadata-resolve/src/stages/relationships/mod.rs @@ -6,6 +6,7 @@ use indexmap::IndexMap; use lang_graphql::ast::common::{self as ast}; use open_dds::aggregates::AggregateExpressionName; +use open_dds::identifier::SubgraphName; use open_dds::relationships::{ self, FieldAccess, RelationshipName, RelationshipType, RelationshipV1, }; @@ -77,7 +78,7 @@ pub fn resolve( } in &metadata_accessor.relationships { let qualified_relationship_source_type_name = - Qualified::new(subgraph.to_string(), relationship.source_type.clone()); + Qualified::new(subgraph.clone(), relationship.source_type.clone()); let object_representation = object_types_with_relationships .get_mut(&qualified_relationship_source_type_name) .ok_or_else(|| Error::RelationshipDefinedOnUnknownType { @@ -467,7 +468,7 @@ fn resolve_aggregate_relationship_field( // Validate its usage with the relationship's target model let aggregate_expression_name = models::resolve_aggregate_expression( &Qualified::new( - resolved_target_model.name.subgraph.to_string(), + resolved_target_model.name.subgraph.clone(), aggregate.aggregate_expression.clone(), ), &resolved_target_model.name, @@ -530,7 +531,7 @@ fn resolve_aggregate_relationship_field( fn resolve_model_relationship_fields( target_model: &relationships::ModelRelationshipTarget, - subgraph: &open_dds::identifier::SubgraphIdentifier, + subgraph: &open_dds::identifier::SubgraphName, models: &IndexMap, crate::Model>, data_connectors: &data_connectors::DataConnectors, source_type_name: &Qualified, @@ -548,7 +549,7 @@ fn resolve_model_relationship_fields( graphql_config: &graphql_config::GraphqlConfig, ) -> Result, Error> { let qualified_target_model_name = Qualified::new( - target_model.subgraph().unwrap_or(subgraph).to_string(), + target_model.subgraph().unwrap_or(subgraph.clone()), target_model.name.clone(), ); let resolved_target_model = models.get(&qualified_target_model_name).ok_or_else(|| { @@ -623,7 +624,7 @@ pub fn make_relationship_field_name( fn resolve_command_relationship_field( target_command: &relationships::CommandRelationshipTarget, - subgraph: &open_dds::identifier::SubgraphIdentifier, + subgraph: &open_dds::identifier::SubgraphName, commands: &IndexMap, commands::Command>, data_connectors: &data_connectors::DataConnectors, source_type_name: &Qualified, @@ -631,7 +632,7 @@ fn resolve_command_relationship_field( source_type: &object_types::ObjectTypeRepresentation, ) -> Result { let qualified_target_command_name = Qualified::new( - target_command.subgraph().unwrap_or(subgraph).to_string(), + target_command.subgraph().unwrap_or(subgraph.clone()), target_command.name.clone(), ); let resolved_target_command = @@ -683,8 +684,8 @@ fn resolve_command_relationship_field( fn resolve_relationships( configuration: Configuration, relationship: &RelationshipV1, - subgraph: &open_dds::identifier::SubgraphIdentifier, - known_subgraphs: &HashSet, + subgraph: &open_dds::identifier::SubgraphName, + known_subgraphs: &HashSet, models: &IndexMap, models::Model>, commands: &IndexMap, commands::Command>, data_connectors: &data_connectors::DataConnectors, @@ -700,10 +701,14 @@ fn resolve_relationships( graphql_config: &graphql_config::GraphqlConfig, source_type: &object_types::ObjectTypeRepresentation, ) -> Result, Error> { - let source_type_name = Qualified::new(subgraph.to_string(), relationship.source_type.clone()); + let source_type_name = Qualified::new(subgraph.clone(), relationship.source_type.clone()); match &relationship.target { relationships::RelationshipTarget::Model(target_model) => { - if should_skip(configuration, known_subgraphs, target_model.subgraph()) { + if should_skip( + configuration, + known_subgraphs, + target_model.subgraph().as_ref(), + ) { return Ok(vec![]); } resolve_model_relationship_fields( @@ -721,7 +726,11 @@ fn resolve_relationships( ) } relationships::RelationshipTarget::Command(target_command) => { - if should_skip(configuration, known_subgraphs, target_command.subgraph()) { + if should_skip( + configuration, + known_subgraphs, + target_command.subgraph().as_ref(), + ) { return Ok(vec![]); } let command_relationship_field = resolve_command_relationship_field( @@ -746,8 +755,8 @@ fn resolve_relationships( // abstraction for that purpose. fn should_skip( configuration: Configuration, - known_subgraphs: &HashSet, - target_subgraph: Option<&str>, + known_subgraphs: &HashSet, + target_subgraph: Option<&SubgraphName>, ) -> bool { configuration.allow_unknown_subgraphs && target_subgraph.is_some_and(|subgraph| !known_subgraphs.contains(subgraph)) diff --git a/v3/crates/metadata-resolve/src/stages/scalar_boolean_expressions/mod.rs b/v3/crates/metadata-resolve/src/stages/scalar_boolean_expressions/mod.rs index 5ff6192f68d..a3e2b28ef6d 100644 --- a/v3/crates/metadata-resolve/src/stages/scalar_boolean_expressions/mod.rs +++ b/v3/crates/metadata-resolve/src/stages/scalar_boolean_expressions/mod.rs @@ -35,7 +35,7 @@ pub fn resolve( } in &metadata_accessor.boolean_expression_types { raw_boolean_expression_types.insert( - Qualified::new(subgraph.to_string(), boolean_expression_type.name.clone()), + Qualified::new(subgraph.clone(), boolean_expression_type.name.clone()), (subgraph, boolean_expression_type), ); } diff --git a/v3/crates/metadata-resolve/src/stages/scalar_boolean_expressions/scalar.rs b/v3/crates/metadata-resolve/src/stages/scalar_boolean_expressions/scalar.rs index 9c5eab30298..98d0683ee90 100644 --- a/v3/crates/metadata-resolve/src/stages/scalar_boolean_expressions/scalar.rs +++ b/v3/crates/metadata-resolve/src/stages/scalar_boolean_expressions/scalar.rs @@ -4,6 +4,7 @@ use crate::helpers::types::unwrap_qualified_type_name; use crate::stages::{data_connectors, object_types, scalar_types}; use crate::types::subgraph::mk_qualified_type_reference; use crate::{Qualified, QualifiedTypeName}; +use open_dds::identifier::SubgraphName; use open_dds::{ boolean_expression::{ BooleanExpressionIsNull, BooleanExpressionScalarOperand, @@ -18,7 +19,7 @@ pub(crate) fn resolve_scalar_boolean_expression_type( boolean_expression_type_name: &Qualified, scalar_boolean_expression_operand: &BooleanExpressionScalarOperand, is_null: &BooleanExpressionIsNull, - subgraph: &str, + subgraph: &SubgraphName, data_connectors: &data_connectors::DataConnectors, object_types: &object_types::ObjectTypesWithTypeMappings, scalar_types: &BTreeMap, scalar_types::ScalarTypeRepresentation>, @@ -34,7 +35,7 @@ pub(crate) fn resolve_scalar_boolean_expression_type( // scope the data connector to the current subgraph let qualified_data_connector_name = Qualified::new( - subgraph.to_string(), + subgraph.clone(), data_connector_operator_mapping.data_connector_name.clone(), ); diff --git a/v3/crates/metadata-resolve/src/stages/scalar_types/mod.rs b/v3/crates/metadata-resolve/src/stages/scalar_types/mod.rs index 416de2a4a8b..7651775da2d 100644 --- a/v3/crates/metadata-resolve/src/stages/scalar_types/mod.rs +++ b/v3/crates/metadata-resolve/src/stages/scalar_types/mod.rs @@ -29,8 +29,7 @@ pub fn resolve( .map(Some), }?; - let qualified_scalar_type_name = - Qualified::new(subgraph.to_string(), scalar_type.name.clone()); + let qualified_scalar_type_name = Qualified::new(subgraph.clone(), scalar_type.name.clone()); if scalar_types .insert( diff --git a/v3/crates/metadata-resolve/src/stages/type_permissions/mod.rs b/v3/crates/metadata-resolve/src/stages/type_permissions/mod.rs index 3652c76542c..b4394059b66 100644 --- a/v3/crates/metadata-resolve/src/stages/type_permissions/mod.rs +++ b/v3/crates/metadata-resolve/src/stages/type_permissions/mod.rs @@ -37,10 +37,8 @@ pub fn resolve( object: output_type_permission, } in &metadata_accessor.type_permissions { - let qualified_type_name = Qualified::new( - subgraph.to_string(), - output_type_permission.type_name.clone(), - ); + let qualified_type_name = + Qualified::new(subgraph.clone(), output_type_permission.type_name.clone()); match object_types_with_permissions.get_mut(&qualified_type_name) { None => { return Err(TypePermissionError::from( diff --git a/v3/crates/metadata-resolve/src/types/subgraph.rs b/v3/crates/metadata-resolve/src/types/subgraph.rs index d8bb40613de..71bb3de7143 100644 --- a/v3/crates/metadata-resolve/src/types/subgraph.rs +++ b/v3/crates/metadata-resolve/src/types/subgraph.rs @@ -1,6 +1,7 @@ use std::fmt::Display; use std::{collections::BTreeMap, fmt::Write}; +use open_dds::identifier::SubgraphName; use open_dds::types::{BaseType, CustomTypeName, InbuiltType, TypeName, TypeReference}; use schemars::JsonSchema; use serde::{de::DeserializeOwned, ser::SerializeMap, Deserialize, Serialize}; @@ -10,7 +11,7 @@ use serde_json; Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Hash, Eq, PartialOrd, Ord, )] pub struct Qualified { - pub subgraph: String, + pub subgraph: SubgraphName, pub name: T, } @@ -22,7 +23,7 @@ impl Display for Qualified { } impl Qualified { - pub fn new(subgraph: String, name: T) -> Self { + pub fn new(subgraph: SubgraphName, name: T) -> Self { Qualified { subgraph, name } } @@ -238,7 +239,7 @@ where pub(crate) fn mk_qualified_type_reference( type_reference: &TypeReference, - subgraph: &str, + subgraph: &SubgraphName, ) -> QualifiedTypeReference { QualifiedTypeReference { nullable: type_reference.nullable, @@ -246,7 +247,10 @@ pub(crate) fn mk_qualified_type_reference( } } -pub(crate) fn mk_qualified_base_type(base_type: &BaseType, subgraph: &str) -> QualifiedBaseType { +pub(crate) fn mk_qualified_base_type( + base_type: &BaseType, + subgraph: &SubgraphName, +) -> QualifiedBaseType { match base_type { BaseType::List(type_reference) => QualifiedBaseType::List(Box::new( mk_qualified_type_reference(type_reference, subgraph), @@ -257,17 +261,21 @@ pub(crate) fn mk_qualified_base_type(base_type: &BaseType, subgraph: &str) -> Qu } } -pub(crate) fn mk_qualified_type_name(type_name: &TypeName, subgraph: &str) -> QualifiedTypeName { +pub(crate) fn mk_qualified_type_name( + type_name: &TypeName, + subgraph: &SubgraphName, +) -> QualifiedTypeName { match type_name { TypeName::Inbuilt(inbuilt_type) => QualifiedTypeName::Inbuilt(inbuilt_type.clone()), TypeName::Custom(type_name) => { - QualifiedTypeName::Custom(Qualified::new(subgraph.to_string(), type_name.to_owned())) + QualifiedTypeName::Custom(Qualified::new(subgraph.clone(), type_name.to_owned())) } } } #[test] fn test_btree_map_serialize_deserialize() { + use open_dds::subgraph_identifier; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)] struct ObjectForTest { #[serde( @@ -281,7 +289,7 @@ fn test_btree_map_serialize_deserialize() { map: BTreeMap::new(), }; obj.map.insert( - Qualified::new("subgraph".to_string(), "name".to_string()), + Qualified::new(subgraph_identifier!("subgraph"), "name".to_string()), "value".to_string(), ); let obj_clone = diff --git a/v3/crates/metadata-resolve/tests/passing/aggregate_expressions/relationship/resolved.snap b/v3/crates/metadata-resolve/tests/passing/aggregate_expressions/relationship/resolved.snap index 58935a6980f..78838af8cf3 100644 --- a/v3/crates/metadata-resolve/tests/passing/aggregate_expressions/relationship/resolved.snap +++ b/v3/crates/metadata-resolve/tests/passing/aggregate_expressions/relationship/resolved.snap @@ -7,7 +7,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation Metadata { object_types: { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Invoice", @@ -25,7 +27,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Varchar", @@ -49,7 +53,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Varchar", @@ -73,7 +79,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Varchar", @@ -97,7 +105,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Varchar", @@ -121,7 +131,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Varchar", @@ -145,7 +157,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int4", @@ -169,7 +183,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Timestamp", @@ -193,7 +209,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int4", @@ -217,7 +235,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Numeric", @@ -266,7 +286,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation ), ), source: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Invoice", @@ -276,7 +298,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation target: Model( ModelRelationshipTarget { model_name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: ModelName( Identifier( "InvoiceLine", @@ -285,7 +309,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation }, relationship_type: Array, target_typename: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "InvoiceLine", @@ -344,7 +370,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation ), ), source: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Invoice", @@ -354,7 +382,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation target: ModelAggregate( ModelAggregateRelationshipTarget { model_name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: ModelName( Identifier( "InvoiceLine", @@ -362,7 +392,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation ), }, target_typename: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "InvoiceLine", @@ -398,7 +430,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation }, ], aggregate_expression: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: AggregateExpressionName( Identifier( "InvoiceLine_aggregate_exp", @@ -424,7 +458,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation type_mappings: DataConnectorTypeMappingsForObject( { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: DataConnectorName( Identifier( "mypg", @@ -662,7 +698,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation ), }, Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "InvoiceLine", @@ -680,7 +718,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int4", @@ -704,7 +744,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int4", @@ -728,7 +770,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int4", @@ -752,7 +796,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int4", @@ -776,7 +822,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Numeric", @@ -816,7 +864,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation type_mappings: DataConnectorTypeMappingsForObject( { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: DataConnectorName( Identifier( "mypg", @@ -954,7 +1004,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation }, scalar_types: { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int4", @@ -971,7 +1023,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation description: None, }, Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int8", @@ -990,7 +1044,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation }, models: { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: ModelName( Identifier( "Invoice", @@ -999,7 +1055,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation }: ModelWithPermissions { model: Model { name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: ModelName( Identifier( "Invoice", @@ -1007,7 +1065,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation ), }, data_type: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Invoice", @@ -1024,7 +1084,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Varchar", @@ -1048,7 +1110,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Varchar", @@ -1072,7 +1136,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Varchar", @@ -1096,7 +1162,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Varchar", @@ -1120,7 +1188,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Varchar", @@ -1144,7 +1214,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int4", @@ -1168,7 +1240,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Timestamp", @@ -1192,7 +1266,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int4", @@ -1216,7 +1292,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Numeric", @@ -1238,7 +1316,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation ModelSource { data_connector: DataConnectorLink { name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: DataConnectorName( Identifier( "mypg", @@ -1307,7 +1387,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation ), type_mappings: { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Invoice", @@ -1639,7 +1721,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation ], aggregate_expression: Some( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: AggregateExpressionName( Identifier( "Invoice_aggregate_exp", @@ -1717,7 +1801,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int4", @@ -1761,7 +1847,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation description: None, deprecated: None, aggregate_expression_name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: AggregateExpressionName( Identifier( "Invoice_aggregate_exp", @@ -1798,7 +1886,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation }, }, Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: ModelName( Identifier( "InvoiceLine", @@ -1807,7 +1897,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation }: ModelWithPermissions { model: Model { name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: ModelName( Identifier( "InvoiceLine", @@ -1815,7 +1907,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation ), }, data_type: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "InvoiceLine", @@ -1832,7 +1926,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int4", @@ -1856,7 +1952,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int4", @@ -1880,7 +1978,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int4", @@ -1904,7 +2004,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int4", @@ -1928,7 +2030,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Numeric", @@ -1950,7 +2054,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation ModelSource { data_connector: DataConnectorLink { name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: DataConnectorName( Identifier( "mypg", @@ -2019,7 +2125,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation ), type_mappings: { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "InvoiceLine", @@ -2209,7 +2317,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation ], aggregate_expression: Some( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: AggregateExpressionName( Identifier( "InvoiceLine_aggregate_exp", @@ -2287,7 +2397,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int4", @@ -2331,7 +2443,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation description: None, deprecated: None, aggregate_expression_name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: AggregateExpressionName( Identifier( "InvoiceLine_aggregate_exp", @@ -2376,7 +2490,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation }, aggregate_expressions: { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: AggregateExpressionName( Identifier( "Int4_aggregate_exp", @@ -2384,7 +2500,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation ), }: AggregateExpression { name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: AggregateExpressionName( Identifier( "Int4_aggregate_exp", @@ -2394,7 +2512,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation operand: AggregateOperand { aggregated_type: Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int4", @@ -2415,7 +2535,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int8", @@ -2429,7 +2551,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation data_connector_functions: [ DataConnectorAggregationFunctionInfo { data_connector_name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: DataConnectorName( Identifier( "mypg", @@ -2456,7 +2580,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int4", @@ -2470,7 +2596,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation data_connector_functions: [ DataConnectorAggregationFunctionInfo { data_connector_name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: DataConnectorName( Identifier( "mypg", @@ -2497,7 +2625,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int4", @@ -2511,7 +2641,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation data_connector_functions: [ DataConnectorAggregationFunctionInfo { data_connector_name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: DataConnectorName( Identifier( "mypg", @@ -2541,7 +2673,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation description: None, }, Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: AggregateExpressionName( Identifier( "InvoiceLine_aggregate_exp", @@ -2549,7 +2683,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation ), }: AggregateExpression { name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: AggregateExpressionName( Identifier( "InvoiceLine_aggregate_exp", @@ -2559,7 +2695,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation operand: AggregateOperand { aggregated_type: Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "InvoiceLine", @@ -2576,7 +2714,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation ), description: None, aggregate_expression: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: AggregateExpressionName( Identifier( "Int4_aggregate_exp", @@ -2599,7 +2739,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation description: None, }, Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: AggregateExpressionName( Identifier( "Invoice_aggregate_exp", @@ -2607,7 +2749,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation ), }: AggregateExpression { name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: AggregateExpressionName( Identifier( "Invoice_aggregate_exp", @@ -2617,7 +2761,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation operand: AggregateOperand { aggregated_type: Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Invoice", @@ -2634,7 +2780,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/relation ), description: None, aggregate_expression: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: AggregateExpressionName( Identifier( "Int4_aggregate_exp", diff --git a/v3/crates/metadata-resolve/tests/passing/aggregate_expressions/root_field/resolved.snap b/v3/crates/metadata-resolve/tests/passing/aggregate_expressions/root_field/resolved.snap index 71342fc2a53..753f82b40f4 100644 --- a/v3/crates/metadata-resolve/tests/passing/aggregate_expressions/root_field/resolved.snap +++ b/v3/crates/metadata-resolve/tests/passing/aggregate_expressions/root_field/resolved.snap @@ -7,7 +7,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie Metadata { object_types: { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Invoice", @@ -25,7 +27,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Varchar", @@ -49,7 +53,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Varchar", @@ -73,7 +79,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Varchar", @@ -97,7 +105,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Varchar", @@ -121,7 +131,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Varchar", @@ -145,7 +157,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int4", @@ -169,7 +183,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Timestamp", @@ -193,7 +209,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int4", @@ -217,7 +235,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Numeric", @@ -257,7 +277,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie type_mappings: DataConnectorTypeMappingsForObject( { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: DataConnectorName( Identifier( "mypg", @@ -497,7 +519,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie }, scalar_types: { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int4", @@ -514,7 +538,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie description: None, }, Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int8", @@ -533,7 +559,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie }, models: { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: ModelName( Identifier( "Invoice", @@ -542,7 +570,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie }: ModelWithPermissions { model: Model { name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: ModelName( Identifier( "Invoice", @@ -550,7 +580,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie ), }, data_type: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Invoice", @@ -567,7 +599,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Varchar", @@ -591,7 +625,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Varchar", @@ -615,7 +651,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Varchar", @@ -639,7 +677,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Varchar", @@ -663,7 +703,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Varchar", @@ -687,7 +729,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int4", @@ -711,7 +755,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Timestamp", @@ -735,7 +781,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int4", @@ -759,7 +807,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Numeric", @@ -781,7 +831,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie ModelSource { data_connector: DataConnectorLink { name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: DataConnectorName( Identifier( "mypg", @@ -850,7 +902,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie ), type_mappings: { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Invoice", @@ -1182,7 +1236,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie ], aggregate_expression: Some( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: AggregateExpressionName( Identifier( "Invoice_aggregate_exp", @@ -1260,7 +1316,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int4", @@ -1304,7 +1362,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie description: None, deprecated: None, aggregate_expression_name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: AggregateExpressionName( Identifier( "Invoice_aggregate_exp", @@ -1349,7 +1409,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie }, aggregate_expressions: { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: AggregateExpressionName( Identifier( "Int4_aggregate_exp", @@ -1357,7 +1419,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie ), }: AggregateExpression { name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: AggregateExpressionName( Identifier( "Int4_aggregate_exp", @@ -1367,7 +1431,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie operand: AggregateOperand { aggregated_type: Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int4", @@ -1388,7 +1454,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int8", @@ -1402,7 +1470,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie data_connector_functions: [ DataConnectorAggregationFunctionInfo { data_connector_name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: DataConnectorName( Identifier( "mypg", @@ -1429,7 +1499,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int4", @@ -1443,7 +1515,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie data_connector_functions: [ DataConnectorAggregationFunctionInfo { data_connector_name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: DataConnectorName( Identifier( "mypg", @@ -1470,7 +1544,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie underlying_type: Named( Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Int4", @@ -1484,7 +1560,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie data_connector_functions: [ DataConnectorAggregationFunctionInfo { data_connector_name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: DataConnectorName( Identifier( "mypg", @@ -1514,7 +1592,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie description: None, }, Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: AggregateExpressionName( Identifier( "Invoice_aggregate_exp", @@ -1522,7 +1602,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie ), }: AggregateExpression { name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: AggregateExpressionName( Identifier( "Invoice_aggregate_exp", @@ -1532,7 +1614,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie operand: AggregateOperand { aggregated_type: Custom( Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Invoice", @@ -1549,7 +1633,9 @@ input_file: crates/metadata-resolve/tests/passing/aggregate_expressions/root_fie ), description: None, aggregate_expression: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: AggregateExpressionName( Identifier( "Int4_aggregate_exp", diff --git a/v3/crates/metadata-resolve/tests/passing/boolean_expression_type/basic/resolved.snap b/v3/crates/metadata-resolve/tests/passing/boolean_expression_type/basic/resolved.snap index a618ccd6519..4f017b10382 100644 --- a/v3/crates/metadata-resolve/tests/passing/boolean_expression_type/basic/resolved.snap +++ b/v3/crates/metadata-resolve/tests/passing/boolean_expression_type/basic/resolved.snap @@ -7,7 +7,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/basic/ Metadata { object_types: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "author", @@ -129,7 +131,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/basic/ type_mappings: DataConnectorTypeMappingsForObject( { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "postgres_db", @@ -216,7 +220,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/basic/ boolean_expression_types: BooleanExpressionTypes { objects: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "author_bool_exp", @@ -224,7 +230,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/basic/ ), }: ResolvedObjectBooleanExpressionType { name: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "author_bool_exp", @@ -232,7 +240,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/basic/ ), }, object_type: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "author", @@ -255,7 +265,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/basic/ ): ComparisonExpressionInfo { object_type_name: Some( Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "postgres_int_comparison_bool_exp", @@ -297,7 +309,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/basic/ }, operator_mapping: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "postgres_db", @@ -324,7 +338,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/basic/ ): ComparisonExpressionInfo { object_type_name: Some( Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "postgres_string_comparison_bool_exp", @@ -366,7 +382,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/basic/ }, operator_mapping: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "postgres_db", @@ -393,7 +411,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/basic/ ): ComparisonExpressionInfo { object_type_name: Some( Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "postgres_string_comparison_bool_exp", @@ -435,7 +455,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/basic/ }, operator_mapping: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "postgres_db", @@ -478,7 +500,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/basic/ }, scalars: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "postgres_int_comparison_bool_exp", @@ -486,7 +510,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/basic/ ), }: ResolvedScalarBooleanExpressionType { name: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "postgres_int_comparison_bool_exp", @@ -525,7 +551,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/basic/ }, data_connector_operator_mappings: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "postgres_db", @@ -557,7 +585,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/basic/ include_is_null: Yes, }, Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "postgres_string_comparison_bool_exp", @@ -565,7 +595,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/basic/ ), }: ResolvedScalarBooleanExpressionType { name: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "postgres_string_comparison_bool_exp", @@ -604,7 +636,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/basic/ }, data_connector_operator_mappings: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "postgres_db", diff --git a/v3/crates/metadata-resolve/tests/passing/boolean_expression_type/nested_object/resolved.snap b/v3/crates/metadata-resolve/tests/passing/boolean_expression_type/nested_object/resolved.snap index 00c11e11588..4e07582fdd2 100644 --- a/v3/crates/metadata-resolve/tests/passing/boolean_expression_type/nested_object/resolved.snap +++ b/v3/crates/metadata-resolve/tests/passing/boolean_expression_type/nested_object/resolved.snap @@ -7,7 +7,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested Metadata { object_types: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "institution", @@ -59,7 +61,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested underlying_type: Named( Custom( Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "location", @@ -85,7 +89,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested underlying_type: Named( Custom( Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "staff_member", @@ -176,7 +182,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested type_mappings: DataConnectorTypeMappingsForObject( { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "custom", @@ -298,7 +306,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested ), }, Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "location", @@ -404,7 +414,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested type_mappings: DataConnectorTypeMappingsForObject( { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "custom", @@ -490,7 +502,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested ), }, Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "staff_member", @@ -596,7 +610,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested type_mappings: DataConnectorTypeMappingsForObject( { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "custom", @@ -685,7 +701,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested scalar_types: {}, models: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: ModelName( Identifier( "institutions", @@ -694,7 +712,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested }: ModelWithPermissions { model: Model { name: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: ModelName( Identifier( "institutions", @@ -702,7 +722,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested ), }, data_type: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "institution", @@ -753,7 +775,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested underlying_type: Named( Custom( Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "location", @@ -779,7 +803,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested underlying_type: Named( Custom( Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "staff_member", @@ -826,7 +852,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested ModelSource { data_connector: DataConnectorLink { name: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "custom", @@ -874,7 +902,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested ), type_mappings: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "institution", @@ -989,7 +1019,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested }, }, Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "location", @@ -1068,7 +1100,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested }, }, Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "staff_member", @@ -1277,7 +1311,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested boolean_expression_types: BooleanExpressionTypes { objects: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "institution_bool_exp", @@ -1285,7 +1321,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested ), }: ResolvedObjectBooleanExpressionType { name: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "institution_bool_exp", @@ -1293,7 +1331,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested ), }, object_type: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "institution", @@ -1319,7 +1359,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested ), ), object_type_name: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "location_bool_exp", @@ -1327,7 +1369,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested ), }, underlying_object_type_name: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "location", @@ -1344,7 +1388,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested ): ComparisonExpressionInfo { object_type_name: Some( Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "int_bool_exp", @@ -1360,7 +1406,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested operators: {}, operator_mapping: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "custom", @@ -1381,7 +1429,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested ): ComparisonExpressionInfo { object_type_name: Some( Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "string_bool_exp", @@ -1397,7 +1447,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested operators: {}, operator_mapping: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "custom", @@ -1432,7 +1484,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested include_logical_operators: Yes, }, Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "location_bool_exp", @@ -1440,7 +1494,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested ), }: ResolvedObjectBooleanExpressionType { name: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "location_bool_exp", @@ -1448,7 +1504,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested ), }, object_type: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "location", @@ -1471,7 +1529,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested ): ComparisonExpressionInfo { object_type_name: Some( Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "string_bool_exp", @@ -1487,7 +1547,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested operators: {}, operator_mapping: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "custom", @@ -1508,7 +1570,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested ): ComparisonExpressionInfo { object_type_name: Some( Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "string_bool_exp", @@ -1524,7 +1588,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested operators: {}, operator_mapping: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "custom", @@ -1561,7 +1627,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested }, scalars: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "int_bool_exp", @@ -1569,7 +1637,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested ), }: ResolvedScalarBooleanExpressionType { name: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "int_bool_exp", @@ -1582,7 +1652,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested comparison_operators: {}, data_connector_operator_mappings: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "custom", @@ -1608,7 +1680,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested include_is_null: Yes, }, Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "string_bool_exp", @@ -1616,7 +1690,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested ), }: ResolvedScalarBooleanExpressionType { name: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "string_bool_exp", @@ -1629,7 +1705,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/nested comparison_operators: {}, data_connector_operator_mappings: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "custom", diff --git a/v3/crates/metadata-resolve/tests/passing/boolean_expression_type/no_graphql/resolved.snap b/v3/crates/metadata-resolve/tests/passing/boolean_expression_type/no_graphql/resolved.snap index 86ce8efa223..0bf27fe92ff 100644 --- a/v3/crates/metadata-resolve/tests/passing/boolean_expression_type/no_graphql/resolved.snap +++ b/v3/crates/metadata-resolve/tests/passing/boolean_expression_type/no_graphql/resolved.snap @@ -7,7 +7,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/no_gra Metadata { object_types: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "author", @@ -129,7 +131,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/no_gra type_mappings: DataConnectorTypeMappingsForObject( { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "postgres_db", @@ -216,7 +220,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/no_gra boolean_expression_types: BooleanExpressionTypes { objects: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "author_bool_exp", @@ -224,7 +230,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/no_gra ), }: ResolvedObjectBooleanExpressionType { name: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "author_bool_exp", @@ -232,7 +240,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/no_gra ), }, object_type: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "author", @@ -245,7 +255,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/no_gra }, scalars: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "postgres_int_comparison_bool_exp", @@ -253,7 +265,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/no_gra ), }: ResolvedScalarBooleanExpressionType { name: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "postgres_int_comparison_bool_exp", @@ -292,7 +306,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/no_gra }, data_connector_operator_mappings: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "postgres_db", @@ -320,7 +336,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/no_gra include_is_null: Yes, }, Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "postgres_string_comparison_bool_exp", @@ -328,7 +346,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/no_gra ), }: ResolvedScalarBooleanExpressionType { name: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "postgres_string_comparison_bool_exp", @@ -367,7 +387,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/no_gra }, data_connector_operator_mappings: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "postgres_db", diff --git a/v3/crates/metadata-resolve/tests/passing/boolean_expression_type/range/resolved.snap b/v3/crates/metadata-resolve/tests/passing/boolean_expression_type/range/resolved.snap index 655386def01..233f0a3ef8c 100644 --- a/v3/crates/metadata-resolve/tests/passing/boolean_expression_type/range/resolved.snap +++ b/v3/crates/metadata-resolve/tests/passing/boolean_expression_type/range/resolved.snap @@ -7,7 +7,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ Metadata { object_types: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "int_range", @@ -69,7 +71,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ type_mappings: DataConnectorTypeMappingsForObject( { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "elastic", @@ -128,7 +132,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ ), }, Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "movie", @@ -229,7 +235,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ type_mappings: DataConnectorTypeMappingsForObject( { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "elastic", @@ -310,7 +318,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ scalar_types: {}, models: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: ModelName( Identifier( "movies", @@ -319,7 +329,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ }: ModelWithPermissions { model: Model { name: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: ModelName( Identifier( "movies", @@ -327,7 +339,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ ), }, data_type: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "movie", @@ -393,7 +407,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ ModelSource { data_connector: DataConnectorLink { name: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "elastic", @@ -441,7 +457,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ ), type_mappings: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "movie", @@ -555,7 +573,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ raw: ModelRaw { filter_expression_type: Some( Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "movie_bool_exp", @@ -597,7 +617,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ BooleanExpressionType( ResolvedObjectBooleanExpressionType { name: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "movie_bool_exp", @@ -605,7 +627,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ ), }, object_type: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "movie", @@ -628,7 +652,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ ): ComparisonExpressionInfo { object_type_name: Some( Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "int_bool_exp", @@ -644,7 +670,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ operators: {}, operator_mapping: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "elastic", @@ -665,7 +693,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ ): ComparisonExpressionInfo { object_type_name: Some( Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "int_bool_exp_with_range", @@ -685,7 +715,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ underlying_type: Named( Custom( Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "int_range", @@ -699,7 +731,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ }, operator_mapping: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "elastic", @@ -720,7 +754,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ ): ComparisonExpressionInfo { object_type_name: Some( Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "string_bool_exp", @@ -736,7 +772,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ operators: {}, operator_mapping: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "elastic", @@ -809,7 +847,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ boolean_expression_types: BooleanExpressionTypes { objects: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "movie_bool_exp", @@ -817,7 +857,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ ), }: ResolvedObjectBooleanExpressionType { name: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "movie_bool_exp", @@ -825,7 +867,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ ), }, object_type: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "movie", @@ -848,7 +892,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ ): ComparisonExpressionInfo { object_type_name: Some( Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "int_bool_exp", @@ -864,7 +910,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ operators: {}, operator_mapping: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "elastic", @@ -885,7 +933,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ ): ComparisonExpressionInfo { object_type_name: Some( Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "int_bool_exp_with_range", @@ -905,7 +955,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ underlying_type: Named( Custom( Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "int_range", @@ -919,7 +971,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ }, operator_mapping: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "elastic", @@ -940,7 +994,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ ): ComparisonExpressionInfo { object_type_name: Some( Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "string_bool_exp", @@ -956,7 +1012,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ operators: {}, operator_mapping: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "elastic", @@ -993,7 +1051,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ }, scalars: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "int_bool_exp", @@ -1001,7 +1061,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ ), }: ResolvedScalarBooleanExpressionType { name: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "int_bool_exp", @@ -1014,7 +1076,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ comparison_operators: {}, data_connector_operator_mappings: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "elastic", @@ -1040,7 +1104,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ include_is_null: Yes, }, Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "int_bool_exp_with_range", @@ -1048,7 +1114,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ ), }: ResolvedScalarBooleanExpressionType { name: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "int_bool_exp_with_range", @@ -1065,7 +1133,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ underlying_type: Named( Custom( Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "int_range", @@ -1079,7 +1149,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ }, data_connector_operator_mappings: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "elastic", @@ -1105,7 +1177,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ include_is_null: Yes, }, Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "string_bool_exp", @@ -1113,7 +1187,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ ), }: ResolvedScalarBooleanExpressionType { name: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "string_bool_exp", @@ -1126,7 +1202,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/range/ comparison_operators: {}, data_connector_operator_mappings: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "elastic", diff --git a/v3/crates/metadata-resolve/tests/passing/boolean_expression_type/two_data_sources/resolved.snap b/v3/crates/metadata-resolve/tests/passing/boolean_expression_type/two_data_sources/resolved.snap index a362a7f323d..e87e1714ef0 100644 --- a/v3/crates/metadata-resolve/tests/passing/boolean_expression_type/two_data_sources/resolved.snap +++ b/v3/crates/metadata-resolve/tests/passing/boolean_expression_type/two_data_sources/resolved.snap @@ -7,7 +7,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/two_da Metadata { object_types: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "author", @@ -129,7 +131,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/two_da type_mappings: DataConnectorTypeMappingsForObject( { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "postgres_db", @@ -216,7 +220,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/two_da boolean_expression_types: BooleanExpressionTypes { objects: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "author_bool_exp", @@ -224,7 +230,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/two_da ), }: ResolvedObjectBooleanExpressionType { name: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "author_bool_exp", @@ -232,7 +240,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/two_da ), }, object_type: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "author", @@ -245,7 +255,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/two_da }, scalars: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "postgres_int_comparison_bool_exp", @@ -253,7 +265,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/two_da ), }: ResolvedScalarBooleanExpressionType { name: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "postgres_int_comparison_bool_exp", @@ -292,7 +306,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/two_da }, data_connector_operator_mappings: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "postgres_db", @@ -316,7 +332,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/two_da }, }, Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "postgres_db_2", @@ -344,7 +362,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/two_da include_is_null: Yes, }, Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "postgres_string_comparison_bool_exp", @@ -352,7 +372,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/two_da ), }: ResolvedScalarBooleanExpressionType { name: Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: CustomTypeName( Identifier( "postgres_string_comparison_bool_exp", @@ -391,7 +413,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/two_da }, data_connector_operator_mappings: { Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "postgres_db", @@ -415,7 +439,9 @@ input_file: crates/metadata-resolve/tests/passing/boolean_expression_type/two_da }, }, Qualified { - subgraph: "__unknown_namespace", + subgraph: SubgraphName( + "__unknown_namespace", + ), name: DataConnectorName( Identifier( "postgres_db_2", diff --git a/v3/crates/metadata-resolve/tests/passing/commands/functions/all_args_are_set_including_connector_link_presets/resolved.snap b/v3/crates/metadata-resolve/tests/passing/commands/functions/all_args_are_set_including_connector_link_presets/resolved.snap index 9098c0c50c9..add3965e27b 100644 --- a/v3/crates/metadata-resolve/tests/passing/commands/functions/all_args_are_set_including_connector_link_presets/resolved.snap +++ b/v3/crates/metadata-resolve/tests/passing/commands/functions/all_args_are_set_including_connector_link_presets/resolved.snap @@ -1,14 +1,16 @@ --- source: crates/metadata-resolve/tests/metadata_golden_tests.rs expression: resolved -input_file: crates/metadata-resolve/tests/passing/commands/all_function_args_are_set_include_connector_link_presets/metadata.json +input_file: crates/metadata-resolve/tests/passing/commands/functions/all_args_are_set_including_connector_link_presets/metadata.json --- ( Metadata { object_types: {}, scalar_types: { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Headers", @@ -30,7 +32,9 @@ input_file: crates/metadata-resolve/tests/passing/commands/all_function_args_are models: {}, commands: { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CommandName( Identifier( "function_with_args", @@ -39,7 +43,9 @@ input_file: crates/metadata-resolve/tests/passing/commands/all_function_args_are }: CommandWithPermissions { command: Command { name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CommandName( Identifier( "function_with_args", @@ -93,7 +99,9 @@ input_file: crates/metadata-resolve/tests/passing/commands/all_function_args_are CommandSource { data_connector: DataConnectorLink { name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: DataConnectorName( Identifier( "myconnector", diff --git a/v3/crates/metadata-resolve/tests/passing/commands/functions/issue_when_not_all_arguments_defined/resolved.snap b/v3/crates/metadata-resolve/tests/passing/commands/functions/issue_when_not_all_arguments_defined/resolved.snap index 58d54981efd..bab0d00c805 100644 --- a/v3/crates/metadata-resolve/tests/passing/commands/functions/issue_when_not_all_arguments_defined/resolved.snap +++ b/v3/crates/metadata-resolve/tests/passing/commands/functions/issue_when_not_all_arguments_defined/resolved.snap @@ -8,7 +8,9 @@ input_file: crates/metadata-resolve/tests/passing/commands/functions/issue_when_ object_types: {}, scalar_types: { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Headers", @@ -30,7 +32,9 @@ input_file: crates/metadata-resolve/tests/passing/commands/functions/issue_when_ models: {}, commands: { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CommandName( Identifier( "function_with_args", @@ -39,7 +43,9 @@ input_file: crates/metadata-resolve/tests/passing/commands/functions/issue_when_ }: CommandWithPermissions { command: Command { name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CommandName( Identifier( "function_with_args", @@ -93,7 +99,9 @@ input_file: crates/metadata-resolve/tests/passing/commands/functions/issue_when_ CommandSource { data_connector: DataConnectorLink { name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: DataConnectorName( Identifier( "myconnector", @@ -248,7 +256,9 @@ input_file: crates/metadata-resolve/tests/passing/commands/functions/issue_when_ CommandIssue( FunctionArgumentMappingIssue { data_connector_name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: DataConnectorName( Identifier( "myconnector", @@ -256,7 +266,9 @@ input_file: crates/metadata-resolve/tests/passing/commands/functions/issue_when_ ), }, command_name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CommandName( Identifier( "function_with_args", diff --git a/v3/crates/metadata-resolve/tests/passing/commands/procedures/all_args_are_set_including_connector_link_presets/resolved.snap b/v3/crates/metadata-resolve/tests/passing/commands/procedures/all_args_are_set_including_connector_link_presets/resolved.snap index 64f84f36596..8d0584df473 100644 --- a/v3/crates/metadata-resolve/tests/passing/commands/procedures/all_args_are_set_including_connector_link_presets/resolved.snap +++ b/v3/crates/metadata-resolve/tests/passing/commands/procedures/all_args_are_set_including_connector_link_presets/resolved.snap @@ -1,14 +1,16 @@ --- source: crates/metadata-resolve/tests/metadata_golden_tests.rs expression: resolved -input_file: crates/metadata-resolve/tests/passing/commands/all_procedure_args_are_set_include_connector_link_presets/metadata.json +input_file: crates/metadata-resolve/tests/passing/commands/procedures/all_args_are_set_including_connector_link_presets/metadata.json --- ( Metadata { object_types: {}, scalar_types: { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Headers", @@ -30,7 +32,9 @@ input_file: crates/metadata-resolve/tests/passing/commands/all_procedure_args_ar models: {}, commands: { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CommandName( Identifier( "procedure_with_args", @@ -39,7 +43,9 @@ input_file: crates/metadata-resolve/tests/passing/commands/all_procedure_args_ar }: CommandWithPermissions { command: Command { name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CommandName( Identifier( "procedure_with_args", @@ -93,7 +99,9 @@ input_file: crates/metadata-resolve/tests/passing/commands/all_procedure_args_ar CommandSource { data_connector: DataConnectorLink { name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: DataConnectorName( Identifier( "myconnector", diff --git a/v3/crates/metadata-resolve/tests/passing/commands/procedures/issue_when_not_all_arguments_defined/resolved.snap b/v3/crates/metadata-resolve/tests/passing/commands/procedures/issue_when_not_all_arguments_defined/resolved.snap index 14a96ce15f1..dae0bb939f0 100644 --- a/v3/crates/metadata-resolve/tests/passing/commands/procedures/issue_when_not_all_arguments_defined/resolved.snap +++ b/v3/crates/metadata-resolve/tests/passing/commands/procedures/issue_when_not_all_arguments_defined/resolved.snap @@ -8,7 +8,9 @@ input_file: crates/metadata-resolve/tests/passing/commands/procedures/issue_when object_types: {}, scalar_types: { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Headers", @@ -30,7 +32,9 @@ input_file: crates/metadata-resolve/tests/passing/commands/procedures/issue_when models: {}, commands: { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CommandName( Identifier( "procedure_with_args", @@ -39,7 +43,9 @@ input_file: crates/metadata-resolve/tests/passing/commands/procedures/issue_when }: CommandWithPermissions { command: Command { name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CommandName( Identifier( "procedure_with_args", @@ -93,7 +99,9 @@ input_file: crates/metadata-resolve/tests/passing/commands/procedures/issue_when CommandSource { data_connector: DataConnectorLink { name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: DataConnectorName( Identifier( "myconnector", @@ -248,7 +256,9 @@ input_file: crates/metadata-resolve/tests/passing/commands/procedures/issue_when CommandIssue( ProcedureArgumentMappingIssue { data_connector_name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: DataConnectorName( Identifier( "myconnector", @@ -256,7 +266,9 @@ input_file: crates/metadata-resolve/tests/passing/commands/procedures/issue_when ), }, command_name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CommandName( Identifier( "procedure_with_args", diff --git a/v3/crates/metadata-resolve/tests/passing/data_connector_link/invalid_ndc_v01_capabilities_version_passing_with_issue/resolved.snap b/v3/crates/metadata-resolve/tests/passing/data_connector_link/invalid_ndc_v01_capabilities_version_passing_with_issue/resolved.snap index 0a5a3224a9a..e145f4cfacb 100644 --- a/v3/crates/metadata-resolve/tests/passing/data_connector_link/invalid_ndc_v01_capabilities_version_passing_with_issue/resolved.snap +++ b/v3/crates/metadata-resolve/tests/passing/data_connector_link/invalid_ndc_v01_capabilities_version_passing_with_issue/resolved.snap @@ -49,7 +49,9 @@ input_file: crates/metadata-resolve/tests/passing/data_connector_link/invalid_nd DataConnectorIssue( NamedDataConnectorIssue { data_connector_name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: DataConnectorName( Identifier( "myconnector", diff --git a/v3/crates/metadata-resolve/tests/passing/missing_subgraph_when_ignoring_unknown_subgraphs/resolved.snap b/v3/crates/metadata-resolve/tests/passing/missing_subgraph_when_ignoring_unknown_subgraphs/resolved.snap index f19bde3e700..d0df5039cfd 100644 --- a/v3/crates/metadata-resolve/tests/passing/missing_subgraph_when_ignoring_unknown_subgraphs/resolved.snap +++ b/v3/crates/metadata-resolve/tests/passing/missing_subgraph_when_ignoring_unknown_subgraphs/resolved.snap @@ -7,7 +7,9 @@ input_file: crates/metadata-resolve/tests/passing/missing_subgraph_when_ignoring Metadata { object_types: { Qualified { - subgraph: "article_namespace", + subgraph: SubgraphName( + "article_namespace", + ), name: CustomTypeName( Identifier( "article", @@ -146,7 +148,9 @@ input_file: crates/metadata-resolve/tests/passing/missing_subgraph_when_ignoring type_mappings: DataConnectorTypeMappingsForObject( { Qualified { - subgraph: "article_namespace", + subgraph: SubgraphName( + "article_namespace", + ), name: DataConnectorName( Identifier( "db", @@ -233,7 +237,9 @@ input_file: crates/metadata-resolve/tests/passing/missing_subgraph_when_ignoring scalar_types: {}, models: { Qualified { - subgraph: "article_namespace", + subgraph: SubgraphName( + "article_namespace", + ), name: ModelName( Identifier( "Articles", @@ -242,7 +248,9 @@ input_file: crates/metadata-resolve/tests/passing/missing_subgraph_when_ignoring }: ModelWithPermissions { model: Model { name: Qualified { - subgraph: "article_namespace", + subgraph: SubgraphName( + "article_namespace", + ), name: ModelName( Identifier( "Articles", @@ -250,7 +258,9 @@ input_file: crates/metadata-resolve/tests/passing/missing_subgraph_when_ignoring ), }, data_type: Qualified { - subgraph: "article_namespace", + subgraph: SubgraphName( + "article_namespace", + ), name: CustomTypeName( Identifier( "article", @@ -322,7 +332,9 @@ input_file: crates/metadata-resolve/tests/passing/missing_subgraph_when_ignoring ModelSource { data_connector: DataConnectorLink { name: Qualified { - subgraph: "article_namespace", + subgraph: SubgraphName( + "article_namespace", + ), name: DataConnectorName( Identifier( "db", @@ -370,7 +382,9 @@ input_file: crates/metadata-resolve/tests/passing/missing_subgraph_when_ignoring ), type_mappings: { Qualified { - subgraph: "article_namespace", + subgraph: SubgraphName( + "article_namespace", + ), name: CustomTypeName( Identifier( "article", @@ -546,7 +560,9 @@ input_file: crates/metadata-resolve/tests/passing/missing_subgraph_when_ignoring ), ), field_parent_type: Qualified { - subgraph: "article_namespace", + subgraph: SubgraphName( + "article_namespace", + ), name: CustomTypeName( Identifier( "article", diff --git a/v3/crates/metadata-resolve/tests/passing/models/all_args_are_set_including_connector_link_presets/resolved.snap b/v3/crates/metadata-resolve/tests/passing/models/all_args_are_set_including_connector_link_presets/resolved.snap index 08723ed8333..eac07d844d3 100644 --- a/v3/crates/metadata-resolve/tests/passing/models/all_args_are_set_including_connector_link_presets/resolved.snap +++ b/v3/crates/metadata-resolve/tests/passing/models/all_args_are_set_including_connector_link_presets/resolved.snap @@ -7,7 +7,9 @@ input_file: crates/metadata-resolve/tests/passing/models/all_args_are_set_includ Metadata { object_types: { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "RowType", @@ -46,7 +48,9 @@ input_file: crates/metadata-resolve/tests/passing/models/all_args_are_set_includ type_mappings: DataConnectorTypeMappingsForObject( { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: DataConnectorName( Identifier( "myconnector", @@ -88,7 +92,9 @@ input_file: crates/metadata-resolve/tests/passing/models/all_args_are_set_includ }, scalar_types: { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Headers", @@ -109,7 +115,9 @@ input_file: crates/metadata-resolve/tests/passing/models/all_args_are_set_includ }, models: { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: ModelName( Identifier( "collection_with_args", @@ -118,7 +126,9 @@ input_file: crates/metadata-resolve/tests/passing/models/all_args_are_set_includ }: ModelWithPermissions { model: Model { name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: ModelName( Identifier( "collection_with_args", @@ -126,7 +136,9 @@ input_file: crates/metadata-resolve/tests/passing/models/all_args_are_set_includ ), }, data_type: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "RowType", @@ -191,7 +203,9 @@ input_file: crates/metadata-resolve/tests/passing/models/all_args_are_set_includ ModelSource { data_connector: DataConnectorLink { name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: DataConnectorName( Identifier( "myconnector", @@ -260,7 +274,9 @@ input_file: crates/metadata-resolve/tests/passing/models/all_args_are_set_includ ), type_mappings: { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "RowType", @@ -430,7 +446,9 @@ input_file: crates/metadata-resolve/tests/passing/models/all_args_are_set_includ order_by_expression: Some( ModelOrderByExpression { data_connector_name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: DataConnectorName( Identifier( "myconnector", diff --git a/v3/crates/metadata-resolve/tests/passing/models/issue_when_not_all_arguments_defined/resolved.snap b/v3/crates/metadata-resolve/tests/passing/models/issue_when_not_all_arguments_defined/resolved.snap index 691bdfd43cf..c5601a73ab1 100644 --- a/v3/crates/metadata-resolve/tests/passing/models/issue_when_not_all_arguments_defined/resolved.snap +++ b/v3/crates/metadata-resolve/tests/passing/models/issue_when_not_all_arguments_defined/resolved.snap @@ -7,7 +7,9 @@ input_file: crates/metadata-resolve/tests/passing/models/issue_when_not_all_argu Metadata { object_types: { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "RowType", @@ -46,7 +48,9 @@ input_file: crates/metadata-resolve/tests/passing/models/issue_when_not_all_argu type_mappings: DataConnectorTypeMappingsForObject( { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: DataConnectorName( Identifier( "myconnector", @@ -88,7 +92,9 @@ input_file: crates/metadata-resolve/tests/passing/models/issue_when_not_all_argu }, scalar_types: { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "Headers", @@ -109,7 +115,9 @@ input_file: crates/metadata-resolve/tests/passing/models/issue_when_not_all_argu }, models: { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: ModelName( Identifier( "collection_with_args", @@ -118,7 +126,9 @@ input_file: crates/metadata-resolve/tests/passing/models/issue_when_not_all_argu }: ModelWithPermissions { model: Model { name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: ModelName( Identifier( "collection_with_args", @@ -126,7 +136,9 @@ input_file: crates/metadata-resolve/tests/passing/models/issue_when_not_all_argu ), }, data_type: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "RowType", @@ -191,7 +203,9 @@ input_file: crates/metadata-resolve/tests/passing/models/issue_when_not_all_argu ModelSource { data_connector: DataConnectorLink { name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: DataConnectorName( Identifier( "myconnector", @@ -260,7 +274,9 @@ input_file: crates/metadata-resolve/tests/passing/models/issue_when_not_all_argu ), type_mappings: { Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: CustomTypeName( Identifier( "RowType", @@ -411,7 +427,9 @@ input_file: crates/metadata-resolve/tests/passing/models/issue_when_not_all_argu order_by_expression: Some( ModelOrderByExpression { data_connector_name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: DataConnectorName( Identifier( "myconnector", @@ -498,7 +516,9 @@ input_file: crates/metadata-resolve/tests/passing/models/issue_when_not_all_argu ModelIssue( FunctionArgumentMappingIssue { data_connector_name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: DataConnectorName( Identifier( "myconnector", @@ -506,7 +526,9 @@ input_file: crates/metadata-resolve/tests/passing/models/issue_when_not_all_argu ), }, model_name: Qualified { - subgraph: "default", + subgraph: SubgraphName( + "default", + ), name: ModelName( Identifier( "collection_with_args", diff --git a/v3/crates/open-dds/metadata.jsonschema b/v3/crates/open-dds/metadata.jsonschema index ed332eecd95..cf64f65eaad 100644 --- a/v3/crates/open-dds/metadata.jsonschema +++ b/v3/crates/open-dds/metadata.jsonschema @@ -904,7 +904,8 @@ "type": [ "string", "null" - ] + ], + "pattern": "^(?!__)[_a-zA-Z][_a-zA-Z0-9]*$" } }, "additionalProperties": false @@ -2386,7 +2387,8 @@ "type": [ "string", "null" - ] + ], + "pattern": "^(?!__)[_a-zA-Z][_a-zA-Z0-9]*$" }, "relationshipType": { "description": "Type of the relationship - object or array.", diff --git a/v3/crates/open-dds/src/accessor.rs b/v3/crates/open-dds/src/accessor.rs index e310a35a331..4a824686110 100644 --- a/v3/crates/open-dds/src/accessor.rs +++ b/v3/crates/open-dds/src/accessor.rs @@ -1,23 +1,22 @@ use std::collections::HashSet; -use crate::identifier::SubgraphIdentifier; +use crate::identifier::SubgraphName; use crate::{ aggregates, boolean_expression, commands, data_connector, flags, graphql_config, models, order_by_expression, permissions, relationships, types, Metadata, MetadataWithVersion, OpenDdSubgraphObject, OpenDdSupergraphObject, }; -const GLOBALS_SUBGRAPH: SubgraphIdentifier = SubgraphIdentifier::new_inline_static("__globals"); -const UNKNOWN_SUBGRAPH: SubgraphIdentifier = - SubgraphIdentifier::new_inline_static("__unknown_namespace"); +const GLOBALS_SUBGRAPH: SubgraphName = SubgraphName::new_inline_static("__globals"); +const UNKNOWN_SUBGRAPH: SubgraphName = SubgraphName::new_inline_static("__unknown_namespace"); pub struct QualifiedObject { - pub subgraph: SubgraphIdentifier, + pub subgraph: SubgraphName, pub object: T, } impl QualifiedObject { - pub fn new(subgraph: &SubgraphIdentifier, object: T) -> Self { + pub fn new(subgraph: &SubgraphName, object: T) -> Self { QualifiedObject { subgraph: subgraph.clone(), object, @@ -28,7 +27,7 @@ impl QualifiedObject { const DEFAULT_FLAGS: flags::Flags = flags::Flags::new(); pub struct MetadataAccessor { - pub subgraphs: HashSet, + pub subgraphs: HashSet, pub data_connectors: Vec>, pub object_types: Vec>, pub object_boolean_expression_types: Vec>, @@ -51,7 +50,7 @@ pub struct MetadataAccessor { fn load_metadata_objects( metadata_objects: Vec, - subgraph: &SubgraphIdentifier, + subgraph: &SubgraphName, accessor: &mut MetadataAccessor, ) { accessor.subgraphs.insert(subgraph.clone()); @@ -170,8 +169,7 @@ impl MetadataAccessor { let mut accessor: MetadataAccessor = MetadataAccessor::new_empty(Some(metadata.flags)); for namespaced_metadata in metadata.namespaces { - let subgraph = - SubgraphIdentifier::new_without_validation(&namespaced_metadata.name); + let subgraph = SubgraphName::new_without_validation(&namespaced_metadata.name); load_metadata_objects(namespaced_metadata.objects, &subgraph, &mut accessor); } accessor @@ -183,7 +181,7 @@ impl MetadataAccessor { load_metadata_supergraph_object(supergraph_object, &mut accessor); } for subgraph in metadata.subgraphs { - load_metadata_objects(subgraph.objects, &subgraph.name, &mut accessor); + load_metadata_objects(subgraph.objects, &subgraph.name.into(), &mut accessor); } accessor } @@ -191,7 +189,7 @@ impl MetadataAccessor { let mut accessor: MetadataAccessor = MetadataAccessor::new_empty(Some(metadata.flags)); for subgraph in metadata.subgraphs { - load_metadata_objects(subgraph.objects, &subgraph.name, &mut accessor); + load_metadata_objects(subgraph.objects, &subgraph.name.into(), &mut accessor); } accessor } diff --git a/v3/crates/open-dds/src/aggregates.rs b/v3/crates/open-dds/src/aggregates.rs index e06eb45fa9c..55ed6aa645d 100644 --- a/v3/crates/open-dds/src/aggregates.rs +++ b/v3/crates/open-dds/src/aggregates.rs @@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize}; use crate::{ data_connector::{DataConnectorName, DataConnectorScalarType}, identifier::Identifier, - impl_JsonSchema_with_OpenDd_for, str_newtype, + str_newtype, types::{CustomTypeName, Deprecated, FieldName, GraphQlTypeName, TypeName, TypeReference}, }; @@ -157,41 +157,9 @@ pub struct AggregationFunctionDefinition { pub return_type: TypeReference, } -#[repr(transparent)] -#[derive( - Serialize, - Deserialize, - Clone, - Debug, - PartialEq, - Eq, - Hash, - ref_cast::RefCast, - derive_more::Display, - opendds_derive::OpenDd, -)] -/// The name of an aggregation function. -pub struct AggregationFunctionName(pub Identifier); +str_newtype!(AggregationFunctionName over Identifier | doc "The name of an aggregation function."); -impl_JsonSchema_with_OpenDd_for!(AggregationFunctionName); - -#[repr(transparent)] -#[derive( - Serialize, - Deserialize, - Clone, - Debug, - PartialEq, - Eq, - Hash, - ref_cast::RefCast, - derive_more::Display, - opendds_derive::OpenDd, -)] -/// The name of an aggregation function in a data connector -pub struct DataConnectorAggregationFunctionName(pub String); - -impl_JsonSchema_with_OpenDd_for!(DataConnectorAggregationFunctionName); +str_newtype!(DataConnectorAggregationFunctionName | doc "The name of an aggregation function in a data connector"); #[derive( Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, opendds_derive::OpenDd, diff --git a/v3/crates/open-dds/src/identifier.rs b/v3/crates/open-dds/src/identifier.rs index e51b1ae7947..679d0ef57d5 100644 --- a/v3/crates/open-dds/src/identifier.rs +++ b/v3/crates/open-dds/src/identifier.rs @@ -117,55 +117,24 @@ impl<'de> Deserialize<'de> for Identifier { } } -// Macro to produce a validated subgraph identifier using a string literal that crashes if the -// literal is invalid. Does not work for non-literal strings to avoid use on user supplied input. -#[macro_export] -macro_rules! subgraph_identifier { - ($name:literal) => { - open_dds::identifier::SubgraphIdentifier::new($name.to_string()).unwrap() - }; -} - -/// Type capturing a subgraph identifier used within the metadata. The wrapped String -/// is guaranteed to be a valid identifier, i.e. +/// Type capturing a subgraph identifier for a user defined subgraph. +/// The wrapped String is guaranteed to be a valid identifier, i.e. /// - does not start with __ /// - starts with an alphabet or underscore /// - all characters are either alphanumeric or underscore #[derive( - Clone, - Debug, - derive_more::Display, - PartialEq, - Eq, - PartialOrd, - Ord, - Hash, - serde::Serialize, - serde::Deserialize, + Clone, Debug, derive_more::Display, PartialEq, Eq, PartialOrd, Ord, Hash, serde::Serialize, )] -pub struct SubgraphIdentifier(SmolStr); +pub struct SubgraphNameInput(SmolStr); -impl SubgraphIdentifier { - pub fn new(value: impl AsRef) -> Result { +impl SubgraphNameInput { + pub fn new(value: impl AsRef) -> Result { let value = value.as_ref(); let Identifier(inner) = Identifier::new(value)?; if inner.starts_with("__") { return Err("__ is a reserved prefix for subgraph names"); } - Ok(SubgraphIdentifier(SmolStr::new(value))) - } - - /// Creates a new subgraph identifier, skipping validation. - pub fn new_without_validation(value: impl AsRef) -> SubgraphIdentifier { - SubgraphIdentifier(SmolStr::new(value)) - } - - /// Creates a new subgraph identifier from a static string, skipping - /// validation. - /// - /// Panics if the string is more than 23 characters. - pub const fn new_inline_static(value: &'static str) -> SubgraphIdentifier { - SubgraphIdentifier(SmolStr::new_inline(value)) + Ok(SubgraphNameInput(SmolStr::new(value))) } pub fn as_str(&self) -> &str { @@ -173,7 +142,7 @@ impl SubgraphIdentifier { } } -impl Deref for SubgraphIdentifier { +impl Deref for SubgraphNameInput { type Target = str; fn deref(&self) -> &Self::Target { @@ -181,20 +150,20 @@ impl Deref for SubgraphIdentifier { } } -impl std::borrow::Borrow for SubgraphIdentifier { +impl std::borrow::Borrow for SubgraphNameInput { fn borrow(&self) -> &str { &self.0 } } -impl OpenDd for SubgraphIdentifier { +impl OpenDd for SubgraphNameInput { fn deserialize(json: serde_json::Value) -> Result { let string: String = serde_json::from_value(json).map_err(|error| OpenDdDeserializeError { error, path: JSONPath::default(), })?; - SubgraphIdentifier::new(string).map_err(|e| OpenDdDeserializeError { + SubgraphNameInput::new(string).map_err(|e| OpenDdDeserializeError { error: serde_json::Error::custom(e), path: JSONPath::default(), }) @@ -214,7 +183,7 @@ impl OpenDd for SubgraphIdentifier { } fn _schema_name() -> String { - "SubgraphIdentifier".to_string() + "SubgraphNameInput".to_string() } fn _schema_is_referenceable() -> bool { @@ -223,3 +192,84 @@ impl OpenDd for SubgraphIdentifier { false } } + +impl<'de> Deserialize<'de> for SubgraphNameInput { + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + OpenDd::deserialize(serde_json::Value::deserialize(deserializer)?).map_err(D::Error::custom) + } +} + +impl_JsonSchema_with_OpenDd_for!(SubgraphNameInput); + +/// The name of a subgraph. +/// +/// This is different from 'SubgraphNameInput' which is more restrictive. +/// A SubgraphName may refer to a user defined subgraph (through 'SubgraphNameInput') or +/// a restricted namespace such as '__globals' or '__unknown_namespace' +/// +/// Further, it may not be a valid identifier as v2 version of Metadata did not do any validation +/// on namespaces. When we deprecate v2 version of metadata, this can switch to str_newtype over +/// Identifier +/// +/// This is also not meant to be used in any of the user facing metadata types, hence there is on +/// 'OpenDD' trait implementation. However, there is a 'JsonSchema' trait implementation to help +/// with query analytics +#[derive( + Clone, + Debug, + derive_more::Display, + PartialEq, + Eq, + PartialOrd, + Ord, + Hash, + serde::Serialize, + serde::Deserialize, + schemars::JsonSchema, +)] +pub struct SubgraphName(SmolStr); + +impl From for SubgraphName { + fn from(SubgraphNameInput(value): SubgraphNameInput) -> Self { + SubgraphName(value) + } +} + +impl From<&SubgraphNameInput> for SubgraphName { + fn from(SubgraphNameInput(value): &SubgraphNameInput) -> Self { + SubgraphName(value.clone()) + } +} + +impl SubgraphName { + pub fn try_new(value: impl AsRef) -> Result { + let value = value.as_ref(); + let Identifier(_inner) = Identifier::new(value)?; + Ok(SubgraphName(SmolStr::new(value))) + } + + /// Creates a new subgraph identifier, skipping validation. + pub fn new_without_validation(value: impl AsRef) -> SubgraphName { + SubgraphName(SmolStr::new(value)) + } + + /// Creates a new subgraph identifier from a static string, skipping + /// validation. + /// + /// Panics if the string is more than 23 characters. + pub const fn new_inline_static(value: &'static str) -> SubgraphName { + SubgraphName(SmolStr::new_inline(value)) + } +} + +// Macro to produce a validated subgraph identifier using a string literal that crashes if the +// literal is invalid. Does not work for non-literal strings to avoid use on user supplied input. +#[macro_export] +macro_rules! subgraph_identifier { + ($name:literal) => { + open_dds::identifier::SubgraphName::try_new($name.to_string()).unwrap() + }; +} diff --git a/v3/crates/open-dds/src/lib.rs b/v3/crates/open-dds/src/lib.rs index 548d80e7649..1d4333ed2e1 100644 --- a/v3/crates/open-dds/src/lib.rs +++ b/v3/crates/open-dds/src/lib.rs @@ -280,7 +280,7 @@ impl Supergraph { #[derive(Serialize, Clone, Debug, PartialEq, opendds_derive::OpenDd)] #[opendd(json_schema(rename = "OpenDdSubgraph"))] pub struct Subgraph { - pub name: identifier::SubgraphIdentifier, + pub name: identifier::SubgraphNameInput, pub objects: Vec, } diff --git a/v3/crates/open-dds/src/query.rs b/v3/crates/open-dds/src/query.rs index d3d2dde1af9..c7da6aa8069 100644 --- a/v3/crates/open-dds/src/query.rs +++ b/v3/crates/open-dds/src/query.rs @@ -6,7 +6,7 @@ use crate::{ aggregates::AggregationFunctionName, arguments::ArgumentName, commands::CommandName, - identifier::{Identifier, SubgraphIdentifier}, + identifier::{Identifier, SubgraphName}, models::{ModelName, OrderByDirection}, relationships::RelationshipName, str_newtype, @@ -119,7 +119,7 @@ pub struct RelationshipAggregateSelection { #[serde(rename_all = "camelCase")] /// The model lookup to target in a query. pub struct ModelTarget { - pub subgraph: SubgraphIdentifier, + pub subgraph: SubgraphName, pub model_name: ModelName, pub filter: Option, #[serde(default)] @@ -159,7 +159,7 @@ pub struct RelationshipTarget { #[serde(rename_all = "camelCase")] /// The command execution to to target in a query. pub struct CommandTarget { - pub subgraph: SubgraphIdentifier, + pub subgraph: SubgraphName, pub command_name: CommandName, #[serde(default)] pub arguments: IndexMap, diff --git a/v3/crates/open-dds/src/relationships.rs b/v3/crates/open-dds/src/relationships.rs index 1fc53d2d75a..edef0f49a4a 100644 --- a/v3/crates/open-dds/src/relationships.rs +++ b/v3/crates/open-dds/src/relationships.rs @@ -5,7 +5,7 @@ use crate::{ aggregates::AggregateExpressionName, arguments::ArgumentName, commands::CommandName, - identifier::Identifier, + identifier::{Identifier, SubgraphName, SubgraphNameInput}, impl_JsonSchema_with_OpenDd_for, models::ModelName, permissions::ValueExpression, @@ -35,7 +35,7 @@ pub struct ModelRelationshipTarget { /// The name of the data model. pub name: ModelName, /// The subgraph of the target model. Defaults to the current subgraph. - subgraph: Option, + subgraph: Option, /// Type of the relationship - object or array. pub relationship_type: RelationshipType, /// How to aggregate over the relationship. Only valid for array relationships @@ -46,8 +46,8 @@ pub struct ModelRelationshipTarget { impl_JsonSchema_with_OpenDd_for!(ModelRelationshipTarget); impl ModelRelationshipTarget { - pub fn subgraph(&self) -> Option<&str> { - self.subgraph.as_deref() + pub fn subgraph(&self) -> Option { + self.subgraph.as_ref().map(std::convert::Into::into) } } @@ -72,12 +72,12 @@ pub struct CommandRelationshipTarget { /// The name of the command. pub name: CommandName, /// The subgraph of the target command. Defaults to the current subgraph. - pub subgraph: Option, + pub subgraph: Option, } impl CommandRelationshipTarget { - pub fn subgraph(&self) -> Option<&str> { - self.subgraph.as_deref() + pub fn subgraph(&self) -> Option { + self.subgraph.as_ref().map(std::convert::Into::into) } } diff --git a/v3/crates/query-usage-analytics/query_usage_analytics.jsonschema b/v3/crates/query-usage-analytics/query_usage_analytics.jsonschema index 678d9087542..0d9befea312 100644 --- a/v3/crates/query-usage-analytics/query_usage_analytics.jsonschema +++ b/v3/crates/query-usage-analytics/query_usage_analytics.jsonschema @@ -246,13 +246,17 @@ ], "properties": { "subgraph": { - "type": "string" + "$ref": "#/definitions/SubgraphName" }, "name": { "$ref": "#/definitions/ModelName" } } }, + "SubgraphName": { + "description": "The name of a subgraph.\n\nThis is different from 'SubgraphNameInput' which is more restrictive. A SubgraphName may refer to a user defined subgraph (through 'SubgraphNameInput') or a restricted namespace such as '__globals' or '__unknown_namespace'\n\nFurther, it may not be a valid identifier as v2 version of Metadata did not do any validation on namespaces. When we deprecate v2 version of metadata, this can switch to str_newtype over Identifier\n\nThis is also not meant to be used in any of the user facing metadata types, hence there is on 'OpenDD' trait implementation. However, there is a 'JsonSchema' trait implementation to help with query analytics", + "type": "string" + }, "ModelName": { "$id": "https://hasura.io/jsonschemas/metadata/ModelName", "title": "ModelName", @@ -268,7 +272,7 @@ ], "properties": { "subgraph": { - "type": "string" + "$ref": "#/definitions/SubgraphName" }, "name": { "$ref": "#/definitions/CommandName" @@ -316,7 +320,7 @@ ], "properties": { "subgraph": { - "type": "string" + "$ref": "#/definitions/SubgraphName" }, "name": { "$ref": "#/definitions/CustomTypeName" diff --git a/v3/crates/query-usage-analytics/src/lib.rs b/v3/crates/query-usage-analytics/src/lib.rs index f101692c621..96fdd75c796 100644 --- a/v3/crates/query-usage-analytics/src/lib.rs +++ b/v3/crates/query-usage-analytics/src/lib.rs @@ -120,8 +120,8 @@ pub enum RelationshipTarget { mod tests { use super::*; use goldenfile::Mint; - use open_dds::identifier; use open_dds::relationships::RelationshipType; + use open_dds::{identifier, subgraph_identifier}; use schemars::schema_for; use std::{io::Write, path::PathBuf}; @@ -164,10 +164,13 @@ mod tests { */ let product_relationship = OpenddObject::Relationship(RelationshipUsage { name: RelationshipName::new(identifier!("product")), - source: Qualified::new("app".to_string(), CustomTypeName(identifier!("Order"))), + source: Qualified::new( + subgraph_identifier!("app"), + CustomTypeName(identifier!("Order")), + ), target: RelationshipTarget::Model { model_name: Qualified::new( - "app".to_string(), + subgraph_identifier!("app"), ModelName::new(identifier!("Products")), ), relationship_type: RelationshipType::Object, @@ -180,7 +183,7 @@ mod tests { used: vec![OpenddObject::Field(FieldUsage { name: FieldName::new(identifier!("id")), opendd_type: Qualified::new( - "app".to_string(), + subgraph_identifier!("app"), CustomTypeName(identifier!("Order")), ), deprecated: false, @@ -199,7 +202,7 @@ mod tests { used: vec![OpenddObject::Field(FieldUsage { name: FieldName::new(identifier!("price")), opendd_type: Qualified::new( - "app".to_string(), + subgraph_identifier!("app"), CustomTypeName(identifier!("Product")), ), deprecated: false, @@ -230,7 +233,7 @@ mod tests { used: vec![OpenddObject::Field(FieldUsage { name: FieldName::new(identifier!("price")), opendd_type: Qualified::new( - "app".to_string(), + subgraph_identifier!("app"), CustomTypeName(identifier!("Product")), ), deprecated: false, @@ -247,7 +250,7 @@ mod tests { used: vec![OpenddObject::Field(FieldUsage { name: FieldName::new(identifier!("quantity")), opendd_type: Qualified::new( - "app".to_string(), + subgraph_identifier!("app"), CustomTypeName(identifier!("Product")), ), deprecated: false, @@ -273,7 +276,7 @@ mod tests { used: vec![OpenddObject::Field(FieldUsage { name: FieldName::new(identifier!("quantity")), opendd_type: Qualified::new( - "app".to_string(), + subgraph_identifier!("app"), CustomTypeName(identifier!("Product")), ), deprecated: false, @@ -291,7 +294,7 @@ mod tests { used: vec![ OpenddObject::Model { name: Qualified::new( - "app".to_string(), + subgraph_identifier!("app"), ModelName::new(identifier!("Orders")), ), }, @@ -300,7 +303,7 @@ mod tests { fields: vec![FieldUsage { name: FieldName::new(identifier!("id")), opendd_type: Qualified::new( - "app".to_string(), + subgraph_identifier!("app"), CustomTypeName(identifier!("Order")), ), deprecated: false, @@ -316,7 +319,7 @@ mod tests { used: vec![OpenddObject::Field(FieldUsage { name: FieldName::new(identifier!("date")), opendd_type: Qualified::new( - "app".to_string(), + subgraph_identifier!("app"), CustomTypeName(identifier!("Order")), ), deprecated: false, @@ -337,7 +340,7 @@ mod tests { used: vec![OpenddObject::Field(FieldUsage { name: FieldName::new(identifier!("address_line_1")), opendd_type: Qualified::new( - "app".to_string(), + subgraph_identifier!("app"), CustomTypeName(identifier!("Address")), ), deprecated: false, @@ -351,7 +354,7 @@ mod tests { used: vec![OpenddObject::Field(FieldUsage { name: FieldName::new(identifier!("address_line_2")), opendd_type: Qualified::new( - "app".to_string(), + subgraph_identifier!("app"), CustomTypeName(identifier!("Address")), ), deprecated: false, @@ -361,7 +364,7 @@ mod tests { used: vec![OpenddObject::Field(FieldUsage { name: FieldName::new(identifier!("address")), opendd_type: Qualified::new( - "app".to_string(), + subgraph_identifier!("app"), CustomTypeName(identifier!("Order")), ), deprecated: false, @@ -378,7 +381,7 @@ mod tests { used: vec![OpenddObject::Field(FieldUsage { name: FieldName::new(identifier!("name")), opendd_type: Qualified::new( - "app".to_string(), + subgraph_identifier!("app"), CustomTypeName(identifier!("Product")), ), deprecated: false, diff --git a/v3/crates/schema/src/aggregates.rs b/v3/crates/schema/src/aggregates.rs index 83914d288ac..b675e6a90c6 100644 --- a/v3/crates/schema/src/aggregates.rs +++ b/v3/crates/schema/src/aggregates.rs @@ -271,7 +271,7 @@ fn add_aggregation_functions( aggregate_expression: &AggregateExpression, ) -> Result<(), Error> { for aggregatable_function_info in &aggregate_expression.operand.aggregation_functions { - let field_graphql_name = mk_name(aggregatable_function_info.name.0.as_str()) + let field_graphql_name = mk_name(aggregatable_function_info.name.as_str()) .map_err(metadata_resolve::Error::from)?; let field = gql_schema::Field::::new( diff --git a/v3/crates/sql/src/catalog.rs b/v3/crates/sql/src/catalog.rs index 9ff5e18dd33..a40583b8772 100644 --- a/v3/crates/sql/src/catalog.rs +++ b/v3/crates/sql/src/catalog.rs @@ -37,7 +37,7 @@ impl Catalog { let table_name = &model_name.name; let subgraph = subgraphs - .entry(schema_name.clone()) + .entry(schema_name.to_string()) .or_insert_with(|| subgraph::Subgraph { tables: IndexMap::new(), }); diff --git a/v3/crates/sql/src/catalog/introspection.rs b/v3/crates/sql/src/catalog/introspection.rs index 1af5f8168b1..2dfd24637e5 100644 --- a/v3/crates/sql/src/catalog/introspection.rs +++ b/v3/crates/sql/src/catalog/introspection.rs @@ -48,13 +48,13 @@ impl Introspection { for (schema_name, schema) in schemas { for (table_name, table) in &schema.tables { table_metadata_rows.push(TableRow::new( - schema_name.clone(), + schema_name.to_string(), table_name.to_string(), table.model.description.clone(), )); for (column_name, column_description) in &table.model.columns { column_metadata_rows.push(ColumnRow { - schema_name: schema_name.clone(), + schema_name: schema_name.to_string(), table_name: table_name.clone(), column_name: column_name.clone(), description: column_description.clone(), @@ -78,10 +78,10 @@ impl Introspection { { for mapping in mappings { foreign_key_constraint_rows.push(ForeignKeyRow { - from_schema_name: schema_name.clone(), + from_schema_name: schema_name.to_string(), from_table_name: table_name.clone(), from_column_name: mapping.source_field.field_name.to_string(), - to_schema_name: model_name.subgraph.clone(), + to_schema_name: model_name.subgraph.to_string(), to_table_name: model_name.name.to_string(), to_column_name: mapping.target_field.field_name.to_string(), }); diff --git a/v3/crates/sql/src/catalog/model.rs b/v3/crates/sql/src/catalog/model.rs index ebc489604c2..84ea40cdbd9 100644 --- a/v3/crates/sql/src/catalog/model.rs +++ b/v3/crates/sql/src/catalog/model.rs @@ -132,7 +132,7 @@ impl ModelWithPermissions { .map(|source| Arc::new(source.clone())); let model = Model { - subgraph: model.model.name.subgraph.clone(), + subgraph: model.model.name.subgraph.to_string(), name: model.model.name.name.clone(), description: model.model.raw.description.clone(), arguments: IndexMap::new(),