Skip to content

Commit

Permalink
fix(dojo-lang): ensure a model has at least one attribute that is not…
Browse files Browse the repository at this point in the history
… a key (dojoengine#1323)

fix: ensure a model has at least one attribute that is not a key
  • Loading branch information
glihm authored Dec 20, 2023
1 parent 90aeb26 commit e351f0f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/dojo-lang/src/introspect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,14 @@ fn handle_introspect_internal(
size.push(format!("{}", size_precompute));
}

if size.is_empty() {
panic!(
"The model `{}` has only keys, ensure you have at least one field without the #[key] \
attribute.",
name
);
}

RewriteNode::interpolate_patched(
"
impl $name$Introspect<$generics$> of \
Expand Down

0 comments on commit e351f0f

Please sign in to comment.