diff --git a/src/Microsoft.OpenApi/Attributes/TrimmingAttributes.cs b/src/Microsoft.OpenApi/Attributes/TrimmingAttributes.cs index 538ed521e..e93686ddd 100644 --- a/src/Microsoft.OpenApi/Attributes/TrimmingAttributes.cs +++ b/src/Microsoft.OpenApi/Attributes/TrimmingAttributes.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -#nullable enable - // This collection of attribute definitions are helpers for accessing trim-related attributes in // projects targeting .NET 6 or lower. Since the trimmer queries for these attributes by name, having // these attributes source included is sufficient for the trimmer to recognize them. For more information diff --git a/src/Microsoft.OpenApi/Extensions/OpenApiTypeMapper.cs b/src/Microsoft.OpenApi/Extensions/OpenApiTypeMapper.cs index 3ae417022..9d6dc60d0 100644 --- a/src/Microsoft.OpenApi/Extensions/OpenApiTypeMapper.cs +++ b/src/Microsoft.OpenApi/Extensions/OpenApiTypeMapper.cs @@ -14,7 +14,6 @@ namespace Microsoft.OpenApi.Extensions /// public static class OpenApiTypeMapper { -#nullable enable /// /// Maps a JsonSchema data type to an identifier. /// @@ -75,8 +74,6 @@ internal static string ToSingleIdentifier(this JsonSchemaType schemaType) return schemaType.ToIdentifiersInternal().Single(); } -#nullable restore - /// /// Converts a schema type's identifier into the enum equivalent /// diff --git a/src/Microsoft.OpenApi/Models/OpenApiComponents.cs b/src/Microsoft.OpenApi/Models/OpenApiComponents.cs index 540664ae5..c3b762088 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiComponents.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiComponents.cs @@ -9,8 +9,6 @@ using Microsoft.OpenApi.Models.References; using Microsoft.OpenApi.Writers; -#nullable enable - namespace Microsoft.OpenApi.Models { /// diff --git a/src/Microsoft.OpenApi/Models/OpenApiDocument.cs b/src/Microsoft.OpenApi/Models/OpenApiDocument.cs index 0f69409d6..e5f82e9cb 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiDocument.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiDocument.cs @@ -17,8 +17,6 @@ using Microsoft.OpenApi.Services; using Microsoft.OpenApi.Writers; -#nullable enable - namespace Microsoft.OpenApi.Models { /// diff --git a/src/Microsoft.OpenApi/Models/OpenApiMediaType.cs b/src/Microsoft.OpenApi/Models/OpenApiMediaType.cs index 7ba469bc6..4c08ccccb 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiMediaType.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiMediaType.cs @@ -10,8 +10,6 @@ using Microsoft.OpenApi.Models.Interfaces; using Microsoft.OpenApi.Writers; -#nullable enable - namespace Microsoft.OpenApi.Models { /// diff --git a/src/Microsoft.OpenApi/Models/OpenApiOperation.cs b/src/Microsoft.OpenApi/Models/OpenApiOperation.cs index 5375fb031..23a98f3d2 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiOperation.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiOperation.cs @@ -9,8 +9,6 @@ using Microsoft.OpenApi.Models.References; using Microsoft.OpenApi.Writers; -#nullable enable - namespace Microsoft.OpenApi.Models { /// diff --git a/src/Microsoft.OpenApi/Models/OpenApiReference.cs b/src/Microsoft.OpenApi/Models/OpenApiReference.cs index ae79cc10f..0e05ec89d 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiReference.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiReference.cs @@ -281,10 +281,8 @@ internal void EnsureHostDocumentIsSet(OpenApiDocument currentDocument) Utils.CheckArgumentNull(currentDocument); hostDocument ??= currentDocument; } - #nullable enable private static string? GetPropertyValueFromNode(JsonObject jsonObject, string key) => jsonObject.TryGetPropertyValue(key, out var valueNode) && valueNode is JsonValue valueCast && valueCast.TryGetValue(out var strValue) ? strValue : null; - #nullable restore internal void SetSummaryAndDescriptionFromMapNode(MapNode mapNode) { var (description, summary) = mapNode.JsonNode switch { diff --git a/src/Microsoft.OpenApi/OpenApiTagComparer.cs b/src/Microsoft.OpenApi/OpenApiTagComparer.cs index 6652dd5ba..dfa89e87f 100644 --- a/src/Microsoft.OpenApi/OpenApiTagComparer.cs +++ b/src/Microsoft.OpenApi/OpenApiTagComparer.cs @@ -4,7 +4,6 @@ namespace Microsoft.OpenApi; -#nullable enable /// /// This comparer is used to maintain a globally unique list of tags encountered /// in a particular OpenAPI document. @@ -44,4 +43,3 @@ public bool Equals(IOpenApiTag? x, IOpenApiTag? y) /// public int GetHashCode(IOpenApiTag obj) => string.IsNullOrEmpty(obj?.Name) ? 0 : StringComparer.GetHashCode(obj!.Name); } -#nullable restore diff --git a/src/Microsoft.OpenApi/Services/OpenApiWalker.cs b/src/Microsoft.OpenApi/Services/OpenApiWalker.cs index cf07356d3..49ac98079 100644 --- a/src/Microsoft.OpenApi/Services/OpenApiWalker.cs +++ b/src/Microsoft.OpenApi/Services/OpenApiWalker.cs @@ -130,7 +130,6 @@ internal void Walk(OpenApiExternalDocs? externalDocs) _visitor.Visit(externalDocs); } -#nullable enable /// /// Visits and child objects /// @@ -256,7 +255,6 @@ internal void Walk(OpenApiComponents? components) Walk(components as IOpenApiExtensible); } -#nullable restore /// /// Visits and child objects /// diff --git a/src/Microsoft.OpenApi/Services/OpenApiWorkspace.cs b/src/Microsoft.OpenApi/Services/OpenApiWorkspace.cs index d668626db..a8ffde23d 100644 --- a/src/Microsoft.OpenApi/Services/OpenApiWorkspace.cs +++ b/src/Microsoft.OpenApi/Services/OpenApiWorkspace.cs @@ -281,7 +281,6 @@ public bool Contains(string location) return _IOpenApiReferenceableRegistry.ContainsKey(key) || _artifactsRegistry.ContainsKey(key); } -#nullable enable /// /// Resolves a reference given a key. /// @@ -307,7 +306,6 @@ public bool Contains(string location) return default; } -#nullable restore private Uri? ToLocationUrl(string location) { diff --git a/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs b/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs index ad84d5537..3df27f6d7 100644 --- a/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs +++ b/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs @@ -126,7 +126,6 @@ public static void WriteProperty(this IOpenApiWriter writer, string name, T v writer.WriteValue(value); } -#nullable enable /// /// Write the optional Open API object/element. /// @@ -179,7 +178,6 @@ public static void WriteRequiredObject( writer.WriteEndObject(); } } -#nullable restore /// /// Write the optional of collection string.