diff --git a/src/Cli.Tests/UpdateEntityTests.cs b/src/Cli.Tests/UpdateEntityTests.cs
index 05d557ba95..523a8ceeb4 100644
--- a/src/Cli.Tests/UpdateEntityTests.cs
+++ b/src/Cli.Tests/UpdateEntityTests.cs
@@ -1188,6 +1188,83 @@ public void TestUpdateFieldDescriptionPrimaryKeyBehavior(bool? primaryKeyFlag, b
Assert.AreEqual(expectedPrimaryKey, field.PrimaryKey);
}
+ ///
+ /// Verifies that a field description containing commas is stored in full
+ /// and not truncated at the first comma.
+ ///
+ [DataTestMethod]
+ [DataRow("Indicates whether the record is active. When false, the record may be historical and still exist, but is no longer actively used. Type: boolean",
+ DisplayName = "Field description with multiple commas is stored in full")]
+ [DataRow("Simple description without commas",
+ DisplayName = "Field description without commas is unchanged")]
+ public void TestUpdateFieldDescriptionWithCommas(string description)
+ {
+ string initialConfig = GetInitialConfigString() + "," + @"
+ ""entities"": {
+ ""MyEntity"": {
+ ""source"": ""MyTable"",
+ ""permissions"": [
+ {
+ ""role"": ""anonymous"",
+ ""actions"": [""read""]
+ }
+ ]
+ }
+ }
+ }";
+
+ UpdateOptions options = new(
+ source: null,
+ permissions: null,
+ entity: "MyEntity",
+ sourceType: null,
+ sourceParameters: null,
+ sourceKeyFields: null,
+ restRoute: null,
+ graphQLType: null,
+ fieldsToInclude: null,
+ fieldsToExclude: null,
+ policyRequest: null,
+ policyDatabase: null,
+ relationship: null,
+ cardinality: null,
+ targetEntity: null,
+ linkingObject: null,
+ linkingSourceFields: null,
+ linkingTargetFields: null,
+ relationshipFields: null,
+ map: null,
+ cacheEnabled: null,
+ cacheTtlSeconds: null,
+ cacheLevel: null,
+ healthEnabled: null,
+ config: TEST_RUNTIME_CONFIG_FILE,
+ restMethodsForStoredProcedure: null,
+ graphQLOperationForStoredProcedure: null,
+ description: null,
+ parametersNameCollection: null,
+ parametersDescriptionCollection: null,
+ parametersRequiredCollection: null,
+ parametersDefaultCollection: null,
+ fieldsNameCollection: new[] { "RecordIsActive" },
+ fieldsAliasCollection: null,
+ fieldsDescriptionCollection: new[] { description },
+ fieldsPrimaryKeyCollection: null,
+ mcpDmlTools: null,
+ mcpCustomTool: null
+ );
+
+ Assert.IsTrue(RuntimeConfigLoader.TryParseConfig(initialConfig, out RuntimeConfig? runtimeConfig), "Parsed config file.");
+ Assert.IsTrue(TryUpdateExistingEntity(options, runtimeConfig!, out RuntimeConfig updatedRuntimeConfig), "Successfully updated entity in the config.");
+
+ Entity updatedEntity = updatedRuntimeConfig.Entities["MyEntity"];
+ Assert.IsNotNull(updatedEntity.Fields);
+ Assert.AreEqual(1, updatedEntity.Fields!.Count);
+ FieldMetadata field = updatedEntity.Fields[0];
+ Assert.AreEqual("RecordIsActive", field.Name);
+ Assert.AreEqual(description, field.Description, "Full description including commas must be preserved.");
+ }
+
private static string GetInitialConfigString()
{
return @"{" +
diff --git a/src/Cli/Commands/EntityOptions.cs b/src/Cli/Commands/EntityOptions.cs
index 76988d4c75..df8b20d8e0 100644
--- a/src/Cli/Commands/EntityOptions.cs
+++ b/src/Cli/Commands/EntityOptions.cs
@@ -126,7 +126,7 @@ public EntityOptions(
[Option("parameters.name", Required = false, Separator = ',', HelpText = "Comma-separated list of parameter names for stored procedure.")]
public IEnumerable? ParametersNameCollection { get; }
- [Option("parameters.description", Required = false, Separator = ',', HelpText = "Comma-separated list of parameter descriptions for stored procedure.")]
+ [Option("parameters.description", Required = false, HelpText = "List of parameter descriptions for stored procedure. Provide one value per parameter. Descriptions may contain commas.")]
public IEnumerable? ParametersDescriptionCollection { get; }
[Option("parameters.required", Required = false, Separator = ',', HelpText = "Comma-separated list of parameter required flags (true/false) for stored procedure.")]
@@ -141,7 +141,7 @@ public EntityOptions(
[Option("fields.alias", Required = false, Separator = ',', HelpText = "Alias for the field.")]
public IEnumerable? FieldsAliasCollection { get; }
- [Option("fields.description", Required = false, Separator = ',', HelpText = "Description for the field.")]
+ [Option("fields.description", Required = false, HelpText = "Description for the field. Descriptions may contain commas.")]
public IEnumerable? FieldsDescriptionCollection { get; }
[Option("fields.primary-key", Required = false, Separator = ',', HelpText = "Set this field as a primary key.")]