Skip to content

Commit d7fdfdf

Browse files
vbilopavclaude
andcommitted
Fix TsClient multi-command type generation for UnnamedSingleColumnSet
Single-column commands in multi-command SQL files now generate flat array types (e.g., string[]) instead of object array types when UnnamedSingleColumnSet is enabled, matching the actual JSON response shape. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent fb2c925 commit d7fdfdf

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

plugins/NpgsqlRest.TsClient/TsClient.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,9 +508,15 @@ string GetReturnExp(string responseExp)
508508
// Void command → rows affected count
509509
mcResp.AppendLine($" {cmdInfo.Name}: number;");
510510
}
511+
else if (cmdInfo.ColumnCount == 1 && cmdInfo.ReturnsUnnamedSet)
512+
{
513+
// Single column with UnnamedSingleColumnSet — flat array
514+
var tsType = GetTsType(cmdInfo.ColumnTypeDescriptors[0], true);
515+
mcResp.AppendLine($" {cmdInfo.Name}: {tsType}[];");
516+
}
511517
else if (cmdInfo.ColumnCount == 1)
512518
{
513-
// Single column
519+
// Single column — object array
514520
var tsType = GetTsType(cmdInfo.ColumnTypeDescriptors[0], true);
515521
mcResp.AppendLine($" {cmdInfo.Name}: {{ {cmdInfo.ColumnNames[0]}: {tsType} }}[];");
516522
}

0 commit comments

Comments
 (0)