diff --git a/crates/pinakes-plugin-api/src/ui_schema.rs b/crates/pinakes-plugin-api/src/ui_schema.rs index f73a5ba..6ce15bd 100644 --- a/crates/pinakes-plugin-api/src/ui_schema.rs +++ b/crates/pinakes-plugin-api/src/ui_schema.rs @@ -41,7 +41,9 @@ //! } //! } //! -//! Note: expression values are `Expression::Path` strings, not mustache +//! # Note +//! +//! Expression values are `Expression::Path` strings, not mustache //! templates. A bare string like `"title"` resolves the `title` field in the //! current item context. Nested fields use dotted segments: `"artist.name"`. //! Array indices use the same notation: `"items.0.title"`. @@ -801,11 +803,6 @@ impl UiElement { ))); } }, - Self::Form { fields, .. } if fields.is_empty() => { - return Err(SchemaError::ValidationError( - "Form must have at least one field".to_string(), - )); - }, Self::Chart { data, .. } if !page.data_sources.contains_key(data) => { return Err(SchemaError::ValidationError(format!( "Chart references unknown data source: {data}" @@ -867,6 +864,11 @@ impl UiElement { submit_action, .. } => { + if fields.is_empty() { + return Err(SchemaError::ValidationError( + "Form must have at least one field".to_string(), + )); + } for field in fields { validate_id(&field.id)?; if field.label.is_empty() { @@ -2120,8 +2122,6 @@ mod tests { ); } - // --- SpecialAction JSON round-trips --- - #[test] fn test_special_action_refresh_roundtrip() { let action = SpecialAction::Refresh; @@ -2180,8 +2180,6 @@ mod tests { assert_eq!(back, SpecialAction::CloseModal); } - // --- ActionRef deserialization ordering --- - #[test] fn test_action_ref_special_refresh_deserializes() { let json = serde_json::json!({"action": "refresh"});