Skip to content

Commit af8a41c

Browse files
committed
chore: cleanup
1 parent 0a690ff commit af8a41c

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/Microsoft.OpenApi.Hidi/OpenApiService.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,10 @@ private static async Task WriteOpenApiAsync(HidiOptions options, OpenApiFormat o
210210

211211
var stopwatch = new Stopwatch();
212212
stopwatch.Start();
213-
await document.SerializeAsync(writer, openApiVersion, cancellationToken).ConfigureAwait(false);
213+
if (document is not null)
214+
{
215+
await document.SerializeAsync(writer, openApiVersion, cancellationToken).ConfigureAwait(false);
216+
}
214217
stopwatch.Stop();
215218

216219
logger.LogTrace("Finished serializing in {ElapsedMilliseconds}ms", stopwatch.ElapsedMilliseconds);

src/Microsoft.OpenApi/Extensions/StringExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ internal static class StringExtensions
1919
{
2020
private static readonly ConcurrentDictionary<Type, ReadOnlyDictionary<string, object>> EnumDisplayCache = new();
2121

22-
internal static bool TryGetEnumFromDisplayName<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] T>(this string? displayName, ParsingContext parsingContext, out T result) where T : Enum
22+
internal static bool TryGetEnumFromDisplayName<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] T>(this string? displayName, ParsingContext parsingContext, out T? result) where T : Enum
2323
{
2424
if (TryGetEnumFromDisplayName(displayName, out result))
2525
{

test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,11 @@ namespace Microsoft.OpenApi.Extensions
174174
where T : Microsoft.OpenApi.Interfaces.IOpenApiSerializable { }
175175
public static System.Threading.Tasks.Task<string> SerializeAsync<T>(this T element, Microsoft.OpenApi.OpenApiSpecVersion specVersion, Microsoft.OpenApi.OpenApiFormat format, System.Threading.CancellationToken cancellationToken = default)
176176
where T : Microsoft.OpenApi.Interfaces.IOpenApiSerializable { }
177-
public static System.Threading.Tasks.Task SerializeAsync<T>(this T? element, Microsoft.OpenApi.Writers.IOpenApiWriter writer, Microsoft.OpenApi.OpenApiSpecVersion specVersion, System.Threading.CancellationToken cancellationToken = default)
177+
public static System.Threading.Tasks.Task SerializeAsync<T>(this T element, Microsoft.OpenApi.Writers.IOpenApiWriter writer, Microsoft.OpenApi.OpenApiSpecVersion specVersion, System.Threading.CancellationToken cancellationToken = default)
178178
where T : Microsoft.OpenApi.Interfaces.IOpenApiSerializable { }
179179
public static System.Threading.Tasks.Task SerializeAsync<T>(this T element, System.IO.Stream stream, Microsoft.OpenApi.OpenApiSpecVersion specVersion, Microsoft.OpenApi.OpenApiFormat format, System.Threading.CancellationToken cancellationToken = default)
180180
where T : Microsoft.OpenApi.Interfaces.IOpenApiSerializable { }
181-
public static System.Threading.Tasks.Task SerializeAsync<T>(this T element, System.IO.Stream stream, Microsoft.OpenApi.OpenApiSpecVersion specVersion, Microsoft.OpenApi.OpenApiFormat format, Microsoft.OpenApi.Writers.OpenApiWriterSettings? settings, System.Threading.CancellationToken cancellationToken = default)
181+
public static System.Threading.Tasks.Task SerializeAsync<T>(this T element, System.IO.Stream stream, Microsoft.OpenApi.OpenApiSpecVersion specVersion, Microsoft.OpenApi.OpenApiFormat format, Microsoft.OpenApi.Writers.OpenApiWriterSettings? settings = null, System.Threading.CancellationToken cancellationToken = default)
182182
where T : Microsoft.OpenApi.Interfaces.IOpenApiSerializable { }
183183
}
184184
public static class OpenApiServerExtensions

0 commit comments

Comments
 (0)