Support setting referent properties via attributes (#843)

Co-authored-by: Kenneth Loeffler <kenloef@gmail.com>
This commit is contained in:
Micah 2024-06-20 15:48:52 -07:00 • committed by GitHub
parent a7b45ee859
commit 7e2bab921a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
64 changed files with 942 additions and 7 deletions

View file

@ -8,6 +8,8 @@ use rbx_dom_weak::types::{
use rbx_reflection::{DataType, PropertyDescriptor};
use serde::{Deserialize, Serialize};
use crate::REF_POINTER_ATTRIBUTE_PREFIX;
/// A user-friendly version of `Variant` that supports specifying ambiguous
/// values. Ambiguous values need a reflection database to be resolved to a
/// usable value.
@ -147,6 +149,10 @@ impl AmbiguousValue {
Ok(value.into())
}
(VariantType::Ref, AmbiguousValue::String(_)) => Err(format_err!(
"Cannot resolve Ref properties as a String.\
Use an attribute named `{REF_POINTER_ATTRIBUTE_PREFIX}{prop_name}"
)),
(_, unresolved) => Err(format_err!(
"Wrong type of value for property {}.{}. Expected {:?}, got {}",
class_name,