Avoiding to parse string arguments containing valid JSON if the argument annotation is str (#1113)

This commit is contained in:
Giuseppe Coviello 2025-07-10 17:36:45 -04:00 • committed by GitHub
commit 0a4e8d4e17
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -130,7 +130,7 @@ class FuncMetadata(BaseModel):
for field_name in self.arg_model.model_fields.keys():
if field_name not in data.keys():
continue
if isinstance(data[field_name], str):
if isinstance(data[field_name], str) and self.arg_model.model_fields[field_name].annotation is not str:
try:
pre_parsed = json.loads(data[field_name])
except json.JSONDecodeError: