Skip to content

Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.

refactor(meta): own the platforms.*.meta parent rule in PostPlatformMetaRules

Paulo Castellanoba20534a6dde
diff --git a/app/Http/Requests/Api/Post/StorePostRequest.php b/app/Http/Requests/Api/Post/StorePostRequest.php
index 303ae8baa..cbdb4c0a9 100644
--- a/app/Http/Requests/Api/Post/StorePostRequest.php
+++ b/app/Http/Requests/Api/Post/StorePostRequest.php
@@ -50,7 +50,6 @@ class StorePostRequest extends FormRequest
Rule::in(array_column(ContentType::cases(), 'value')),
new ContentTypeMatchesPlatform,
],
- 'platforms.*.meta' => ['sometimes', 'nullable', 'array'],
...PostPlatformMetaRules::rules(),
'scheduled_at' => ['nullable', 'date', 'after:now'],
'label_ids' => ['sometimes', 'array'],
diff --git a/app/Http/Requests/Api/Post/UpdatePostRequest.php b/app/Http/Requests/Api/Post/UpdatePostRequest.php
index 22487d0ba..02fa34d00 100644
--- a/app/Http/Requests/Api/Post/UpdatePostRequest.php
+++ b/app/Http/Requests/Api/Post/UpdatePostRequest.php
@@ -52,7 +52,6 @@ class UpdatePostRequest extends FormRequest
Rule::in(array_column(ContentType::cases(), 'value')),
new ContentTypeMatchesPostPlatform,
],
- 'platforms.*.meta' => ['nullable', 'array'],
...PostPlatformMetaRules::rules(),
'scheduled_at' => [
'nullable',
diff --git a/app/Http/Requests/App/Post/UpdatePostRequest.php b/app/Http/Requests/App/Post/UpdatePostRequest.php
index 29c7343c1..c246ff570 100644
--- a/app/Http/Requests/App/Post/UpdatePostRequest.php
+++ b/app/Http/Requests/App/Post/UpdatePostRequest.php
@@ -70,7 +70,6 @@ class UpdatePostRequest extends FormRequest
Rule::in(array_column(ContentType::cases(), 'value')),
Rule::when($enforcesMediaCompatibility, [new ContentTypeCompatibleWithMedia]),
],
- 'platforms.*.meta' => ['nullable', 'array'],
...PostPlatformMetaRules::rules(),
'label_ids' => ['sometimes', 'array'],
'label_ids.*' => ['uuid', Rule::exists('workspace_labels', 'id')->where('workspace_id', $this->user()->currentWorkspace->id)],
diff --git a/app/Mcp/Tools/Post/CreatePostTool.php b/app/Mcp/Tools/Post/CreatePostTool.php
index 2fb51f25d..80851f06a 100644
--- a/app/Mcp/Tools/Post/CreatePostTool.php
+++ b/app/Mcp/Tools/Post/CreatePostTool.php
@@ -38,7 +38,6 @@ class CreatePostTool extends Tool
->where('is_active', true),
],
'platforms.*.content_type' => ['required', 'string', Rule::in(array_column(ContentType::cases(), 'value')), new ContentTypeMatchesPlatform],
- 'platforms.*.meta' => ['sometimes', 'array'],
...PostPlatformMetaRules::rules(),
]);
diff --git a/app/Mcp/Tools/Post/UpdatePostTool.php b/app/Mcp/Tools/Post/UpdatePostTool.php
index aa0903cad..055b5942b 100644
--- a/app/Mcp/Tools/Post/UpdatePostTool.php
+++ b/app/Mcp/Tools/Post/UpdatePostTool.php
@@ -49,7 +49,6 @@ class UpdatePostTool extends Tool
Rule::exists('post_platforms', 'id')->where('post_id', $post->id),
],
'platforms.*.content_type' => ['sometimes', 'string', Rule::in(array_column(ContentType::cases(), 'value')), new ContentTypeMatchesPostPlatform],
- 'platforms.*.meta' => ['sometimes', 'array'],
...PostPlatformMetaRules::rules(),
]);
diff --git a/app/Support/PostPlatformMetaRules.php b/app/Support/PostPlatformMetaRules.php
index 65529b479..d7a126821 100644
--- a/app/Support/PostPlatformMetaRules.php
+++ b/app/Support/PostPlatformMetaRules.php
@@ -32,14 +32,16 @@ class PostPlatformMetaRules
];
/**
- * Validation rules for the `platforms.*.meta.*` keys. The caller keeps its own
- * `platforms.*.meta` (array) parent rule; these are the per-platform sub-keys.
+ * Validation rules for `platforms.*.meta` and all its per-platform sub-keys.
+ * Spread into a FormRequest/MCP tool rule set as the complete meta contract.
*
* @return array<string, mixed>
*/
public static function rules(): array
{
return [
+ 'platforms.*.meta' => ['sometimes', 'nullable', 'array'],
+
// Instagram / Facebook
'platforms.*.meta.aspect_ratio' => ['sometimes', 'nullable', 'string', Rule::enum(AspectRatio::class)],