reactive_graph_dynamic_graph_impl/field/entity/property/
field_arguments.rs

1use crate::field::to_input_type_ref;
2use async_graphql::dynamic::Field;
3use async_graphql::dynamic::InputValue;
4use reactive_graph_graph::EntityType;
5use reactive_graph_graph::PropertyTypeDefinition;
6use reactive_graph_runtime_model::LabeledProperties::LABEL;
7
8pub fn add_entity_type_properties_as_field_arguments(mut field: Field, entity_type: &EntityType, is_optional: bool, exclude_label: bool) -> Field {
9    for property in entity_type.properties.iter() {
10        if exclude_label && property.name == LABEL.property_name() {
11            continue;
12        }
13        if let Some(type_ref) = to_input_type_ref(property.value(), is_optional) {
14            field = field.argument(InputValue::new(&property.name, type_ref));
15        }
16    }
17    field
18}