Skip to content

Commit

Permalink
[Tmdgen] Correction gestion des " dans les commentaires
Browse files Browse the repository at this point in the history
  • Loading branch information
gideruette committed Dec 15, 2023
1 parent 5b6e6a7 commit 4a23494
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion TopModel.ModelGenerator/OpenApi/OpenApiTmdGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ protected override async IAsyncEnumerable<string> GenerateCore()
{
Alias = enumClass.Properties[0],
Name = $"{property.Key.ToPascalCase()}",
Comment = @$"""{property.Value.Description.Format()}""",
Comment = @$"{property.Value.Description.Format()}",
Class = classe
});
}
Expand Down
10 changes: 5 additions & 5 deletions TopModel.ModelGenerator/TmdWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private void WriteEndpoint(TmdEndpoint endpoint)
_writer.WriteLine($" name: {endpoint.Name}");
_writer.WriteLine($" method: {endpoint.Method}");
_writer.WriteLine($" route: {endpoint.Route}");
_writer.WriteLine($" description: {endpoint.Comment}");
_writer.WriteLine(@$" description: ""{endpoint.Comment.Trim('"').Replace(@"""", @"\""")}""");
if (endpoint.PreservePropertyCasing)
{
_writer.WriteLine($" preservePropertyCasing: {endpoint.PreservePropertyCasing.ToString().ToLower()}");
Expand Down Expand Up @@ -175,7 +175,7 @@ private void WriteProperty(TmdProperty property, bool noList = false)
if (property is TmdAssociationProperty ap)
{
_writer.WriteLine($" {(noList ? string.Empty : "- ")}association: {ap.Association.Name}");
_writer.WriteLine($" {listPrefix}comment: {property.Comment}");
_writer.WriteLine($@" {listPrefix}comment: ""{property.Comment.Trim('"').Replace(@"""", @"\""")}""");
if (!string.IsNullOrEmpty(ap.Role))
{
_writer.WriteLine($" {listPrefix}role: {ap.Role}");
Expand Down Expand Up @@ -205,7 +205,7 @@ private void WriteProperty(TmdProperty property, bool noList = false)
_writer.WriteLine($" {listPrefix}primaryKey: true");
}
_writer.WriteLine($" {listPrefix}comment: {property.Comment}");
_writer.WriteLine($@" {listPrefix}comment: ""{property.Comment.Trim('"').Replace(@"""", @"\""")}""");
}
else if (property is TmdCompositionProperty cp)
{
Expand All @@ -221,7 +221,7 @@ private void WriteProperty(TmdProperty property, bool noList = false)
_writer.WriteLine($" {listPrefix}domain: {property.Domain}");
}
_writer.WriteLine($" {listPrefix}comment: {property.Comment}");
_writer.WriteLine($@" {listPrefix}comment: ""{property.Comment.Trim('"').Replace(@"""", @"\""")}""");
}
else if (property is TmdAliasProperty sp)
{
Expand All @@ -243,7 +243,7 @@ private void WriteProperty(TmdProperty property, bool noList = false)
if (!string.IsNullOrEmpty(property.Comment))
{
_writer.WriteLine($" {listPrefix}comment: {property.Comment}");
_writer.WriteLine(@$" {listPrefix}comment: ""{property.Comment.Trim('"').Replace(@"""", @"\""")}""");
}
}
}
Expand Down

0 comments on commit 4a23494

Please sign in to comment.