Skip to content

Commit c5fcfd4

Browse files
Fix legacy document transformation (#5315)
* Remove unused property from legacy document transformation Resolves #5303 * Do not overwrite legacy documents with transformations Resolves #1886
1 parent 160d11a commit c5fcfd4

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

src/NSwag.Commands/NSwagDocumentBase.cs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,7 @@ protected static async Task<TDocument> LoadAsync<TDocument>(
167167
where TDocument : NSwagDocumentBase, new()
168168
{
169169
var data = File.ReadAllText(filePath);
170-
data = TransformLegacyDocument(data, out var requiredLegacyTransformations);
171-
172-
if (requiredLegacyTransformations)
173-
{
174-
// Save now to avoid transformations
175-
var document = LoadDocument<TDocument>(filePath, data);
176-
await document.SaveAsync();
177-
}
170+
data = TransformLegacyDocument(data, out var _);
178171

179172
if (applyTransformations)
180173
{
@@ -513,12 +506,6 @@ private static string TransformLegacyDocument(string data, out bool saveFile)
513506
saveFile = true;
514507
}
515508

516-
if (data.Contains("\"noBuild\":") && !data.Contains("RequireParametersWithoutDefault", StringComparison.OrdinalIgnoreCase))
517-
{
518-
data = data.Replace("\"noBuild\":", "\"requireParametersWithoutDefault\": true, \"noBuild\":");
519-
saveFile = true;
520-
}
521-
522509
if (data.Contains("assemblyTypeToSwagger"))
523510
{
524511
data = data.Replace("assemblyTypeToSwagger", "typesToSwagger");

0 commit comments

Comments
 (0)