Skip to content

Commit

Permalink
fix(sdf): Ensure we match intrinsics schema variants as well as compo…
Browse files Browse the repository at this point in the history
…nents
  • Loading branch information
stack72 committed Dec 20, 2024
1 parent 7a8bc8b commit 31d379f
Showing 1 changed file with 13 additions and 21 deletions.
34 changes: 13 additions & 21 deletions lib/sdf-server/src/service/v2/func/binding/create_binding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,33 +97,25 @@ pub async fn create_binding(
Option<si_events::ComponentId>,
Option<si_events::SchemaVariantId>,
) = match eventual_parent {
Some(eventual_parent) => {
if let EventualParent::Component(component_id) = eventual_parent
{
(
Component::get_by_id(&ctx, component_id)
.await?
.name(&ctx)
.await?,
Some(component_id),
None,
)
} else {
return Err(FuncAPIError::MissingSchemaVariantAndFunc);
}
}
None => {
let schema_variant_id =
attribute_output_location.find_schema_variant(&ctx).await?;
(
Some(eventual_parent) => match eventual_parent {
EventualParent::SchemaVariant(schema_variant_id) => (
SchemaVariant::get_by_id_or_error(&ctx, schema_variant_id)
.await?
.display_name()
.to_string(),
None,
Some(schema_variant_id),
)
}
),
EventualParent::Component(component_id) => (
Component::get_by_id(&ctx, component_id)
.await?
.name(&ctx)
.await?,
Some(component_id),
None,
),
},
None => (String::new(), None, None),
};
let destination_name = attribute_output_location
.get_name_of_destination(&ctx)
Expand Down

0 comments on commit 31d379f

Please sign in to comment.