pub struct ResourceDefinition {
pub resource: String,
pub version: u32,
pub db: Option<String>,
pub tenant_key: Option<String>,
pub schema: IndexMap<String, FieldSchema>,
pub endpoints: Option<IndexMap<String, EndpointSpec>>,
pub relations: Option<IndexMap<String, RelationSpec>>,
pub indexes: Option<Vec<IndexSpec>>,
}Expand description
Complete definition of a Shaperail resource, parsed from a resource YAML file.
This is the central type that all codegen and runtime modules consume.
resource: users
version: 1
schema:
id: { type: uuid, primary: true, generated: true }
email: { type: string, format: email, unique: true, required: true }Fields§
§resource: StringSnake_case plural name of the resource (e.g., “users”).
version: u32Schema version number (starts at 1).
db: Option<String>Named database connection for this resource (M14). Default: “default”.
tenant_key: Option<String>Tenant isolation key (M18). References a schema field (must be type uuid)
that identifies the tenant. When set, all queries are automatically scoped
to the authenticated user’s tenant_id claim. super_admin bypasses the filter.
schema: IndexMap<String, FieldSchema>Field definitions, keyed by field name. Uses IndexMap to preserve declaration order.
endpoints: Option<IndexMap<String, EndpointSpec>>Endpoint definitions, keyed by action name (e.g., “list”, “create”).
relations: Option<IndexMap<String, RelationSpec>>Relationship definitions, keyed by relation name.
indexes: Option<Vec<IndexSpec>>Additional database indexes.
Trait Implementations§
Source§impl Clone for ResourceDefinition
impl Clone for ResourceDefinition
Source§fn clone(&self) -> ResourceDefinition
fn clone(&self) -> ResourceDefinition
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ResourceDefinition
impl Debug for ResourceDefinition
Source§impl<'de> Deserialize<'de> for ResourceDefinition
impl<'de> Deserialize<'de> for ResourceDefinition
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ResourceDefinition
impl PartialEq for ResourceDefinition
Source§impl Serialize for ResourceDefinition
impl Serialize for ResourceDefinition
impl StructuralPartialEq for ResourceDefinition
Auto Trait Implementations§
impl Freeze for ResourceDefinition
impl RefUnwindSafe for ResourceDefinition
impl Send for ResourceDefinition
impl Sync for ResourceDefinition
impl Unpin for ResourceDefinition
impl UnsafeUnpin for ResourceDefinition
impl UnwindSafe for ResourceDefinition
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more