Skip to content

Commit

Permalink
fix: Handle newlines for SwaggerDocOptions.Description
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkallesen committed Jun 26, 2024
1 parent 9c12988 commit ecca292
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ public string Generate()

if (!string.IsNullOrWhiteSpace(parameters.SwaggerDocOptions.Description))
{
sb.AppendLine(20, $"Description = \"{parameters.SwaggerDocOptions.Description}\",");
sb.AppendLine(
20,
parameters.SwaggerDocOptions.Description.Contains('\n', StringComparison.Ordinal)
? $"Description = @\"{parameters.SwaggerDocOptions.Description}\","
: $"Description = \"{parameters.SwaggerDocOptions.Description}\",");
}

if (!string.IsNullOrWhiteSpace(parameters.SwaggerDocOptions.ContactName) ||
Expand Down

0 comments on commit ecca292

Please sign in to comment.