diff --git a/app/Http/Requests/Api/Post/StorePostRequest.php b/app/Http/Requests/Api/Post/StorePostRequest.php index 303ae8ba..cbdb4c0a 100644 --- a/app/Http/Requests/Api/Post/StorePostRequest.php +++ b/app/Http/Requests/Api/Post/StorePostRequest.php @@ -50,7 +50,6 @@ public function rules(): array 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 22487d0b..02fa34d0 100644 --- a/app/Http/Requests/Api/Post/UpdatePostRequest.php +++ b/app/Http/Requests/Api/Post/UpdatePostRequest.php @@ -52,7 +52,6 @@ public function rules(): array 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 29c7343c..c246ff57 100644 --- a/app/Http/Requests/App/Post/UpdatePostRequest.php +++ b/app/Http/Requests/App/Post/UpdatePostRequest.php @@ -70,7 +70,6 @@ public function rules(): array 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 2fb51f25..80851f06 100644 --- a/app/Mcp/Tools/Post/CreatePostTool.php +++ b/app/Mcp/Tools/Post/CreatePostTool.php @@ -38,7 +38,6 @@ public function handle(Request $request): ResponseFactory ->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 aa0903ca..055b5942 100644 --- a/app/Mcp/Tools/Post/UpdatePostTool.php +++ b/app/Mcp/Tools/Post/UpdatePostTool.php @@ -49,7 +49,6 @@ public function handle(Request $request): Response|ResponseFactory 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 65529b47..d7a12682 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 */ public static function rules(): array { return [ + 'platforms.*.meta' => ['sometimes', 'nullable', 'array'], + // Instagram / Facebook 'platforms.*.meta.aspect_ratio' => ['sometimes', 'nullable', 'string', Rule::enum(AspectRatio::class)],