Skip to content

Commit

Permalink
Final cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
andrueastman committed Sep 1, 2023
1 parent b86d60e commit e318120
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ public void Write(IOpenApiWriter writer, OpenApiSpecVersion specVersion)

writer.WriteStartObject();
writer.WriteProperty(nameof(IsFlags).ToFirstCharacterLowerCase(), IsFlags);
if(IsFlags)// only write style IsFlags is true
{
writer.WriteProperty(nameof(Style).ToFirstCharacterLowerCase(),string.IsNullOrEmpty(Style) ? "form" : Style);// default to `form`
}
writer.WriteProperty(nameof(Style).ToFirstCharacterLowerCase(),Style);
writer.WriteEndObject();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void WritesAllDefaultValues()
Assert.True(extension.IsFlags);
Assert.Null(extension.Style);
Assert.Contains("\"isFlags\": true", result);
Assert.Contains("\"style\": \"form\"", result);// writes form for unspecified style.
Assert.DoesNotContain("\"style\":", result);
}

[Fact]
Expand Down

0 comments on commit e318120

Please sign in to comment.