File tree Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -62,11 +62,15 @@ public static function fromArray(array $data): self
6262 $ arguments = array_map (fn (array $ argData ) => PromptArgument::fromArray ($ argData ), $ data ['arguments ' ]);
6363 }
6464
65+ if (!empty ($ data ['_meta ' ]) && !\is_array ($ data ['_meta ' ])) {
66+ throw new InvalidArgumentException ('Invalid "_meta" in Prompt data. ' );
67+ }
68+
6569 return new self (
6670 name: $ data ['name ' ],
6771 description: $ data ['description ' ] ?? null ,
6872 arguments: $ arguments ,
69- _meta: isset ($ data ['_meta ' ]) ? ( int ) $ data ['_meta ' ] : null
73+ _meta: isset ($ data ['_meta ' ]) ? $ data ['_meta ' ] : null
7074 );
7175 }
7276
Original file line number Diff line number Diff line change @@ -82,14 +82,18 @@ public static function fromArray(array $data): self
8282 throw new InvalidArgumentException ('Invalid or missing "name" in Resource data. ' );
8383 }
8484
85+ if (!empty ($ data ['_meta ' ]) && !\is_array ($ data ['_meta ' ])) {
86+ throw new InvalidArgumentException ('Invalid "_meta" in Resource data. ' );
87+ }
88+
8589 return new self (
8690 uri: $ data ['uri ' ],
8791 name: $ data ['name ' ],
8892 description: $ data ['description ' ] ?? null ,
8993 mimeType: $ data ['mimeType ' ] ?? null ,
9094 annotations: isset ($ data ['annotations ' ]) ? Annotations::fromArray ($ data ['annotations ' ]) : null ,
9195 size: isset ($ data ['size ' ]) ? (int ) $ data ['size ' ] : null ,
92- _meta: isset ($ data ['_meta ' ]) ? ( int ) $ data ['_meta ' ] : null
96+ _meta: isset ($ data ['_meta ' ]) ? $ data ['_meta ' ] : null
9397 );
9498 }
9599
Original file line number Diff line number Diff line change @@ -77,13 +77,17 @@ public static function fromArray(array $data): self
7777 throw new InvalidArgumentException ('Invalid or missing "name" in ResourceTemplate data. ' );
7878 }
7979
80+ if (!empty ($ data ['_meta ' ]) && !\is_array ($ data ['_meta ' ])) {
81+ throw new InvalidArgumentException ('Invalid "_meta" in ResourceTemplate data. ' );
82+ }
83+
8084 return new self (
8185 uriTemplate: $ data ['uriTemplate ' ],
8286 name: $ data ['name ' ],
8387 description: $ data ['description ' ] ?? null ,
8488 mimeType: $ data ['mimeType ' ] ?? null ,
8589 annotations: isset ($ data ['annotations ' ]) ? Annotations::fromArray ($ data ['annotations ' ]) : null ,
86- _meta: isset ($ data ['_meta ' ]) ? ( int ) $ data ['_meta ' ] : null
90+ _meta: isset ($ data ['_meta ' ]) ? $ data ['_meta ' ] : null
8791 );
8892 }
8993
You can’t perform that action at this time.
0 commit comments