mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 01:12:56 +03:00
rename data_connector_type_mappings
stage to object_types
(#533)
<!-- Thank you for submitting this PR! :) --> ## Description We named this stage after the least interesting thing about it, this resolves that. `data_connector_type_mappings` -> `object_types`. Functional no-op. V3_GIT_ORIGIN_REV_ID: 67c94356cc7207e94eb3b696abbd32efe31551ac
This commit is contained in:
parent
ba5d0e3e8f
commit
4f2a29b9cf
@ -13,15 +13,15 @@ pub use stages::boolean_expressions::{
|
||||
};
|
||||
pub use stages::command_permissions::CommandWithPermissions;
|
||||
pub use stages::commands::Command;
|
||||
pub use stages::data_connector_type_mappings::{
|
||||
FieldMapping, ObjectTypeRepresentation, ResolvedObjectApolloFederationConfig, TypeMapping,
|
||||
};
|
||||
pub use stages::data_connectors::DataConnectorLink;
|
||||
pub use stages::model_permissions::{FilterPermission, ModelPredicate, ModelWithPermissions};
|
||||
pub use stages::models::{
|
||||
Model, ModelOrderByExpression, ModelSource, SelectManyGraphQlDefinition,
|
||||
SelectUniqueGraphQlDefinition,
|
||||
};
|
||||
pub use stages::object_types::{
|
||||
FieldMapping, ObjectTypeRepresentation, ResolvedObjectApolloFederationConfig, TypeMapping,
|
||||
};
|
||||
pub use stages::relationships::{
|
||||
relationship_execution_category, ObjectTypeWithRelationships, Relationship,
|
||||
RelationshipCapabilities, RelationshipCommandMapping, RelationshipExecutionCategory,
|
||||
|
@ -6,8 +6,8 @@ use crate::metadata::resolved::helpers::types::{
|
||||
TypeRepresentation,
|
||||
};
|
||||
use crate::metadata::resolved::stages::{
|
||||
boolean_expressions, data_connector_scalar_types, data_connector_type_mappings,
|
||||
model_permissions, relationships, scalar_types, type_permissions,
|
||||
boolean_expressions, data_connector_scalar_types, model_permissions, object_types,
|
||||
relationships, scalar_types, type_permissions,
|
||||
};
|
||||
use crate::metadata::resolved::types::error::{
|
||||
Error, TypeError, TypeMappingValidationError, TypePredicateError,
|
||||
@ -219,9 +219,7 @@ pub(crate) fn resolve_value_expression_for_argument(
|
||||
&boolean_expression_type.data_connector_object_type,
|
||||
)
|
||||
.map(|type_mapping| match type_mapping {
|
||||
data_connector_type_mappings::TypeMapping::Object {
|
||||
field_mappings, ..
|
||||
} => field_mappings,
|
||||
object_types::TypeMapping::Object { field_mappings, .. } => field_mappings,
|
||||
})
|
||||
.ok_or(Error::DataConnectorTypeMappingValidationError {
|
||||
type_name: base_type.clone(),
|
||||
@ -258,11 +256,11 @@ pub(crate) fn resolve_value_expression_for_argument(
|
||||
pub(crate) fn resolve_model_predicate_with_type(
|
||||
model_predicate: &permissions::ModelPredicate,
|
||||
type_name: &Qualified<CustomTypeName>,
|
||||
data_connector_field_mappings: &BTreeMap<FieldName, data_connector_type_mappings::FieldMapping>,
|
||||
data_connector_field_mappings: &BTreeMap<FieldName, object_types::FieldMapping>,
|
||||
data_connector_name: &Qualified<DataConnectorName>,
|
||||
subgraph: &str,
|
||||
data_connectors: &data_connector_scalar_types::DataConnectorsWithScalars,
|
||||
fields: &IndexMap<FieldName, data_connector_type_mappings::FieldDefinition>,
|
||||
fields: &IndexMap<FieldName, object_types::FieldDefinition>,
|
||||
) -> Result<model_permissions::ModelPredicate, Error> {
|
||||
match model_predicate {
|
||||
permissions::ModelPredicate::FieldComparison(permissions::FieldComparisonPredicate {
|
||||
@ -418,7 +416,7 @@ fn resolve_binary_operator_for_type(
|
||||
type_name: &Qualified<CustomTypeName>,
|
||||
data_connector: &Qualified<DataConnectorName>,
|
||||
field_name: &FieldName,
|
||||
fields: &IndexMap<FieldName, data_connector_type_mappings::FieldDefinition>,
|
||||
fields: &IndexMap<FieldName, object_types::FieldDefinition>,
|
||||
scalars: &HashMap<&str, data_connector_scalar_types::ScalarTypeWithRepresentationInfo>,
|
||||
ndc_scalar_type: &ndc_models::ScalarType,
|
||||
subgraph: &str,
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::metadata::resolved::stages::{commands, data_connector_type_mappings, models};
|
||||
use crate::metadata::resolved::stages::{commands, models, object_types};
|
||||
use ndc_models;
|
||||
use open_dds::{
|
||||
commands::{CommandName, DataConnectorCommand, FunctionName, ProcedureName},
|
||||
@ -168,7 +168,7 @@ pub fn validate_ndc(
|
||||
NDCValidationError::NoSuchType(collection.collection_type.clone()),
|
||||
)?;
|
||||
|
||||
let data_connector_type_mappings::TypeMapping::Object { field_mappings, .. } = model_source
|
||||
let object_types::TypeMapping::Object { field_mappings, .. } = model_source
|
||||
.type_mappings
|
||||
.get(&model.data_type)
|
||||
.ok_or_else(|| NDCValidationError::UnknownModelTypeMapping {
|
||||
@ -330,9 +330,7 @@ pub fn validate_ndc_command(
|
||||
// Check if the command.output_type is available in schema.object_types
|
||||
Some(command_source_ndc_type) => {
|
||||
// Check if the command.output_type has typeMappings
|
||||
let data_connector_type_mappings::TypeMapping::Object {
|
||||
field_mappings, ..
|
||||
} = command_source
|
||||
let object_types::TypeMapping::Object { field_mappings, .. } = command_source
|
||||
.type_mappings
|
||||
.get(custom_type)
|
||||
.ok_or_else(|| NDCValidationError::UnknownCommandTypeMapping {
|
||||
|
@ -1,6 +1,4 @@
|
||||
use crate::metadata::resolved::stages::{
|
||||
data_connector_type_mappings, scalar_types, type_permissions,
|
||||
};
|
||||
use crate::metadata::resolved::stages::{object_types, scalar_types, type_permissions};
|
||||
|
||||
use crate::metadata::resolved::helpers::ndc_validation::{
|
||||
get_underlying_named_type, NDCValidationError,
|
||||
@ -53,10 +51,7 @@ pub(crate) fn collect_type_mapping_for_source(
|
||||
data_connector_name: &Qualified<DataConnectorName>,
|
||||
object_types: &HashMap<Qualified<CustomTypeName>, type_permissions::ObjectTypeWithPermissions>,
|
||||
scalar_types: &HashMap<Qualified<CustomTypeName>, scalar_types::ScalarTypeRepresentation>,
|
||||
collected_mappings: &mut BTreeMap<
|
||||
Qualified<CustomTypeName>,
|
||||
data_connector_type_mappings::TypeMapping,
|
||||
>,
|
||||
collected_mappings: &mut BTreeMap<Qualified<CustomTypeName>, object_types::TypeMapping>,
|
||||
) -> Result<(), TypeMappingCollectionError> {
|
||||
match object_types.get(mapping_to_collect.type_name) {
|
||||
Some(object_type_representation) => {
|
||||
@ -73,7 +68,7 @@ pub(crate) fn collect_type_mapping_for_source(
|
||||
if let Some(inserted_mapping) = collected_mappings
|
||||
.insert(mapping_to_collect.type_name.clone(), type_mapping.clone())
|
||||
{
|
||||
let data_connector_type_mappings::TypeMapping::Object {
|
||||
let object_types::TypeMapping::Object {
|
||||
ndc_object_type_name,
|
||||
..
|
||||
} = inserted_mapping;
|
||||
@ -90,8 +85,7 @@ pub(crate) fn collect_type_mapping_for_source(
|
||||
}
|
||||
}
|
||||
|
||||
let data_connector_type_mappings::TypeMapping::Object { field_mappings, .. } =
|
||||
type_mapping;
|
||||
let object_types::TypeMapping::Object { field_mappings, .. } = type_mapping;
|
||||
// For each field in the ObjectType, if that field is using an ObjectType in its type,
|
||||
// resolve the type mappings for that ObjectType too
|
||||
for (field_name, field_definition) in &object_type_representation.object_type.fields {
|
||||
|
@ -1,7 +1,7 @@
|
||||
pub mod types;
|
||||
use crate::metadata::resolved::stages::{
|
||||
data_connector_scalar_types, data_connector_type_mappings, data_connectors, graphql_config,
|
||||
scalar_types, type_permissions,
|
||||
data_connector_scalar_types, data_connectors, graphql_config, object_types, scalar_types,
|
||||
type_permissions,
|
||||
};
|
||||
use crate::metadata::resolved::types::error::{BooleanExpressionError, Error, GraphqlConfigError};
|
||||
|
||||
@ -272,7 +272,7 @@ pub fn resolve_boolean_expression_info(
|
||||
where_type_name: ast::TypeName,
|
||||
subgraph: &str,
|
||||
data_connectors: &data_connector_scalar_types::DataConnectorsWithScalars,
|
||||
type_mappings: &data_connector_type_mappings::TypeMapping,
|
||||
type_mappings: &object_types::TypeMapping,
|
||||
graphql_config: &graphql_config::GraphqlConfig,
|
||||
) -> Result<BooleanExpressionInfo, Error> {
|
||||
let mut scalar_fields = HashMap::new();
|
||||
@ -289,7 +289,7 @@ pub fn resolve_boolean_expression_info(
|
||||
})?
|
||||
.scalars;
|
||||
|
||||
let data_connector_type_mappings::TypeMapping::Object { field_mappings, .. } = type_mappings;
|
||||
let object_types::TypeMapping::Object { field_mappings, .. } = type_mappings;
|
||||
|
||||
let filter_graphql_config = graphql_config
|
||||
.query
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::metadata::resolved::stages::{data_connector_type_mappings, data_connectors};
|
||||
use crate::metadata::resolved::stages::{data_connectors, object_types};
|
||||
|
||||
use crate::metadata::resolved::types::subgraph::{Qualified, QualifiedTypeReference};
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
@ -24,10 +24,8 @@ pub struct ObjectBooleanExpressionType {
|
||||
pub data_connector_name: Qualified<DataConnectorName>,
|
||||
pub data_connector_link: data_connectors::DataConnectorLink,
|
||||
pub data_connector_object_type: String,
|
||||
pub type_mappings: BTreeMap<
|
||||
Qualified<open_dds::types::CustomTypeName>,
|
||||
data_connector_type_mappings::TypeMapping,
|
||||
>,
|
||||
pub type_mappings:
|
||||
BTreeMap<Qualified<open_dds::types::CustomTypeName>, object_types::TypeMapping>,
|
||||
pub graphql: Option<BooleanExpressionInfo>,
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::metadata::resolved::stages::{data_connector_type_mappings, data_connectors};
|
||||
use crate::metadata::resolved::stages::{data_connectors, object_types};
|
||||
use crate::metadata::resolved::types::subgraph::{
|
||||
deserialize_qualified_btreemap, serialize_qualified_btreemap, ArgumentInfo, Qualified,
|
||||
QualifiedTypeReference,
|
||||
@ -28,8 +28,7 @@ pub struct CommandSource {
|
||||
serialize_with = "serialize_qualified_btreemap",
|
||||
deserialize_with = "deserialize_qualified_btreemap"
|
||||
)]
|
||||
pub type_mappings:
|
||||
BTreeMap<Qualified<CustomTypeName>, data_connector_type_mappings::TypeMapping>,
|
||||
pub type_mappings: BTreeMap<Qualified<CustomTypeName>, object_types::TypeMapping>,
|
||||
pub argument_mappings: HashMap<ArgumentName, String>,
|
||||
}
|
||||
|
||||
|
@ -4,11 +4,11 @@ pub mod command_permissions;
|
||||
pub mod commands;
|
||||
/// This is where we'll be moving explicit metadata resolve stages
|
||||
pub mod data_connector_scalar_types;
|
||||
pub mod data_connector_type_mappings;
|
||||
pub mod data_connectors;
|
||||
pub mod graphql_config;
|
||||
pub mod model_permissions;
|
||||
pub mod models;
|
||||
pub mod object_types;
|
||||
pub mod relationships;
|
||||
pub mod roles;
|
||||
pub mod scalar_types;
|
||||
@ -31,12 +31,12 @@ pub fn resolve(metadata: open_dds::Metadata) -> Result<Metadata, Error> {
|
||||
|
||||
let data_connectors = data_connectors::resolve(&metadata_accessor)?;
|
||||
|
||||
let data_connector_type_mappings::DataConnectorTypeMappingsOutput {
|
||||
let object_types::DataConnectorTypeMappingsOutput {
|
||||
graphql_types,
|
||||
global_id_enabled_types,
|
||||
apollo_federation_entity_enabled_types,
|
||||
object_types,
|
||||
} = data_connector_type_mappings::resolve(&metadata_accessor, &data_connectors)?;
|
||||
} = object_types::resolve(&metadata_accessor, &data_connectors)?;
|
||||
|
||||
let scalar_types::ScalarTypesOutput {
|
||||
scalar_types,
|
||||
|
@ -1,8 +1,7 @@
|
||||
mod types;
|
||||
use crate::metadata::resolved::helpers::typecheck;
|
||||
use crate::metadata::resolved::stages::{
|
||||
boolean_expressions, data_connector_scalar_types, data_connector_type_mappings, models,
|
||||
relationships,
|
||||
boolean_expressions, data_connector_scalar_types, models, object_types, relationships,
|
||||
};
|
||||
use crate::metadata::resolved::types::permission::ValueExpression;
|
||||
use indexmap::IndexMap;
|
||||
@ -144,7 +143,7 @@ fn resolve_model_predicate(
|
||||
model: &models::Model,
|
||||
subgraph: &str,
|
||||
data_connectors: &data_connector_scalar_types::DataConnectorsWithScalars,
|
||||
fields: &IndexMap<FieldName, data_connector_type_mappings::FieldDefinition>,
|
||||
fields: &IndexMap<FieldName, object_types::FieldDefinition>,
|
||||
object_types: &HashMap<Qualified<CustomTypeName>, relationships::ObjectTypeWithRelationships>,
|
||||
models: &IndexMap<Qualified<ModelName>, models::Model>,
|
||||
) -> Result<ModelPredicate, Error> {
|
||||
@ -160,14 +159,14 @@ fn resolve_model_predicate(
|
||||
// TODO: resolve the "in" operator too (ndc_models::BinaryArrayComparisonOperator)
|
||||
if let Some(model_source) = &model.source {
|
||||
// Get field mappings of model data type
|
||||
let data_connector_type_mappings::TypeMapping::Object { field_mappings, .. } =
|
||||
model_source.type_mappings.get(&model.data_type).ok_or(
|
||||
Error::TypeMappingRequired {
|
||||
model_name: model.name.clone(),
|
||||
type_name: model.data_type.clone(),
|
||||
data_connector: model_source.data_connector.name.clone(),
|
||||
},
|
||||
)?;
|
||||
let object_types::TypeMapping::Object { field_mappings, .. } = model_source
|
||||
.type_mappings
|
||||
.get(&model.data_type)
|
||||
.ok_or(Error::TypeMappingRequired {
|
||||
model_name: model.name.clone(),
|
||||
type_name: model.data_type.clone(),
|
||||
data_connector: model_source.data_connector.name.clone(),
|
||||
})?;
|
||||
|
||||
// Determine field_mapping for the predicate field
|
||||
let field_mapping = field_mappings.get(field).ok_or_else(|| {
|
||||
@ -239,14 +238,14 @@ fn resolve_model_predicate(
|
||||
open_dds::permissions::ModelPredicate::FieldIsNull(FieldIsNullPredicate { field }) => {
|
||||
if let Some(model_source) = &model.source {
|
||||
// Get field mappings of model data type
|
||||
let data_connector_type_mappings::TypeMapping::Object { field_mappings, .. } =
|
||||
model_source.type_mappings.get(&model.data_type).ok_or(
|
||||
Error::TypeMappingRequired {
|
||||
model_name: model.name.clone(),
|
||||
type_name: model.data_type.clone(),
|
||||
data_connector: model_source.data_connector.name.clone(),
|
||||
},
|
||||
)?;
|
||||
let object_types::TypeMapping::Object { field_mappings, .. } = model_source
|
||||
.type_mappings
|
||||
.get(&model.data_type)
|
||||
.ok_or(Error::TypeMappingRequired {
|
||||
model_name: model.name.clone(),
|
||||
type_name: model.data_type.clone(),
|
||||
data_connector: model_source.data_connector.name.clone(),
|
||||
})?;
|
||||
// Determine field_mapping for the predicate field
|
||||
let field_mapping = field_mappings.get(field).ok_or_else(|| {
|
||||
Error::UnknownFieldInSelectPermissionsDefinition {
|
||||
@ -434,7 +433,7 @@ fn resolve_binary_operator_for_model(
|
||||
model_name: &Qualified<ModelName>,
|
||||
data_connector: &Qualified<DataConnectorName>,
|
||||
field_name: &FieldName,
|
||||
fields: &IndexMap<FieldName, data_connector_type_mappings::FieldDefinition>,
|
||||
fields: &IndexMap<FieldName, object_types::FieldDefinition>,
|
||||
scalars: &HashMap<&str, data_connector_scalar_types::ScalarTypeWithRepresentationInfo>,
|
||||
ndc_scalar_type: &ndc_models::ScalarType,
|
||||
subgraph: &str,
|
||||
|
@ -14,8 +14,8 @@ use crate::metadata::resolved::helpers::type_mappings;
|
||||
use crate::metadata::resolved::helpers::types::NdcColumnForComparison;
|
||||
use crate::metadata::resolved::helpers::types::{mk_name, store_new_graphql_type};
|
||||
use crate::metadata::resolved::stages::{
|
||||
boolean_expressions, data_connector_scalar_types, data_connector_type_mappings,
|
||||
data_connectors, graphql_config, scalar_types, type_permissions,
|
||||
boolean_expressions, data_connector_scalar_types, data_connectors, graphql_config,
|
||||
object_types, scalar_types, type_permissions,
|
||||
};
|
||||
use crate::metadata::resolved::types::subgraph::{
|
||||
mk_qualified_type_reference, ArgumentInfo, Qualified,
|
||||
@ -179,7 +179,7 @@ fn resolve_filter_expression_type(
|
||||
|
||||
fn resolve_orderable_fields(
|
||||
model: &ModelV1,
|
||||
type_fields: &IndexMap<FieldName, data_connector_type_mappings::FieldDefinition>,
|
||||
type_fields: &IndexMap<FieldName, object_types::FieldDefinition>,
|
||||
) -> Result<Vec<OrderableField>, Error> {
|
||||
for field in &model.orderable_fields {
|
||||
// Check for unknown orderable field
|
||||
@ -452,16 +452,14 @@ fn resolve_model_graphql_api(
|
||||
)?;
|
||||
order_by_expression_type_name
|
||||
.map(|order_by_type_name| {
|
||||
let data_connector_type_mappings::TypeMapping::Object {
|
||||
field_mappings,
|
||||
..
|
||||
} = model_source.type_mappings.get(&model.data_type).ok_or(
|
||||
Error::TypeMappingRequired {
|
||||
let object_types::TypeMapping::Object { field_mappings, .. } = model_source
|
||||
.type_mappings
|
||||
.get(&model.data_type)
|
||||
.ok_or(Error::TypeMappingRequired {
|
||||
model_name: model_name.clone(),
|
||||
type_name: model.data_type.clone(),
|
||||
data_connector: model_source.data_connector.name.clone(),
|
||||
},
|
||||
)?;
|
||||
})?;
|
||||
|
||||
let mut order_by_fields = HashMap::new();
|
||||
for (field_name, field_mapping) in field_mappings.iter() {
|
||||
@ -757,7 +755,7 @@ pub(crate) fn get_ndc_column_for_comparison<F: Fn() -> String>(
|
||||
comparison_location: F,
|
||||
) -> Result<NdcColumnForComparison, Error> {
|
||||
// Get field mappings of model data type
|
||||
let data_connector_type_mappings::TypeMapping::Object { field_mappings, .. } = model_source
|
||||
let object_types::TypeMapping::Object { field_mappings, .. } = model_source
|
||||
.type_mappings
|
||||
.get(model_data_type)
|
||||
.ok_or(Error::TypeMappingRequired {
|
||||
|
@ -1,7 +1,5 @@
|
||||
use crate::metadata::resolved::helpers::types::NdcColumnForComparison;
|
||||
use crate::metadata::resolved::stages::{
|
||||
boolean_expressions, data_connector_type_mappings, data_connectors,
|
||||
};
|
||||
use crate::metadata::resolved::stages::{boolean_expressions, data_connectors, object_types};
|
||||
use crate::metadata::resolved::types::subgraph::{
|
||||
deserialize_qualified_btreemap, serialize_qualified_btreemap, ArgumentInfo, Qualified,
|
||||
QualifiedTypeReference,
|
||||
@ -95,8 +93,7 @@ pub struct ModelSource {
|
||||
serialize_with = "serialize_qualified_btreemap",
|
||||
deserialize_with = "deserialize_qualified_btreemap"
|
||||
)]
|
||||
pub type_mappings:
|
||||
BTreeMap<Qualified<CustomTypeName>, data_connector_type_mappings::TypeMapping>,
|
||||
pub type_mappings: BTreeMap<Qualified<CustomTypeName>, object_types::TypeMapping>,
|
||||
pub argument_mappings: HashMap<ArgumentName, String>,
|
||||
}
|
||||
|
||||
@ -104,7 +101,7 @@ pub struct ModelSource {
|
||||
pub struct Model {
|
||||
pub name: Qualified<ModelName>,
|
||||
pub data_type: Qualified<CustomTypeName>,
|
||||
pub type_fields: IndexMap<FieldName, data_connector_type_mappings::FieldDefinition>,
|
||||
pub type_fields: IndexMap<FieldName, object_types::FieldDefinition>,
|
||||
pub global_id_fields: Vec<FieldName>,
|
||||
pub arguments: IndexMap<ArgumentName, ArgumentInfo>,
|
||||
pub graphql_api: ModelGraphQlApi,
|
||||
|
@ -63,7 +63,7 @@ impl DataConnectorTypeMappingsForObject {
|
||||
}
|
||||
}
|
||||
|
||||
/// output of `data_connector_type_mappings` step
|
||||
/// output of `object_types` step
|
||||
pub struct DataConnectorTypeMappingsOutput {
|
||||
pub graphql_types: HashSet<ast::TypeName>,
|
||||
pub global_id_enabled_types: HashMap<Qualified<CustomTypeName>, Vec<Qualified<ModelName>>>,
|
@ -16,8 +16,7 @@ use crate::metadata::resolved::types::subgraph::Qualified;
|
||||
|
||||
use crate::metadata::resolved::helpers::types::mk_name;
|
||||
use crate::metadata::resolved::stages::{
|
||||
commands, data_connector_scalar_types, data_connector_type_mappings, data_connectors, models,
|
||||
type_permissions,
|
||||
commands, data_connector_scalar_types, data_connectors, models, object_types, type_permissions,
|
||||
};
|
||||
|
||||
use open_dds::relationships::{self, FieldAccess, RelationshipName, RelationshipV1};
|
||||
@ -123,7 +122,7 @@ pub fn relationship_execution_category(
|
||||
fn resolve_relationship_source_mapping<'a>(
|
||||
relationship_name: &'a RelationshipName,
|
||||
source_type_name: &'a Qualified<CustomTypeName>,
|
||||
source_type: &data_connector_type_mappings::ObjectTypeRepresentation,
|
||||
source_type: &object_types::ObjectTypeRepresentation,
|
||||
relationship_mapping: &'a open_dds::relationships::RelationshipMapping,
|
||||
) -> Result<&'a FieldAccess, Error> {
|
||||
match &relationship_mapping.source {
|
||||
@ -160,7 +159,7 @@ fn resolve_relationship_source_mapping<'a>(
|
||||
fn resolve_relationship_mappings_model(
|
||||
relationship: &RelationshipV1,
|
||||
source_type_name: &Qualified<CustomTypeName>,
|
||||
source_type: &data_connector_type_mappings::ObjectTypeRepresentation,
|
||||
source_type: &object_types::ObjectTypeRepresentation,
|
||||
target_model: &models::Model,
|
||||
data_connectors: &data_connector_scalar_types::DataConnectorsWithScalars,
|
||||
) -> Result<Vec<RelationshipModelMapping>, Error> {
|
||||
@ -264,7 +263,7 @@ fn resolve_relationship_mappings_model(
|
||||
fn resolve_relationship_mappings_command(
|
||||
relationship: &RelationshipV1,
|
||||
source_type_name: &Qualified<CustomTypeName>,
|
||||
source_type: &data_connector_type_mappings::ObjectTypeRepresentation,
|
||||
source_type: &object_types::ObjectTypeRepresentation,
|
||||
target_command: &commands::Command,
|
||||
) -> Result<Vec<RelationshipCommandMapping>, Error> {
|
||||
let mut resolved_relationship_mappings = Vec::new();
|
||||
@ -391,7 +390,7 @@ pub fn resolve_relationship(
|
||||
models: &IndexMap<Qualified<ModelName>, models::Model>,
|
||||
commands: &IndexMap<Qualified<CommandName>, commands::Command>,
|
||||
data_connectors: &data_connector_scalar_types::DataConnectorsWithScalars,
|
||||
source_type: &data_connector_type_mappings::ObjectTypeRepresentation,
|
||||
source_type: &object_types::ObjectTypeRepresentation,
|
||||
) -> Result<Relationship, Error> {
|
||||
let source_type_name = Qualified::new(subgraph.to_string(), relationship.source_type.clone());
|
||||
let (relationship_target, source_data_connector, target_name) = match &relationship.target {
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::metadata::resolved::stages::{data_connector_type_mappings, type_permissions};
|
||||
use crate::metadata::resolved::stages::{object_types, type_permissions};
|
||||
use crate::metadata::resolved::types::subgraph::{Qualified, QualifiedTypeReference};
|
||||
use indexmap::IndexMap;
|
||||
use open_dds::permissions::Role;
|
||||
@ -16,7 +16,7 @@ use open_dds::types::Deprecated;
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, derive_more::Display)]
|
||||
#[display(fmt = "Display")]
|
||||
pub struct ObjectTypeWithRelationships {
|
||||
pub object_type: data_connector_type_mappings::ObjectTypeRepresentation,
|
||||
pub object_type: object_types::ObjectTypeRepresentation,
|
||||
/// permissions on this type, when it is used in an output context (e.g. as
|
||||
/// a return type of Model or Command)
|
||||
pub type_output_permissions: HashMap<Role, open_dds::permissions::TypeOutputPermission>,
|
||||
@ -26,7 +26,7 @@ pub struct ObjectTypeWithRelationships {
|
||||
/// any relationships defined on this object
|
||||
pub relationships: IndexMap<ast::Name, Relationship>,
|
||||
/// type mappings for each data connector
|
||||
pub type_mappings: data_connector_type_mappings::DataConnectorTypeMappingsForObject,
|
||||
pub type_mappings: object_types::DataConnectorTypeMappingsForObject,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||
|
@ -11,7 +11,7 @@ use crate::metadata::resolved::types::error::Error;
|
||||
use crate::metadata::resolved::types::subgraph::Qualified;
|
||||
|
||||
use crate::metadata::resolved::helpers::typecheck;
|
||||
use crate::metadata::resolved::stages::data_connector_type_mappings;
|
||||
use crate::metadata::resolved::stages::object_types;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, derive_more::Display)]
|
||||
@ -23,7 +23,7 @@ pub struct TypeInputPermission {
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, derive_more::Display)]
|
||||
#[display(fmt = "Display")]
|
||||
pub struct ObjectTypeWithPermissions {
|
||||
pub object_type: data_connector_type_mappings::ObjectTypeRepresentation,
|
||||
pub object_type: object_types::ObjectTypeRepresentation,
|
||||
/// permissions on this type, when it is used in an output context (e.g. as
|
||||
/// a return type of Model or Command)
|
||||
pub type_output_permissions: HashMap<Role, TypeOutputPermission>,
|
||||
@ -31,16 +31,13 @@ pub struct ObjectTypeWithPermissions {
|
||||
/// an argument type of Model or Command)
|
||||
pub type_input_permissions: HashMap<Role, TypeInputPermission>,
|
||||
/// type mappings for each data connector
|
||||
pub type_mappings: data_connector_type_mappings::DataConnectorTypeMappingsForObject,
|
||||
pub type_mappings: object_types::DataConnectorTypeMappingsForObject,
|
||||
}
|
||||
|
||||
/// resolve type permissions
|
||||
pub fn resolve(
|
||||
metadata_accessor: &open_dds::accessor::MetadataAccessor,
|
||||
object_types: &HashMap<
|
||||
Qualified<CustomTypeName>,
|
||||
data_connector_type_mappings::ObjectTypeWithTypeMappings,
|
||||
>,
|
||||
object_types: &HashMap<Qualified<CustomTypeName>, object_types::ObjectTypeWithTypeMappings>,
|
||||
) -> Result<HashMap<Qualified<CustomTypeName>, ObjectTypeWithPermissions>, Error> {
|
||||
let mut object_types_with_permissions = HashMap::new();
|
||||
for (object_type_name, object_type) in object_types {
|
||||
@ -87,7 +84,7 @@ pub fn resolve(
|
||||
}
|
||||
|
||||
pub fn resolve_output_type_permission(
|
||||
object_type_representation: &data_connector_type_mappings::ObjectTypeRepresentation,
|
||||
object_type_representation: &object_types::ObjectTypeRepresentation,
|
||||
type_permissions: &TypePermissionsV1,
|
||||
) -> Result<HashMap<Role, TypeOutputPermission>, Error> {
|
||||
let mut resolved_type_permissions = HashMap::new();
|
||||
@ -118,7 +115,7 @@ pub fn resolve_output_type_permission(
|
||||
}
|
||||
|
||||
pub(crate) fn resolve_input_type_permission(
|
||||
object_type_representation: &data_connector_type_mappings::ObjectTypeRepresentation,
|
||||
object_type_representation: &object_types::ObjectTypeRepresentation,
|
||||
type_permissions: &TypePermissionsV1,
|
||||
) -> Result<HashMap<Role, TypeInputPermission>, Error> {
|
||||
let mut resolved_type_permissions = HashMap::new();
|
||||
|
Loading…
Reference in New Issue
Block a user