pub struct LinkDefinition {
pub link_type: String,
pub source_type: String,
pub target_type: String,
pub forward_route_name: String,
pub reverse_route_name: String,
pub description: Option<String>,
pub required_fields: Option<Vec<String>>,
pub auth: Option<LinkAuthConfig>,
}Expand description
Configuration for a specific type of link between two entity types
This defines how entities can be related and how those relationships are exposed through the API
Fields§
§link_type: StringThe type of link (e.g., “owner”, “driver”)
source_type: StringThe source entity type (e.g., “user”)
target_type: StringThe target entity type (e.g., “car”)
forward_route_name: StringRoute name when navigating from source to target
Example: “cars-owned” → /users/{id}/cars-owned
reverse_route_name: StringRoute name when navigating from target to source
Example: “users-owners” → /cars/{id}/users-owners
description: Option<String>Optional description of this link type
required_fields: Option<Vec<String>>Optional list of required metadata fields
auth: Option<LinkAuthConfig>Authorization configuration specific to this link type
When specified, these permissions override entity-level link permissions. This allows different link types between the same entities to have different permission requirements.
Examples:
- order → invoice: create=service_only (auto-created by system)
- order → approval: create=owner (manually created by user)
Implementations§
Source§impl LinkDefinition
impl LinkDefinition
Sourcepub fn default_forward_route_name(target_type: &str, link_type: &str) -> String
pub fn default_forward_route_name(target_type: &str, link_type: &str) -> String
Generate the default forward route name
Format: {target_plural}-{link_type_plural} Example: “cars-owned” for (target=“car”, link_type=“owner”)
Sourcepub fn default_reverse_route_name(source_type: &str, link_type: &str) -> String
pub fn default_reverse_route_name(source_type: &str, link_type: &str) -> String
Generate the default reverse route name
Format: {source_plural}-{link_type_plural} Example: “users-owners” for (source=“user”, link_type=“owner”)
Trait Implementations§
Source§impl Clone for LinkDefinition
impl Clone for LinkDefinition
Source§fn clone(&self) -> LinkDefinition
fn clone(&self) -> LinkDefinition
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more