From 1b4ad078f8c5a3607c47f0c4aac70129a157b60d Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Mon, 19 May 2025 18:49:57 +0300 Subject: [PATCH 01/12] fix: revert to using IDictionary for collections --- .../Extensions/OpenApiExtensibleExtensions.cs | 2 +- src/Microsoft.OpenApi.Hidi/StatsVisitor.cs | 2 +- .../StatsVisitor.cs | 2 +- .../Extensions/OpenApiExtensibleExtensions.cs | 2 +- .../Interfaces/IMetadataContainer.cs | 2 +- .../Interfaces/IOpenApiExtensible.cs | 2 +- .../Interfaces/IOpenApiReadOnlyExtensible.cs | 2 +- .../Models/Interfaces/IOpenApiHeader.cs | 4 +- .../Models/Interfaces/IOpenApiLink.cs | 2 +- .../Models/Interfaces/IOpenApiParameter.cs | 4 +- .../Models/Interfaces/IOpenApiRequestBody.cs | 2 +- .../Models/Interfaces/IOpenApiResponse.cs | 6 +- .../Models/Interfaces/IOpenApiSchema.cs | 12 +- .../Models/OpenApiCallback.cs | 2 +- .../Models/OpenApiComponents.cs | 22 +- .../Models/OpenApiContact.cs | 2 +- .../Models/OpenApiDiscriminator.cs | 4 +- .../Models/OpenApiDocument.cs | 26 +- .../Models/OpenApiEncoding.cs | 4 +- .../Models/OpenApiExample.cs | 2 +- .../Models/OpenApiExtensibleDictionary.cs | 2 +- .../Models/OpenApiExternalDocs.cs | 2 +- src/Microsoft.OpenApi/Models/OpenApiHeader.cs | 6 +- src/Microsoft.OpenApi/Models/OpenApiInfo.cs | 2 +- .../Models/OpenApiLicense.cs | 2 +- src/Microsoft.OpenApi/Models/OpenApiLink.cs | 4 +- .../Models/OpenApiMediaType.cs | 8 +- .../Models/OpenApiOAuthFlow.cs | 4 +- .../Models/OpenApiOAuthFlows.cs | 2 +- .../Models/OpenApiOperation.cs | 6 +- .../Models/OpenApiParameter.cs | 6 +- .../Models/OpenApiPathItem.cs | 2 +- .../Models/OpenApiRequestBody.cs | 4 +- .../Models/OpenApiResponse.cs | 8 +- src/Microsoft.OpenApi/Models/OpenApiSchema.cs | 16 +- .../Models/OpenApiSecurityScheme.cs | 2 +- src/Microsoft.OpenApi/Models/OpenApiServer.cs | 4 +- .../Models/OpenApiServerVariable.cs | 2 +- src/Microsoft.OpenApi/Models/OpenApiTag.cs | 2 +- src/Microsoft.OpenApi/Models/OpenApiXml.cs | 2 +- .../References/OpenApiCallbackReference.cs | 2 +- .../References/OpenApiExampleReference.cs | 2 +- .../References/OpenApiHeaderReference.cs | 6 +- .../Models/References/OpenApiLinkReference.cs | 4 +- .../References/OpenApiParameterReference.cs | 6 +- .../References/OpenApiPathItemReference.cs | 2 +- .../References/OpenApiRequestBodyReference.cs | 4 +- .../References/OpenApiResponseReference.cs | 8 +- .../References/OpenApiSchemaReference.cs | 14 +- .../OpenApiSecuritySchemeReference.cs | 2 +- .../Models/References/OpenApiTagReference.cs | 2 +- .../ParseNodes/AnyMapFieldMapParameter.cs | 4 +- .../Reader/V2/OpenApiDocumentDeserializer.cs | 4 +- .../Reader/V2/OpenApiOperationDeserializer.cs | 3 +- .../Reader/V2/OpenApiResponseDeserializer.cs | 2 +- .../Services/CopyReferences.cs | 40 +-- .../Services/OpenApiUrlTreeNode.cs | 6 +- .../Services/OpenApiVisitorBase.cs | 18 +- .../Services/OpenApiWalker.cs | 18 +- .../Validations/OpenApiValidator.cs | 16 +- .../Rules/OpenApiNonDefaultRules.cs | 2 +- .../Writers/OpenApiWriterAnyExtensions.cs | 2 +- .../Writers/OpenApiWriterExtensions.cs | 20 +- .../Formatters/PowerShellFormatterTests.cs | 10 +- .../UtilityFiles/OpenApiDocumentMock.cs | 37 +-- .../TryLoadReferenceV2Tests.cs | 4 +- .../V2Tests/OpenApiDocumentTests.cs | 18 +- .../V2Tests/OpenApiOperationTests.cs | 15 +- .../V2Tests/OpenApiPathItemTests.cs | 18 +- .../V2Tests/OpenApiSchemaTests.cs | 8 +- .../V31Tests/OpenApiDocumentTests.cs | 28 +- .../V31Tests/OpenApiSchemaTests.cs | 8 +- .../V3Tests/OpenApiDocumentTests.cs | 68 ++--- .../V3Tests/OpenApiParameterTests.cs | 4 +- .../V3Tests/OpenApiSchemaTests.cs | 19 +- .../Mocks/OpenApiDocumentMock.cs | 2 +- .../Models/OpenApiCallbackTests.cs | 4 +- .../Models/OpenApiComponentsTests.cs | 32 +-- .../Models/OpenApiContactTests.cs | 4 +- .../Models/OpenApiDocumentTests.cs | 135 ++++----- .../Models/OpenApiInfoTests.cs | 3 +- .../Models/OpenApiLicenseTests.cs | 4 +- .../Models/OpenApiLinkTests.cs | 3 +- .../Models/OpenApiMediaTypeTests.cs | 2 +- .../Models/OpenApiOperationTests.cs | 14 +- .../Models/OpenApiRequestBodyTests.cs | 4 +- .../Models/OpenApiResponseTests.cs | 5 +- .../Models/OpenApiSchemaTests.cs | 27 +- .../Models/OpenApiTagTests.cs | 2 +- .../Models/OpenApiXmlTests.cs | 4 +- .../PublicApi/PublicApi.approved.txt | 272 +++++++++--------- .../OpenApiReferenceValidationTests.cs | 6 +- .../Visitors/InheritanceTests.cs | 16 +- .../Walkers/WalkerLocationTests.cs | 14 +- .../Workspaces/OpenApiWorkspaceTests.cs | 6 +- .../Writers/OpenApiYamlWriterTests.cs | 4 +- 96 files changed, 599 insertions(+), 580 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs b/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs index 1287e704d..914a61354 100644 --- a/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs +++ b/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs @@ -13,7 +13,7 @@ internal static class OpenApiExtensibleExtensions /// A dictionary of . /// The key corresponding to the . /// A value matching the provided extensionKey. Return null when extensionKey is not found. - internal static string GetExtension(this Dictionary extensions, string extensionKey) + internal static string GetExtension(this IDictionary extensions, string extensionKey) { if (extensions.TryGetValue(extensionKey, out var value) && value is JsonNodeExtension { Node: JsonValue castValue } && castValue.TryGetValue(out var stringValue)) { diff --git a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs index 0f5a9faf4..d157a6c42 100644 --- a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs +++ b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs @@ -27,7 +27,7 @@ public override void Visit(IOpenApiSchema schema) public int HeaderCount { get; set; } - public override void Visit(Dictionary headers) + public override void Visit(IDictionary headers) { HeaderCount++; } diff --git a/src/Microsoft.OpenApi.Workbench/StatsVisitor.cs b/src/Microsoft.OpenApi.Workbench/StatsVisitor.cs index cdcdb6af9..85dc824a4 100644 --- a/src/Microsoft.OpenApi.Workbench/StatsVisitor.cs +++ b/src/Microsoft.OpenApi.Workbench/StatsVisitor.cs @@ -27,7 +27,7 @@ public override void Visit(IOpenApiSchema schema) public int HeaderCount { get; set; } - public override void Visit(Dictionary headers) + public override void Visit(IDictionary headers) { HeaderCount++; } diff --git a/src/Microsoft.OpenApi/Extensions/OpenApiExtensibleExtensions.cs b/src/Microsoft.OpenApi/Extensions/OpenApiExtensibleExtensions.cs index bea3597a6..15b9efd96 100644 --- a/src/Microsoft.OpenApi/Extensions/OpenApiExtensibleExtensions.cs +++ b/src/Microsoft.OpenApi/Extensions/OpenApiExtensibleExtensions.cs @@ -33,7 +33,7 @@ public static void AddExtension(this T element, string name, IOpenApiExtensio throw new OpenApiException(string.Format(SRResource.ExtensionFieldNameMustBeginWithXDash, name)); } - element.Extensions ??= []; + element.Extensions ??= new Dictionary(); element.Extensions[name] = Utils.CheckArgumentNull(any); } } diff --git a/src/Microsoft.OpenApi/Interfaces/IMetadataContainer.cs b/src/Microsoft.OpenApi/Interfaces/IMetadataContainer.cs index 4407577df..90dfb4803 100644 --- a/src/Microsoft.OpenApi/Interfaces/IMetadataContainer.cs +++ b/src/Microsoft.OpenApi/Interfaces/IMetadataContainer.cs @@ -14,5 +14,5 @@ public interface IMetadataContainer /// A collection of properties associated with the current OpenAPI element to be used by the application. /// Metadata are NOT (de)serialized with the schema and can be used for custom properties. /// - Dictionary? Metadata { get; set; } + IDictionary? Metadata { get; set; } } diff --git a/src/Microsoft.OpenApi/Interfaces/IOpenApiExtensible.cs b/src/Microsoft.OpenApi/Interfaces/IOpenApiExtensible.cs index be7796a24..fabd1a177 100644 --- a/src/Microsoft.OpenApi/Interfaces/IOpenApiExtensible.cs +++ b/src/Microsoft.OpenApi/Interfaces/IOpenApiExtensible.cs @@ -13,6 +13,6 @@ public interface IOpenApiExtensible : IOpenApiElement /// /// Specification extensions. /// - Dictionary? Extensions { get; set; } + IDictionary? Extensions { get; set; } } } diff --git a/src/Microsoft.OpenApi/Interfaces/IOpenApiReadOnlyExtensible.cs b/src/Microsoft.OpenApi/Interfaces/IOpenApiReadOnlyExtensible.cs index fc3d19cfa..db451d843 100644 --- a/src/Microsoft.OpenApi/Interfaces/IOpenApiReadOnlyExtensible.cs +++ b/src/Microsoft.OpenApi/Interfaces/IOpenApiReadOnlyExtensible.cs @@ -10,6 +10,6 @@ public interface IOpenApiReadOnlyExtensible /// /// Specification extensions. /// - Dictionary? Extensions { get; } + IDictionary? Extensions { get; } } diff --git a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiHeader.cs b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiHeader.cs index fc580847c..c6550caa6 100644 --- a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiHeader.cs +++ b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiHeader.cs @@ -55,11 +55,11 @@ public interface IOpenApiHeader : IOpenApiDescribedElement, IOpenApiReadOnlyExte /// /// Examples of the media type. /// - public Dictionary? Examples { get; } + public IDictionary? Examples { get; } /// /// A map containing the representations for the header. /// - public Dictionary? Content { get; } + public IDictionary? Content { get; } } diff --git a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiLink.cs b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiLink.cs index 8a263f59d..6fc9abeb6 100644 --- a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiLink.cs +++ b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiLink.cs @@ -24,7 +24,7 @@ public interface IOpenApiLink : IOpenApiDescribedElement, IOpenApiReadOnlyExtens /// /// A map representing parameters to pass to an operation as specified with operationId or identified via operationRef. /// - public Dictionary? Parameters { get; } + public IDictionary? Parameters { get; } /// /// A literal value or {expression} to use as a request body when calling the target operation. diff --git a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiParameter.cs b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiParameter.cs index 8340fb698..63c3a860f 100644 --- a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiParameter.cs +++ b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiParameter.cs @@ -81,7 +81,7 @@ public interface IOpenApiParameter : IOpenApiDescribedElement, IOpenApiReadOnlyE /// Furthermore, if referencing a schema which contains an example, /// the examples value SHALL override the example provided by the schema. /// - public Dictionary? Examples { get; } + public IDictionary? Examples { get; } /// /// Example of the media type. The example SHOULD match the specified schema and encoding properties @@ -102,5 +102,5 @@ public interface IOpenApiParameter : IOpenApiDescribedElement, IOpenApiReadOnlyE /// When example or examples are provided in conjunction with the schema object, /// the example MUST follow the prescribed serialization strategy for the parameter. /// - public Dictionary? Content { get; } + public IDictionary? Content { get; } } diff --git a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiRequestBody.cs b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiRequestBody.cs index 966361bfa..b9c8304df 100644 --- a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiRequestBody.cs +++ b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiRequestBody.cs @@ -19,7 +19,7 @@ public interface IOpenApiRequestBody : IOpenApiDescribedElement, IOpenApiReadOnl /// REQUIRED. The content of the request body. The key is a media type or media type range and the value describes it. /// For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/* /// - public Dictionary? Content { get; } + public IDictionary? Content { get; } /// /// Converts the request body to a body parameter in preparation for a v2 serialization. /// diff --git a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiResponse.cs b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiResponse.cs index 0ad10c1e9..379526e0a 100644 --- a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiResponse.cs +++ b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiResponse.cs @@ -12,18 +12,18 @@ public interface IOpenApiResponse : IOpenApiDescribedElement, IOpenApiReadOnlyEx /// /// Maps a header name to its definition. /// - public Dictionary? Headers { get; } + public IDictionary? Headers { get; } /// /// A map containing descriptions of potential response payloads. /// The key is a media type or media type range and the value describes it. /// - public Dictionary? Content { get; } + public IDictionary? Content { get; } /// /// A map of operations links that can be followed from the response. /// The key of the map is a short name for the link, /// following the naming constraints of the names for Component Objects. /// - public Dictionary? Links { get; } + public IDictionary? Links { get; } } diff --git a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiSchema.cs b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiSchema.cs index 8ef1dec1a..8c175cc31 100644 --- a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiSchema.cs +++ b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiSchema.cs @@ -36,7 +36,7 @@ public interface IOpenApiSchema : IOpenApiDescribedElement, IOpenApiReadOnlyExte /// /// $vocabulary- used in meta-schemas to identify the vocabularies available for use in schemas described by that meta-schema. /// - public Dictionary? Vocabulary { get; } + public IDictionary? Vocabulary { get; } /// /// $dynamicRef - an applicator that allows for deferring the full resolution until runtime, at which point it is resolved each time it is encountered while evaluating an instance @@ -52,7 +52,7 @@ public interface IOpenApiSchema : IOpenApiDescribedElement, IOpenApiReadOnlyExte /// $defs - reserves a location for schema authors to inline re-usable JSON Schemas into a more general schema. /// The keyword does not directly affect the validation result /// - public Dictionary? Definitions { get; } + public IDictionary? Definitions { get; } /// /// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00 @@ -196,7 +196,7 @@ public interface IOpenApiSchema : IOpenApiDescribedElement, IOpenApiReadOnlyExte /// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00 /// Property definitions MUST be a Schema Object and not a standard JSON Schema (inline or referenced). /// - public Dictionary? Properties { get; } + public IDictionary? Properties { get; } /// /// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00 @@ -205,7 +205,7 @@ public interface IOpenApiSchema : IOpenApiDescribedElement, IOpenApiReadOnlyExte /// egular expression dialect. Each property value of this object MUST be an object, and each object MUST /// be a valid Schema Object not a standard JSON Schema. /// - public Dictionary? PatternProperties { get; } + public IDictionary? PatternProperties { get; } /// /// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00 @@ -279,10 +279,10 @@ public interface IOpenApiSchema : IOpenApiDescribedElement, IOpenApiReadOnlyExte /// /// This object stores any unrecognized keywords found in the schema. /// - public Dictionary? UnrecognizedKeywords { get; } + public IDictionary? UnrecognizedKeywords { get; } /// /// Follow JSON Schema definition:https://json-schema.org/draft/2020-12/json-schema-validation#section-6.5.4 /// - public Dictionary>? DependentRequired { get; } + public IDictionary>? DependentRequired { get; } } diff --git a/src/Microsoft.OpenApi/Models/OpenApiCallback.cs b/src/Microsoft.OpenApi/Models/OpenApiCallback.cs index ab84a7b3b..a765728c7 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiCallback.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiCallback.cs @@ -22,7 +22,7 @@ public class OpenApiCallback : IOpenApiExtensible, IOpenApiCallback /// /// This object MAY be extended with Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameter-less constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiComponents.cs b/src/Microsoft.OpenApi/Models/OpenApiComponents.cs index 765a6ee53..f129f3dc5 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiComponents.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiComponents.cs @@ -19,57 +19,57 @@ public class OpenApiComponents : IOpenApiSerializable, IOpenApiExtensible /// /// An object to hold reusable Objects. /// - public Dictionary? Schemas { get; set; } + public IDictionary? Schemas { get; set; } /// /// An object to hold reusable Objects. /// - public Dictionary? Responses { get; set; } + public IDictionary? Responses { get; set; } /// /// An object to hold reusable Objects. /// - public Dictionary? Parameters { get; set; } + public IDictionary? Parameters { get; set; } /// /// An object to hold reusable Objects. /// - public Dictionary? Examples { get; set; } + public IDictionary? Examples { get; set; } /// /// An object to hold reusable Objects. /// - public Dictionary? RequestBodies { get; set; } + public IDictionary? RequestBodies { get; set; } /// /// An object to hold reusable Objects. /// - public Dictionary? Headers { get; set; } + public IDictionary? Headers { get; set; } /// /// An object to hold reusable Objects. /// - public Dictionary? SecuritySchemes { get; set; } + public IDictionary? SecuritySchemes { get; set; } /// /// An object to hold reusable Objects. /// - public Dictionary? Links { get; set; } + public IDictionary? Links { get; set; } /// /// An object to hold reusable Objects. /// - public Dictionary? Callbacks { get; set; } + public IDictionary? Callbacks { get; set; } /// /// An object to hold reusable Object. /// - public Dictionary? PathItems { get; set; } + public IDictionary? PathItems { get; set; } /// /// This object MAY be extended with Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameter-less constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiContact.cs b/src/Microsoft.OpenApi/Models/OpenApiContact.cs index b3a567bd7..c83c4892a 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiContact.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiContact.cs @@ -32,7 +32,7 @@ public class OpenApiContact : IOpenApiSerializable, IOpenApiExtensible /// /// This object MAY be extended with Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameter-less constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiDiscriminator.cs b/src/Microsoft.OpenApi/Models/OpenApiDiscriminator.cs index 8ad465241..3d7d5be93 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiDiscriminator.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiDiscriminator.cs @@ -21,12 +21,12 @@ public class OpenApiDiscriminator : IOpenApiSerializable, IOpenApiExtensible /// /// An object to hold mappings between payload values and schema names or references. /// - public Dictionary? Mapping { get; set; } + public IDictionary? Mapping { get; set; } /// /// This object MAY be extended with Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameter-less constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiDocument.cs b/src/Microsoft.OpenApi/Models/OpenApiDocument.cs index c5ac5f759..a5b886f10 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiDocument.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiDocument.cs @@ -61,7 +61,7 @@ public void RegisterComponents() /// A map of requests initiated other than by an API call, for example by an out of band registration. /// The key name is a unique string to refer to each webhook, while the (optionally referenced) Path Item Object describes a request that may be initiated by the API provider and the expected responses /// - public Dictionary? Webhooks { get; set; } + public IDictionary? Webhooks { get; set; } /// /// An element to hold various schemas for the specification. @@ -103,10 +103,10 @@ public HashSet? Tags /// /// This object MAY be extended with Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// - public Dictionary? Metadata { get; set; } + public IDictionary? Metadata { get; set; } /// /// Absolute location of the document or a generated placeholder if location is not given @@ -668,43 +668,43 @@ public bool AddComponent(string id, T componentToRegister) switch (componentToRegister) { case IOpenApiSchema openApiSchema: - Components.Schemas ??= []; + Components.Schemas ??= new Dictionary(); Components.Schemas.Add(id, openApiSchema); break; case IOpenApiParameter openApiParameter: - Components.Parameters ??= []; + Components.Parameters ??= new Dictionary(); Components.Parameters.Add(id, openApiParameter); break; case IOpenApiResponse openApiResponse: - Components.Responses ??= []; + Components.Responses ??= new Dictionary(); Components.Responses.Add(id, openApiResponse); break; case IOpenApiRequestBody openApiRequestBody: - Components.RequestBodies ??= []; + Components.RequestBodies ??= new Dictionary(); Components.RequestBodies.Add(id, openApiRequestBody); break; case IOpenApiLink openApiLink: - Components.Links ??= []; + Components.Links ??= new Dictionary(); Components.Links.Add(id, openApiLink); break; case IOpenApiCallback openApiCallback: - Components.Callbacks ??= []; + Components.Callbacks ??= new Dictionary(); Components.Callbacks.Add(id, openApiCallback); break; case IOpenApiPathItem openApiPathItem: - Components.PathItems ??= []; + Components.PathItems ??= new Dictionary(); Components.PathItems.Add(id, openApiPathItem); break; case IOpenApiExample openApiExample: - Components.Examples ??= []; + Components.Examples ??= new Dictionary(); Components.Examples.Add(id, openApiExample); break; case IOpenApiHeader openApiHeader: - Components.Headers ??= []; + Components.Headers ??= new Dictionary(); Components.Headers.Add(id, openApiHeader); break; case IOpenApiSecurityScheme openApiSecurityScheme: - Components.SecuritySchemes ??= []; + Components.SecuritySchemes ??= new Dictionary(); Components.SecuritySchemes.Add(id, openApiSecurityScheme); break; default: diff --git a/src/Microsoft.OpenApi/Models/OpenApiEncoding.cs b/src/Microsoft.OpenApi/Models/OpenApiEncoding.cs index e08126586..34efb4d4f 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiEncoding.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiEncoding.cs @@ -25,7 +25,7 @@ public class OpenApiEncoding : IOpenApiSerializable, IOpenApiExtensible /// /// A map allowing additional information to be provided as headers. /// - public Dictionary? Headers { get; set; } + public IDictionary? Headers { get; set; } /// /// Describes how a specific property value will be serialized depending on its type. @@ -52,7 +52,7 @@ public class OpenApiEncoding : IOpenApiSerializable, IOpenApiExtensible /// /// This object MAY be extended with Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameter-less constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiExample.cs b/src/Microsoft.OpenApi/Models/OpenApiExample.cs index 09ba87d48..2a46d3873 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiExample.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiExample.cs @@ -28,7 +28,7 @@ public class OpenApiExample : IOpenApiExtensible, IOpenApiExample public JsonNode? Value { get; set; } /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameter-less constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiExtensibleDictionary.cs b/src/Microsoft.OpenApi/Models/OpenApiExtensibleDictionary.cs index 7e4f9f686..ffd89c501 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiExtensibleDictionary.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiExtensibleDictionary.cs @@ -36,7 +36,7 @@ protected OpenApiExtensibleDictionary( /// /// This object MAY be extended with Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// diff --git a/src/Microsoft.OpenApi/Models/OpenApiExternalDocs.cs b/src/Microsoft.OpenApi/Models/OpenApiExternalDocs.cs index 9532eb54a..9bc5bc18f 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiExternalDocs.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiExternalDocs.cs @@ -26,7 +26,7 @@ public class OpenApiExternalDocs : IOpenApiSerializable, IOpenApiExtensible /// /// This object MAY be extended with Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameter-less constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiHeader.cs b/src/Microsoft.OpenApi/Models/OpenApiHeader.cs index 619233257..d1af858d2 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiHeader.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiHeader.cs @@ -47,13 +47,13 @@ public class OpenApiHeader : IOpenApiHeader, IOpenApiExtensible public JsonNode? Example { get; set; } /// - public Dictionary? Examples { get; set; } + public IDictionary? Examples { get; set; } /// - public Dictionary? Content { get; set; } + public IDictionary? Content { get; set; } /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameter-less constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiInfo.cs b/src/Microsoft.OpenApi/Models/OpenApiInfo.cs index 119ae7eb1..f1e67c211 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiInfo.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiInfo.cs @@ -51,7 +51,7 @@ public class OpenApiInfo : IOpenApiSerializable, IOpenApiExtensible /// /// This object MAY be extended with Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameter-less constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiLicense.cs b/src/Microsoft.OpenApi/Models/OpenApiLicense.cs index 18530f214..2816b527d 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiLicense.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiLicense.cs @@ -31,7 +31,7 @@ public class OpenApiLicense : IOpenApiSerializable, IOpenApiExtensible /// /// This object MAY be extended with Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameterless constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiLink.cs b/src/Microsoft.OpenApi/Models/OpenApiLink.cs index 4e343c842..adb78e817 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiLink.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiLink.cs @@ -21,7 +21,7 @@ public class OpenApiLink : IOpenApiExtensible, IOpenApiLink public string? OperationId { get; set; } /// - public Dictionary? Parameters { get; set; } + public IDictionary? Parameters { get; set; } /// public RuntimeExpressionAnyWrapper? RequestBody { get; set; } @@ -33,7 +33,7 @@ public class OpenApiLink : IOpenApiExtensible, IOpenApiLink public OpenApiServer? Server { get; set; } /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameterless constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiMediaType.cs b/src/Microsoft.OpenApi/Models/OpenApiMediaType.cs index f71377866..4112b594c 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiMediaType.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiMediaType.cs @@ -32,7 +32,7 @@ public class OpenApiMediaType : IOpenApiSerializable, IOpenApiExtensible /// Examples of the media type. /// Each example object SHOULD match the media type and specified schema if present. /// - public Dictionary? Examples { get; set; } + public IDictionary? Examples { get; set; } /// /// A map between a property name and its encoding information. @@ -40,12 +40,12 @@ public class OpenApiMediaType : IOpenApiSerializable, IOpenApiExtensible /// The encoding object SHALL only apply to requestBody objects /// when the media type is multipart or application/x-www-form-urlencoded. /// - public Dictionary? Encoding { get; set; } + public IDictionary? Encoding { get; set; } /// /// Serialize to Open Api v3.0. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameterless constructor @@ -119,7 +119,7 @@ public virtual void SerializeAsV2(IOpenApiWriter writer) // Media type does not exist in V2. } - private static void SerializeExamples(IOpenApiWriter writer, Dictionary examples, Action callback) + private static void SerializeExamples(IOpenApiWriter writer, IDictionary examples, Action callback) { /* Special case for writing out empty arrays as valid response examples * Check if there is any example with an empty array as its value and set the flag `hasEmptyArray` to true diff --git a/src/Microsoft.OpenApi/Models/OpenApiOAuthFlow.cs b/src/Microsoft.OpenApi/Models/OpenApiOAuthFlow.cs index 05c8da5e1..fc67dfb7e 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiOAuthFlow.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiOAuthFlow.cs @@ -33,12 +33,12 @@ public class OpenApiOAuthFlow : IOpenApiSerializable, IOpenApiExtensible /// /// REQUIRED. A map between the scope name and a short description for it. /// - public Dictionary? Scopes { get; set; } + public IDictionary? Scopes { get; set; } /// /// Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameterless constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiOAuthFlows.cs b/src/Microsoft.OpenApi/Models/OpenApiOAuthFlows.cs index 59efdb5fe..109161737 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiOAuthFlows.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiOAuthFlows.cs @@ -36,7 +36,7 @@ public class OpenApiOAuthFlows : IOpenApiSerializable, IOpenApiExtensible /// /// Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameterless constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiOperation.cs b/src/Microsoft.OpenApi/Models/OpenApiOperation.cs index 7c9e2dd37..e747c54aa 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiOperation.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiOperation.cs @@ -97,7 +97,7 @@ public HashSet? Tags /// The key value used to identify the callback object is an expression, evaluated at runtime, /// that identifies a URL to use for the callback operation. /// - public Dictionary? Callbacks { get; set; } + public IDictionary? Callbacks { get; set; } /// /// Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation. @@ -123,10 +123,10 @@ public HashSet? Tags /// /// This object MAY be extended with Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// - public Dictionary? Metadata { get; set; } + public IDictionary? Metadata { get; set; } /// /// Parameterless constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiParameter.cs b/src/Microsoft.OpenApi/Models/OpenApiParameter.cs index d49ccda49..084de81fe 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiParameter.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiParameter.cs @@ -61,16 +61,16 @@ public bool Explode public IOpenApiSchema? Schema { get; set; } /// - public Dictionary? Examples { get; set; } + public IDictionary? Examples { get; set; } /// public JsonNode? Example { get; set; } /// - public Dictionary? Content { get; set; } + public IDictionary? Content { get; set; } /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// A parameterless constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiPathItem.cs b/src/Microsoft.OpenApi/Models/OpenApiPathItem.cs index a6b86ec69..09ff3a155 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiPathItem.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiPathItem.cs @@ -31,7 +31,7 @@ public class OpenApiPathItem : IOpenApiExtensible, IOpenApiPathItem public List? Parameters { get; set; } /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Add one operation into this path item. diff --git a/src/Microsoft.OpenApi/Models/OpenApiRequestBody.cs b/src/Microsoft.OpenApi/Models/OpenApiRequestBody.cs index 2a73bcaed..a83770eea 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiRequestBody.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiRequestBody.cs @@ -24,10 +24,10 @@ public class OpenApiRequestBody : IOpenApiExtensible, IOpenApiRequestBody public bool Required { get; set; } /// - public Dictionary? Content { get; set; } + public IDictionary? Content { get; set; } /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameter-less constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiResponse.cs b/src/Microsoft.OpenApi/Models/OpenApiResponse.cs index d52b15781..5301eb411 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiResponse.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiResponse.cs @@ -19,16 +19,16 @@ public class OpenApiResponse : IOpenApiExtensible, IOpenApiResponse public string? Description { get; set; } /// - public Dictionary? Headers { get; set; } + public IDictionary? Headers { get; set; } /// - public Dictionary? Content { get; set; } + public IDictionary? Content { get; set; } /// - public Dictionary? Links { get; set; } + public IDictionary? Links { get; set; } /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameterless constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiSchema.cs b/src/Microsoft.OpenApi/Models/OpenApiSchema.cs index 416cd7dba..6215e17de 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiSchema.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiSchema.cs @@ -32,7 +32,7 @@ public class OpenApiSchema : IOpenApiExtensible, IOpenApiSchema, IMetadataContai public string? Comment { get; set; } /// - public Dictionary? Vocabulary { get; set; } + public IDictionary? Vocabulary { get; set; } /// public string? DynamicRef { get; set; } @@ -41,7 +41,7 @@ public class OpenApiSchema : IOpenApiExtensible, IOpenApiSchema, IMetadataContai public string? DynamicAnchor { get; set; } /// - public Dictionary? Definitions { get; set; } + public IDictionary? Definitions { get; set; } private string? _exclusiveMaximum; /// @@ -207,10 +207,10 @@ public string? Minimum public bool? UniqueItems { get; set; } /// - public Dictionary? Properties { get; set; } + public IDictionary? Properties { get; set; } /// - public Dictionary? PatternProperties { get; set; } + public IDictionary? PatternProperties { get; set; } /// public int? MaxProperties { get; set; } @@ -249,16 +249,16 @@ public string? Minimum public OpenApiXml? Xml { get; set; } /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// - public Dictionary? UnrecognizedKeywords { get; set; } + public IDictionary? UnrecognizedKeywords { get; set; } /// - public Dictionary? Metadata { get; set; } + public IDictionary? Metadata { get; set; } /// - public Dictionary>? DependentRequired { get; set; } + public IDictionary>? DependentRequired { get; set; } /// /// Parameterless constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiSecurityScheme.cs b/src/Microsoft.OpenApi/Models/OpenApiSecurityScheme.cs index 83042912d..e9521d87c 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiSecurityScheme.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiSecurityScheme.cs @@ -40,7 +40,7 @@ public class OpenApiSecurityScheme : IOpenApiExtensible, IOpenApiSecurityScheme public Uri? OpenIdConnectUrl { get; set; } /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameterless constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiServer.cs b/src/Microsoft.OpenApi/Models/OpenApiServer.cs index af75c9c44..d702d41fa 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiServer.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiServer.cs @@ -28,12 +28,12 @@ public class OpenApiServer : IOpenApiSerializable, IOpenApiExtensible /// /// A map between a variable name and its value. The value is used for substitution in the server's URL template. /// - public Dictionary? Variables { get; set; } + public IDictionary? Variables { get; set; } /// /// This object MAY be extended with Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameterless constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiServerVariable.cs b/src/Microsoft.OpenApi/Models/OpenApiServerVariable.cs index 793c94d6c..22064b5bc 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiServerVariable.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiServerVariable.cs @@ -34,7 +34,7 @@ public class OpenApiServerVariable : IOpenApiSerializable, IOpenApiExtensible /// /// This object MAY be extended with Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameterless constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiTag.cs b/src/Microsoft.OpenApi/Models/OpenApiTag.cs index 74adcb2fe..c325cef8f 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiTag.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiTag.cs @@ -24,7 +24,7 @@ public class OpenApiTag : IOpenApiExtensible, IOpenApiTag, IOpenApiDescribedElem public OpenApiExternalDocs? ExternalDocs { get; set; } /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameterless constructor diff --git a/src/Microsoft.OpenApi/Models/OpenApiXml.cs b/src/Microsoft.OpenApi/Models/OpenApiXml.cs index 552241d17..182cd309a 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiXml.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiXml.cs @@ -43,7 +43,7 @@ public class OpenApiXml : IOpenApiSerializable, IOpenApiExtensible /// /// Specification Extensions. /// - public Dictionary? Extensions { get; set; } + public IDictionary? Extensions { get; set; } /// /// Parameterless constructor diff --git a/src/Microsoft.OpenApi/Models/References/OpenApiCallbackReference.cs b/src/Microsoft.OpenApi/Models/References/OpenApiCallbackReference.cs index 1211561e4..d1a06da15 100644 --- a/src/Microsoft.OpenApi/Models/References/OpenApiCallbackReference.cs +++ b/src/Microsoft.OpenApi/Models/References/OpenApiCallbackReference.cs @@ -41,7 +41,7 @@ private OpenApiCallbackReference(OpenApiCallbackReference callback):base(callbac public Dictionary? PathItems { get => Target?.PathItems; } /// - public Dictionary? Extensions { get => Target?.Extensions; } + public IDictionary? Extensions { get => Target?.Extensions; } /// public override IOpenApiCallback CopyReferenceAsTargetElementWithOverrides(IOpenApiCallback source) diff --git a/src/Microsoft.OpenApi/Models/References/OpenApiExampleReference.cs b/src/Microsoft.OpenApi/Models/References/OpenApiExampleReference.cs index 59cb7319e..b1c1ae8ae 100644 --- a/src/Microsoft.OpenApi/Models/References/OpenApiExampleReference.cs +++ b/src/Microsoft.OpenApi/Models/References/OpenApiExampleReference.cs @@ -51,7 +51,7 @@ public string? Summary } /// - public Dictionary? Extensions { get => Target?.Extensions; } + public IDictionary? Extensions { get => Target?.Extensions; } /// public string? ExternalValue { get => Target?.ExternalValue; } diff --git a/src/Microsoft.OpenApi/Models/References/OpenApiHeaderReference.cs b/src/Microsoft.OpenApi/Models/References/OpenApiHeaderReference.cs index fa8fe15eb..cd843de57 100644 --- a/src/Microsoft.OpenApi/Models/References/OpenApiHeaderReference.cs +++ b/src/Microsoft.OpenApi/Models/References/OpenApiHeaderReference.cs @@ -68,13 +68,13 @@ public string? Description public JsonNode? Example { get => Target?.Example; } /// - public Dictionary? Examples { get => Target?.Examples; } + public IDictionary? Examples { get => Target?.Examples; } /// - public Dictionary? Content { get => Target?.Content; } + public IDictionary? Content { get => Target?.Content; } /// - public Dictionary? Extensions { get => Target?.Extensions; } + public IDictionary? Extensions { get => Target?.Extensions; } /// public override IOpenApiHeader CopyReferenceAsTargetElementWithOverrides(IOpenApiHeader source) diff --git a/src/Microsoft.OpenApi/Models/References/OpenApiLinkReference.cs b/src/Microsoft.OpenApi/Models/References/OpenApiLinkReference.cs index 71f52ecd9..8c23cdf35 100644 --- a/src/Microsoft.OpenApi/Models/References/OpenApiLinkReference.cs +++ b/src/Microsoft.OpenApi/Models/References/OpenApiLinkReference.cs @@ -52,13 +52,13 @@ public string? Description public OpenApiServer? Server { get => Target?.Server; } /// - public Dictionary? Parameters { get => Target?.Parameters; } + public IDictionary? Parameters { get => Target?.Parameters; } /// public RuntimeExpressionAnyWrapper? RequestBody { get => Target?.RequestBody; } /// - public Dictionary? Extensions { get => Target?.Extensions; } + public IDictionary? Extensions { get => Target?.Extensions; } /// public override void SerializeAsV2(IOpenApiWriter writer) diff --git a/src/Microsoft.OpenApi/Models/References/OpenApiParameterReference.cs b/src/Microsoft.OpenApi/Models/References/OpenApiParameterReference.cs index ae9322e41..40ecb69eb 100644 --- a/src/Microsoft.OpenApi/Models/References/OpenApiParameterReference.cs +++ b/src/Microsoft.OpenApi/Models/References/OpenApiParameterReference.cs @@ -61,7 +61,7 @@ public string? Description public IOpenApiSchema? Schema { get => Target?.Schema; } /// - public Dictionary? Examples { get => Target?.Examples; } + public IDictionary? Examples { get => Target?.Examples; } /// public JsonNode? Example { get => Target?.Example; } @@ -76,10 +76,10 @@ public string? Description public bool Explode { get => Target?.Explode ?? default; } /// - public Dictionary? Content { get => Target?.Content; } + public IDictionary? Content { get => Target?.Content; } /// - public Dictionary? Extensions { get => Target?.Extensions; } + public IDictionary? Extensions { get => Target?.Extensions; } /// public override IOpenApiParameter CopyReferenceAsTargetElementWithOverrides(IOpenApiParameter source) diff --git a/src/Microsoft.OpenApi/Models/References/OpenApiPathItemReference.cs b/src/Microsoft.OpenApi/Models/References/OpenApiPathItemReference.cs index a6ae2d405..e612cd92e 100644 --- a/src/Microsoft.OpenApi/Models/References/OpenApiPathItemReference.cs +++ b/src/Microsoft.OpenApi/Models/References/OpenApiPathItemReference.cs @@ -62,7 +62,7 @@ public string? Description public List? Parameters { get => Target?.Parameters; } /// - public Dictionary? Extensions { get => Target?.Extensions; } + public IDictionary? Extensions { get => Target?.Extensions; } /// public override IOpenApiPathItem CopyReferenceAsTargetElementWithOverrides(IOpenApiPathItem source) diff --git a/src/Microsoft.OpenApi/Models/References/OpenApiRequestBodyReference.cs b/src/Microsoft.OpenApi/Models/References/OpenApiRequestBodyReference.cs index f6bee476b..8beb3e604 100644 --- a/src/Microsoft.OpenApi/Models/References/OpenApiRequestBodyReference.cs +++ b/src/Microsoft.OpenApi/Models/References/OpenApiRequestBodyReference.cs @@ -45,13 +45,13 @@ public string? Description } /// - public Dictionary? Content { get => Target?.Content; } + public IDictionary? Content { get => Target?.Content; } /// public bool Required { get => Target?.Required ?? false; } /// - public Dictionary? Extensions { get => Target?.Extensions; } + public IDictionary? Extensions { get => Target?.Extensions; } /// public override IOpenApiRequestBody CopyReferenceAsTargetElementWithOverrides(IOpenApiRequestBody source) diff --git a/src/Microsoft.OpenApi/Models/References/OpenApiResponseReference.cs b/src/Microsoft.OpenApi/Models/References/OpenApiResponseReference.cs index 648b9c4c6..cc78f6080 100644 --- a/src/Microsoft.OpenApi/Models/References/OpenApiResponseReference.cs +++ b/src/Microsoft.OpenApi/Models/References/OpenApiResponseReference.cs @@ -43,16 +43,16 @@ public string? Description } /// - public Dictionary? Content { get => Target?.Content; } + public IDictionary? Content { get => Target?.Content; } /// - public Dictionary? Headers { get => Target?.Headers; } + public IDictionary? Headers { get => Target?.Headers; } /// - public Dictionary? Links { get => Target?.Links; } + public IDictionary? Links { get => Target?.Links; } /// - public Dictionary? Extensions { get => Target?.Extensions; } + public IDictionary? Extensions { get => Target?.Extensions; } /// public override IOpenApiResponse CopyReferenceAsTargetElementWithOverrides(IOpenApiResponse source) diff --git a/src/Microsoft.OpenApi/Models/References/OpenApiSchemaReference.cs b/src/Microsoft.OpenApi/Models/References/OpenApiSchemaReference.cs index 6c191c8e5..9261a8eeb 100644 --- a/src/Microsoft.OpenApi/Models/References/OpenApiSchemaReference.cs +++ b/src/Microsoft.OpenApi/Models/References/OpenApiSchemaReference.cs @@ -52,13 +52,13 @@ public string? Description /// public string? Comment { get => Target?.Comment; } /// - public Dictionary? Vocabulary { get => Target?.Vocabulary; } + public IDictionary? Vocabulary { get => Target?.Vocabulary; } /// public string? DynamicRef { get => Target?.DynamicRef; } /// public string? DynamicAnchor { get => Target?.DynamicAnchor; } /// - public Dictionary? Definitions { get => Target?.Definitions; } + public IDictionary? Definitions { get => Target?.Definitions; } /// public string? ExclusiveMaximum { get => Target?.ExclusiveMaximum; } /// @@ -106,9 +106,9 @@ public string? Description /// public bool? UniqueItems { get => Target?.UniqueItems; } /// - public Dictionary? Properties { get => Target?.Properties; } + public IDictionary? Properties { get => Target?.Properties; } /// - public Dictionary? PatternProperties { get => Target?.PatternProperties; } + public IDictionary? PatternProperties { get => Target?.PatternProperties; } /// public int? MaxProperties { get => Target?.MaxProperties; } /// @@ -134,13 +134,13 @@ public string? Description /// public OpenApiXml? Xml { get => Target?.Xml; } /// - public Dictionary? Extensions { get => Target?.Extensions; } + public IDictionary? Extensions { get => Target?.Extensions; } /// - public Dictionary? UnrecognizedKeywords { get => Target?.UnrecognizedKeywords; } + public IDictionary? UnrecognizedKeywords { get => Target?.UnrecognizedKeywords; } /// - public Dictionary>? DependentRequired { get => Target?.DependentRequired; } + public IDictionary>? DependentRequired { get => Target?.DependentRequired; } /// public override void SerializeAsV31(IOpenApiWriter writer) diff --git a/src/Microsoft.OpenApi/Models/References/OpenApiSecuritySchemeReference.cs b/src/Microsoft.OpenApi/Models/References/OpenApiSecuritySchemeReference.cs index ff9c5b396..44741467b 100644 --- a/src/Microsoft.OpenApi/Models/References/OpenApiSecuritySchemeReference.cs +++ b/src/Microsoft.OpenApi/Models/References/OpenApiSecuritySchemeReference.cs @@ -57,7 +57,7 @@ public string? Description public Uri? OpenIdConnectUrl { get => Target?.OpenIdConnectUrl; } /// - public Dictionary? Extensions { get => Target?.Extensions; } + public IDictionary? Extensions { get => Target?.Extensions; } /// public SecuritySchemeType? Type { get => Target?.Type; } diff --git a/src/Microsoft.OpenApi/Models/References/OpenApiTagReference.cs b/src/Microsoft.OpenApi/Models/References/OpenApiTagReference.cs index 769764c9d..5e5ec66c9 100644 --- a/src/Microsoft.OpenApi/Models/References/OpenApiTagReference.cs +++ b/src/Microsoft.OpenApi/Models/References/OpenApiTagReference.cs @@ -56,7 +56,7 @@ public string? Description public OpenApiExternalDocs? ExternalDocs { get => Target?.ExternalDocs; } /// - public Dictionary? Extensions { get => Target?.Extensions; } + public IDictionary? Extensions { get => Target?.Extensions; } /// public string? Name { get => Target?.Name; } diff --git a/src/Microsoft.OpenApi/Reader/ParseNodes/AnyMapFieldMapParameter.cs b/src/Microsoft.OpenApi/Reader/ParseNodes/AnyMapFieldMapParameter.cs index 1bbb387dd..fafcccd61 100644 --- a/src/Microsoft.OpenApi/Reader/ParseNodes/AnyMapFieldMapParameter.cs +++ b/src/Microsoft.OpenApi/Reader/ParseNodes/AnyMapFieldMapParameter.cs @@ -15,7 +15,7 @@ internal class AnyMapFieldMapParameter /// Constructor /// public AnyMapFieldMapParameter( - Func?> propertyMapGetter, + Func?> propertyMapGetter, Func propertyGetter, Action propertySetter, Func schemaGetter) @@ -29,7 +29,7 @@ public AnyMapFieldMapParameter( /// /// Function to retrieve the property that is a map from string to an inner element. /// - public Func?> PropertyMapGetter { get; } + public Func?> PropertyMapGetter { get; } /// /// Function to retrieve the value of the property from an inner element. diff --git a/src/Microsoft.OpenApi/Reader/V2/OpenApiDocumentDeserializer.cs b/src/Microsoft.OpenApi/Reader/V2/OpenApiDocumentDeserializer.cs index 44dc3f313..0a0d9c8b9 100644 --- a/src/Microsoft.OpenApi/Reader/V2/OpenApiDocumentDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V2/OpenApiDocumentDeserializer.cs @@ -313,8 +313,8 @@ private static bool IsHostValid(string host) internal class RequestBodyReferenceFixer : OpenApiVisitorBase { - private readonly Dictionary _requestBodies; - public RequestBodyReferenceFixer(Dictionary requestBodies) + private readonly IDictionary _requestBodies; + public RequestBodyReferenceFixer(IDictionary requestBodies) { _requestBodies = requestBodies; } diff --git a/src/Microsoft.OpenApi/Reader/V2/OpenApiOperationDeserializer.cs b/src/Microsoft.OpenApi/Reader/V2/OpenApiOperationDeserializer.cs index c0358cfd6..9a8ac8d32 100644 --- a/src/Microsoft.OpenApi/Reader/V2/OpenApiOperationDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V2/OpenApiOperationDeserializer.cs @@ -10,6 +10,7 @@ using Microsoft.OpenApi.Models.Interfaces; using System; using System.Text.Json.Nodes; +using Microsoft.OpenApi.Interfaces; namespace Microsoft.OpenApi.Reader.V2 { @@ -243,7 +244,7 @@ internal static IOpenApiRequestBody CreateRequestBody( if (bodyParameter.Name is not null) { - requestBody.Extensions ??= []; + requestBody.Extensions ??= new Dictionary(); requestBody.Extensions[OpenApiConstants.BodyName] = new JsonNodeExtension(bodyParameter.Name); } return requestBody; diff --git a/src/Microsoft.OpenApi/Reader/V2/OpenApiResponseDeserializer.cs b/src/Microsoft.OpenApi/Reader/V2/OpenApiResponseDeserializer.cs index 3560a3258..8dc3c2c12 100644 --- a/src/Microsoft.OpenApi/Reader/V2/OpenApiResponseDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V2/OpenApiResponseDeserializer.cs @@ -62,7 +62,7 @@ private static void ProcessProduces(MapNode mapNode, OpenApiResponse response, P { if (response.Content == null) { - response.Content = []; + response.Content = new Dictionary(); } else if (context.GetFromTempStorage(TempStorageKeys.ResponseProducesSet, response)) { diff --git a/src/Microsoft.OpenApi/Services/CopyReferences.cs b/src/Microsoft.OpenApi/Services/CopyReferences.cs index 96932490d..26fb3c596 100644 --- a/src/Microsoft.OpenApi/Services/CopyReferences.cs +++ b/src/Microsoft.OpenApi/Services/CopyReferences.cs @@ -91,7 +91,7 @@ private void AddSchemaToComponents(IOpenApiSchema? schema, string? referenceId = EnsureSchemasExist(); if (referenceId is not null && schema is not null && !(Components.Schemas?.ContainsKey(referenceId) ?? false)) { - Components.Schemas ??= []; + Components.Schemas ??= new Dictionary(); Components.Schemas.Add(referenceId, schema); } } @@ -102,7 +102,7 @@ private void AddParameterToComponents(IOpenApiParameter? parameter, string? refe EnsureParametersExist(); if (parameter is not null && referenceId is not null && !(Components.Parameters?.ContainsKey(referenceId) ?? false)) { - Components.Parameters ??= []; + Components.Parameters ??= new Dictionary(); Components.Parameters.Add(referenceId, parameter); } } @@ -113,7 +113,7 @@ private void AddResponseToComponents(IOpenApiResponse? response, string? referen EnsureResponsesExist(); if (referenceId is not null && response is not null && !(Components.Responses?.ContainsKey(referenceId) ?? false)) { - Components.Responses ??= []; + Components.Responses ??= new Dictionary(); Components.Responses.Add(referenceId, response); } } @@ -123,7 +123,7 @@ private void AddRequestBodyToComponents(IOpenApiRequestBody? requestBody, string EnsureRequestBodiesExist(); if (requestBody is not null && referenceId is not null && !(Components.RequestBodies?.ContainsKey(referenceId) ?? false)) { - Components.RequestBodies ??= []; + Components.RequestBodies ??= new Dictionary(); Components.RequestBodies.Add(referenceId, requestBody); } } @@ -133,7 +133,7 @@ private void AddLinkToComponents(IOpenApiLink? link, string? referenceId = null) EnsureLinksExist(); if (link is not null && referenceId is not null && !(Components.Links?.ContainsKey(referenceId) ?? false)) { - Components.Links ??= []; + Components.Links ??= new Dictionary(); Components.Links.Add(referenceId, link); } } @@ -143,7 +143,7 @@ private void AddCallbackToComponents(IOpenApiCallback? callback, string? referen EnsureCallbacksExist(); if (callback is not null && referenceId is not null && !(Components.Callbacks?.ContainsKey(referenceId) ?? false)) { - Components.Callbacks ??= []; + Components.Callbacks ??= new Dictionary(); Components.Callbacks.Add(referenceId, callback); } } @@ -153,7 +153,7 @@ private void AddHeaderToComponents(IOpenApiHeader? header, string? referenceId = EnsureHeadersExist(); if (header is not null && referenceId is not null && !(Components.Headers?.ContainsKey(referenceId) ?? false)) { - Components.Headers ??= []; + Components.Headers ??= new Dictionary(); Components.Headers.Add(referenceId, header); } } @@ -163,7 +163,7 @@ private void AddExampleToComponents(IOpenApiExample? example, string? referenceI EnsureExamplesExist(); if (example is not null && referenceId is not null && !(Components.Examples?.ContainsKey(referenceId) ?? false)) { - Components.Examples ??= []; + Components.Examples ??= new Dictionary(); Components.Examples.Add(referenceId, example); } } @@ -173,7 +173,7 @@ private void AddPathItemToComponents(IOpenApiPathItem? pathItem, string? referen EnsurePathItemsExist(); if (pathItem is not null && referenceId is not null && !(Components.PathItems?.ContainsKey(referenceId) ?? false)) { - Components.PathItems ??= []; + Components.PathItems ??= new Dictionary(); Components.PathItems.Add(referenceId, pathItem); } } @@ -183,7 +183,7 @@ private void AddSecuritySchemeToComponents(IOpenApiSecurityScheme? securitySchem EnsureSecuritySchemesExist(); if (securityScheme is not null && referenceId is not null && !(Components.SecuritySchemes?.ContainsKey(referenceId) ?? false)) { - Components.SecuritySchemes ??= []; + Components.SecuritySchemes ??= new Dictionary(); Components.SecuritySchemes.Add(referenceId, securityScheme); } } @@ -208,7 +208,7 @@ private void EnsureSchemasExist() { if (_target.Components is not null) { - _target.Components.Schemas ??= []; + _target.Components.Schemas ??= new Dictionary(); } } @@ -216,7 +216,7 @@ private void EnsureParametersExist() { if (_target.Components is not null) { - _target.Components.Parameters ??= []; + _target.Components.Parameters ??= new Dictionary(); } } @@ -224,7 +224,7 @@ private void EnsureResponsesExist() { if (_target.Components is not null) { - _target.Components.Responses ??= []; + _target.Components.Responses ??= new Dictionary(); } } @@ -232,7 +232,7 @@ private void EnsureRequestBodiesExist() { if (_target.Components is not null) { - _target.Components.RequestBodies ??= []; + _target.Components.RequestBodies ??= new Dictionary(); } } @@ -240,7 +240,7 @@ private void EnsureExamplesExist() { if (_target.Components is not null) { - _target.Components.Examples ??= []; + _target.Components.Examples ??= new Dictionary(); } } @@ -248,7 +248,7 @@ private void EnsureHeadersExist() { if (_target.Components is not null) { - _target.Components.Headers ??= []; + _target.Components.Headers ??= new Dictionary(); } } @@ -256,7 +256,7 @@ private void EnsureCallbacksExist() { if (_target.Components is not null) { - _target.Components.Callbacks ??= []; + _target.Components.Callbacks ??= new Dictionary(); } } @@ -264,7 +264,7 @@ private void EnsureLinksExist() { if (_target.Components is not null) { - _target.Components.Links ??= []; + _target.Components.Links ??= new Dictionary(); } } @@ -272,14 +272,14 @@ private void EnsureSecuritySchemesExist() { if (_target.Components is not null) { - _target.Components.SecuritySchemes ??= []; + _target.Components.SecuritySchemes ??= new Dictionary(); } } private void EnsurePathItemsExist() { if (_target.Components is not null) { - _target.Components.PathItems = []; + _target.Components.PathItems = new Dictionary(); } } } diff --git a/src/Microsoft.OpenApi/Services/OpenApiUrlTreeNode.cs b/src/Microsoft.OpenApi/Services/OpenApiUrlTreeNode.cs index 5e4029c4d..ab1a33e0b 100644 --- a/src/Microsoft.OpenApi/Services/OpenApiUrlTreeNode.cs +++ b/src/Microsoft.OpenApi/Services/OpenApiUrlTreeNode.cs @@ -21,7 +21,7 @@ public class OpenApiUrlTreeNode /// /// All the subdirectories of a node. /// - public Dictionary Children { get; } = new Dictionary(); + public IDictionary Children { get; } = new Dictionary(); /// /// The relative directory path of the current node from the root node. @@ -31,12 +31,12 @@ public class OpenApiUrlTreeNode /// /// Dictionary of labels and Path Item objects that describe the operations available on a node. /// - public Dictionary PathItems { get; } = new Dictionary(); + public IDictionary PathItems { get; } = new Dictionary(); /// /// A dictionary of key value pairs that contain information about a node. /// - public Dictionary> AdditionalData { get; set; } = new Dictionary>(); + public IDictionary> AdditionalData { get; set; } = new Dictionary>(); /// /// Flag indicating whether a node segment is a path parameter. diff --git a/src/Microsoft.OpenApi/Services/OpenApiVisitorBase.cs b/src/Microsoft.OpenApi/Services/OpenApiVisitorBase.cs index 3f6cb1a92..1ecad08a5 100644 --- a/src/Microsoft.OpenApi/Services/OpenApiVisitorBase.cs +++ b/src/Microsoft.OpenApi/Services/OpenApiVisitorBase.cs @@ -107,7 +107,7 @@ public virtual void Visit(OpenApiPaths paths) /// /// Visits Webhooks> /// - public virtual void Visit(Dictionary webhooks) + public virtual void Visit(IDictionary webhooks) { } @@ -128,7 +128,7 @@ public virtual void Visit(OpenApiServerVariable serverVariable) /// /// Visits the operations. /// - public virtual void Visit(Dictionary operations) + public virtual void Visit(IDictionary operations) { } @@ -163,14 +163,14 @@ public virtual void Visit(IOpenApiRequestBody requestBody) /// /// Visits headers. /// - public virtual void Visit(Dictionary headers) + public virtual void Visit(IDictionary headers) { } /// /// Visits callbacks. /// - public virtual void Visit(Dictionary callbacks) + public virtual void Visit(IDictionary callbacks) { } @@ -191,7 +191,7 @@ public virtual void Visit(OpenApiResponses response) /// /// Visits media type content. /// - public virtual void Visit(Dictionary content) + public virtual void Visit(IDictionary content) { } @@ -212,7 +212,7 @@ public virtual void Visit(OpenApiEncoding encoding) /// /// Visits the examples. /// - public virtual void Visit(Dictionary examples) + public virtual void Visit(IDictionary examples) { } @@ -240,7 +240,7 @@ public virtual void Visit(IOpenApiSchema schema) /// /// Visits the links. /// - public virtual void Visit(Dictionary links) + public virtual void Visit(IDictionary links) { } @@ -352,7 +352,7 @@ public virtual void Visit(List example) /// /// Visits a dictionary of server variables /// - public virtual void Visit(Dictionary serverVariables) + public virtual void Visit(IDictionary serverVariables) { } @@ -360,7 +360,7 @@ public virtual void Visit(Dictionary serverVariab /// Visits a dictionary of encodings /// /// - public virtual void Visit(Dictionary encodings) + public virtual void Visit(IDictionary encodings) { } diff --git a/src/Microsoft.OpenApi/Services/OpenApiWalker.cs b/src/Microsoft.OpenApi/Services/OpenApiWalker.cs index ac8027bae..c31b59cf5 100644 --- a/src/Microsoft.OpenApi/Services/OpenApiWalker.cs +++ b/src/Microsoft.OpenApi/Services/OpenApiWalker.cs @@ -282,7 +282,7 @@ internal void Walk(OpenApiPaths paths) /// /// Visits Webhooks and child objects /// - internal void Walk(Dictionary? webhooks) + internal void Walk(IDictionary? webhooks) { if (webhooks == null) { @@ -488,7 +488,7 @@ internal void Walk(OpenApiServer? server) /// /// Visits dictionary of /// - internal void Walk(Dictionary? serverVariables) + internal void Walk(IDictionary? serverVariables) { if (serverVariables == null) { @@ -565,7 +565,7 @@ internal void Walk(IOpenApiPathItem pathItem, bool isComponent = false) /// /// Visits dictionary of /// - internal void Walk(Dictionary? operations) + internal void Walk(IDictionary? operations) { if (operations == null) { @@ -747,7 +747,7 @@ internal void Walk(IOpenApiRequestBody? requestBody, bool isComponent = false) /// /// Visits dictionary of /// - internal void Walk(Dictionary? headers) + internal void Walk(IDictionary? headers) { if (headers == null) { @@ -769,7 +769,7 @@ internal void Walk(Dictionary? headers) /// /// Visits dictionary of /// - internal void Walk(Dictionary? callbacks) + internal void Walk(IDictionary? callbacks) { if (callbacks == null) { @@ -791,7 +791,7 @@ internal void Walk(Dictionary? callbacks) /// /// Visits dictionary of /// - internal void Walk(Dictionary? content) + internal void Walk(IDictionary? content) { if (content == null) { @@ -831,7 +831,7 @@ internal void Walk(OpenApiMediaType mediaType) /// /// Visits dictionary of /// - internal void Walk(Dictionary? encodings) + internal void Walk(IDictionary? encodings) { if (encodings == null) { @@ -966,7 +966,7 @@ internal void Walk(OpenApiDiscriminator? openApiDiscriminator) /// /// Visits dictionary of /// - internal void Walk(Dictionary? examples) + internal void Walk(IDictionary? examples) { if (examples == null) { @@ -1091,7 +1091,7 @@ internal void Walk(OpenApiOAuthFlow oAuthFlow) /// /// Visits dictionary of and child objects /// - internal void Walk(Dictionary? links) + internal void Walk(IDictionary? links) { if (links == null) { diff --git a/src/Microsoft.OpenApi/Validations/OpenApiValidator.cs b/src/Microsoft.OpenApi/Validations/OpenApiValidator.cs index 850d23635..bcfe3dc85 100644 --- a/src/Microsoft.OpenApi/Validations/OpenApiValidator.cs +++ b/src/Microsoft.OpenApi/Validations/OpenApiValidator.cs @@ -149,21 +149,21 @@ public void AddWarning(OpenApiValidatorWarning warning) /// public override void Visit(OpenApiOperation operation) => Validate(operation); /// - public override void Visit(Dictionary operations) => Validate(operations, operations.GetType()); + public override void Visit(IDictionary operations) => Validate(operations, operations.GetType()); /// - public override void Visit(Dictionary headers) => Validate(headers, headers.GetType()); + public override void Visit(IDictionary headers) => Validate(headers, headers.GetType()); /// - public override void Visit(Dictionary callbacks) => Validate(callbacks, callbacks.GetType()); + public override void Visit(IDictionary callbacks) => Validate(callbacks, callbacks.GetType()); /// - public override void Visit(Dictionary content) => Validate(content, content.GetType()); + public override void Visit(IDictionary content) => Validate(content, content.GetType()); /// - public override void Visit(Dictionary examples) => Validate(examples, examples.GetType()); + public override void Visit(IDictionary examples) => Validate(examples, examples.GetType()); /// - public override void Visit(Dictionary links) => Validate(links, links.GetType()); + public override void Visit(IDictionary links) => Validate(links, links.GetType()); /// - public override void Visit(Dictionary serverVariables) => Validate(serverVariables, serverVariables.GetType()); + public override void Visit(IDictionary serverVariables) => Validate(serverVariables, serverVariables.GetType()); /// - public override void Visit(Dictionary encodings) => Validate(encodings, encodings.GetType()); + public override void Visit(IDictionary encodings) => Validate(encodings, encodings.GetType()); private void Validate(T item) { diff --git a/src/Microsoft.OpenApi/Validations/Rules/OpenApiNonDefaultRules.cs b/src/Microsoft.OpenApi/Validations/Rules/OpenApiNonDefaultRules.cs index 34d84b796..70dc7396a 100644 --- a/src/Microsoft.OpenApi/Validations/Rules/OpenApiNonDefaultRules.cs +++ b/src/Microsoft.OpenApi/Validations/Rules/OpenApiNonDefaultRules.cs @@ -90,7 +90,7 @@ public static class OpenApiNonDefaultRules private static void ValidateMismatchedDataType(IValidationContext context, string ruleName, JsonNode? example, - Dictionary? examples, + IDictionary? examples, IOpenApiSchema? schema) { // example diff --git a/src/Microsoft.OpenApi/Writers/OpenApiWriterAnyExtensions.cs b/src/Microsoft.OpenApi/Writers/OpenApiWriterAnyExtensions.cs index 4e46c5bf1..82fb33ccf 100644 --- a/src/Microsoft.OpenApi/Writers/OpenApiWriterAnyExtensions.cs +++ b/src/Microsoft.OpenApi/Writers/OpenApiWriterAnyExtensions.cs @@ -22,7 +22,7 @@ public static class OpenApiWriterAnyExtensions /// The Open API writer. /// The specification extensions. /// Version of the OpenAPI specification that that will be output. - public static void WriteExtensions(this IOpenApiWriter writer, Dictionary? extensions, OpenApiSpecVersion specVersion) + public static void WriteExtensions(this IOpenApiWriter writer, IDictionary? extensions, OpenApiSpecVersion specVersion) { Utils.CheckArgumentNull(writer); diff --git a/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs b/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs index c799171c5..0e7087554 100644 --- a/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs +++ b/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs @@ -266,7 +266,7 @@ public static void WriteRequiredCollection( public static void WriteRequiredMap( this IOpenApiWriter writer, string name, - Dictionary? elements, + IDictionary? elements, Action action) { writer.WriteMapInternal(name, elements, action); @@ -282,7 +282,7 @@ public static void WriteRequiredMap( public static void WriteOptionalMap( this IOpenApiWriter writer, string name, - Dictionary? elements, + IDictionary? elements, Action action) { if (elements != null && elements.Any()) @@ -301,7 +301,7 @@ public static void WriteOptionalMap( public static void WriteOptionalMap( this IOpenApiWriter writer, string name, - Dictionary? elements, + IDictionary? elements, Action action) { if (elements != null && elements.Any()) @@ -320,7 +320,7 @@ public static void WriteOptionalMap( public static void WriteOptionalMap( this IOpenApiWriter writer, string name, - Dictionary? elements, + IDictionary? elements, Action action) { if (elements != null && elements.Any()) @@ -339,7 +339,7 @@ public static void WriteOptionalMap( public static void WriteOptionalMap( this IOpenApiWriter writer, string name, - Dictionary>? elements, + IDictionary>? elements, Action> action) { if (elements != null && elements.Any()) @@ -359,7 +359,7 @@ public static void WriteOptionalMap( public static void WriteOptionalMap( this IOpenApiWriter writer, string name, - Dictionary? elements, + IDictionary? elements, Action action) where T : IOpenApiElement { @@ -380,7 +380,7 @@ public static void WriteOptionalMap( public static void WriteOptionalMap( this IOpenApiWriter writer, string name, - Dictionary? elements, + IDictionary? elements, Action action) where T : IOpenApiElement { @@ -401,7 +401,7 @@ public static void WriteOptionalMap( public static void WriteRequiredMap( this IOpenApiWriter writer, string name, - Dictionary? elements, + IDictionary? elements, Action action) where T : IOpenApiElement { @@ -439,7 +439,7 @@ private static void WriteCollectionInternal( private static void WriteMapInternal( this IOpenApiWriter writer, string name, - Dictionary? elements, + IDictionary? elements, Action action) { WriteMapInternal(writer, name, elements, (w, _, s) => action(w, s)); @@ -448,7 +448,7 @@ private static void WriteMapInternal( private static void WriteMapInternal( this IOpenApiWriter writer, string name, - Dictionary? elements, + IDictionary? elements, Action action) { Utils.CheckArgumentNull(action); diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs index 0e618ba1b..15ddf9e17 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs @@ -1,6 +1,8 @@ using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Hidi.Formatters; +using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; +using Microsoft.OpenApi.Models.Interfaces; using Microsoft.OpenApi.Services; using Xunit; @@ -123,7 +125,7 @@ private static OpenApiDocument GetSampleOpenApiDocument() { Name = "ids", In = ParameterLocation.Query, - Content = new() + Content = new Dictionary() { { "application/json", @@ -142,7 +144,7 @@ private static OpenApiDocument GetSampleOpenApiDocument() } } ], - Extensions = new() + Extensions = new Dictionary() { { "x-ms-docs-operation-type", new JsonNodeExtension("function") @@ -156,12 +158,12 @@ private static OpenApiDocument GetSampleOpenApiDocument() }, Components = new() { - Schemas = new() + Schemas = new Dictionary() { { "TestSchema", new OpenApiSchema { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { { "averageAudioDegradation", new OpenApiSchema diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index 3335f6b7f..535e04a2c 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. using Microsoft.OpenApi.Extensions; +using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.Interfaces; using Microsoft.OpenApi.Models.References; @@ -97,7 +98,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Success", - Content = new() + Content = new Dictionary() { { applicationJsonMediaType, @@ -158,7 +159,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Success", - Content = new() + Content = new Dictionary() { { applicationJsonMediaType, @@ -206,7 +207,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Retrieved entities", - Content = new() + Content = new Dictionary() { { applicationJsonMediaType, @@ -216,7 +217,7 @@ public static OpenApiDocument CreateOpenApiDocument() { Title = "Collection of user", Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { { "value", @@ -252,7 +253,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Retrieved entity", - Content = new() + Content = new Dictionary() { { applicationJsonMediaType, @@ -315,7 +316,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Retrieved navigation property", - Content = new() + Content = new Dictionary() { { applicationJsonMediaType, @@ -362,7 +363,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Success", - Content = new() + Content = new Dictionary() { { applicationJsonMediaType, @@ -419,7 +420,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Retrieved navigation property", - Content = new() + Content = new Dictionary() { { applicationJsonMediaType, @@ -429,7 +430,7 @@ public static OpenApiDocument CreateOpenApiDocument() { Title = "Collection of hostSecurityProfile", Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { { "value", @@ -471,7 +472,7 @@ public static OpenApiDocument CreateOpenApiDocument() { Type = JsonSchemaType.String }, - Extensions = new() + Extensions = new Dictionary() { { "x-ms-docs-key-type", new JsonNodeExtension("call") @@ -488,7 +489,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - Extensions = new() + Extensions = new Dictionary() { { "x-ms-docs-operation-type", new JsonNodeExtension("action") @@ -519,7 +520,7 @@ public static OpenApiDocument CreateOpenApiDocument() { Type = JsonSchemaType.String }, - Extensions = new() + Extensions = new Dictionary() { { "x-ms-docs-key-type", new JsonNodeExtension("group") @@ -536,7 +537,7 @@ public static OpenApiDocument CreateOpenApiDocument() { Type = JsonSchemaType.String }, - Extensions = new() + Extensions = new Dictionary() { { "x-ms-docs-key-type", new JsonNodeExtension("event") @@ -550,7 +551,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Success", - Content = new() + Content = new Dictionary() { { applicationJsonMediaType, @@ -558,7 +559,7 @@ public static OpenApiDocument CreateOpenApiDocument() { Schema = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { { "value", @@ -575,7 +576,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - Extensions = new() + Extensions = new Dictionary() { { "x-ms-docs-operation-type", new JsonNodeExtension("function") @@ -601,14 +602,14 @@ public static OpenApiDocument CreateOpenApiDocument() }, Components = new() { - Schemas = new() + Schemas = new Dictionary() { { "microsoft.graph.networkInterface", new OpenApiSchema { Title = "networkInterface", Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { { "description", new OpenApiSchema diff --git a/test/Microsoft.OpenApi.Readers.Tests/ReferenceService/TryLoadReferenceV2Tests.cs b/test/Microsoft.OpenApi.Readers.Tests/ReferenceService/TryLoadReferenceV2Tests.cs index 4336a29f8..1301a172d 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/ReferenceService/TryLoadReferenceV2Tests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/ReferenceService/TryLoadReferenceV2Tests.cs @@ -72,7 +72,7 @@ public async Task LoadResponseReference() new OpenApiResponse { Description = "Entity not found.", - Content = new() + Content = new Dictionary() { ["application/json"] = new() } @@ -89,7 +89,7 @@ public async Task LoadResponseAndSchemaReference() var expected = new OpenApiResponse { Description = "General Error", - Content = new() + Content = new Dictionary() { ["application/json"] = new() { diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs index c557ade80..fff31f6e3 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs @@ -76,7 +76,7 @@ public async Task ShouldParseProducesInAnyOrder() var okSchema = new OpenApiSchema { - Properties = new() + Properties = new Dictionary() { { "id", new OpenApiSchema { @@ -89,7 +89,7 @@ public async Task ShouldParseProducesInAnyOrder() var errorSchema = new OpenApiSchema { - Properties = new() + Properties = new Dictionary() { { "code", new OpenApiSchema { @@ -151,7 +151,7 @@ public async Task ShouldParseProducesInAnyOrder() ["200"] = new OpenApiResponse() { Description = "An OK response", - Content = new() + Content = new Dictionary() { ["application/json"] = okMediaType, ["application/xml"] = okMediaType, @@ -160,7 +160,7 @@ public async Task ShouldParseProducesInAnyOrder() ["default"] = new OpenApiResponse() { Description = "An error response", - Content = new() + Content = new Dictionary() { ["application/json"] = errorMediaType, ["application/xml"] = errorMediaType @@ -175,7 +175,7 @@ public async Task ShouldParseProducesInAnyOrder() ["200"] = new OpenApiResponse() { Description = "An OK response", - Content = new() + Content = new Dictionary() { ["html/text"] = okMediaType } @@ -183,7 +183,7 @@ public async Task ShouldParseProducesInAnyOrder() ["default"] = new OpenApiResponse() { Description = "An error response", - Content = new() + Content = new Dictionary() { ["html/text"] = errorMediaType } @@ -197,7 +197,7 @@ public async Task ShouldParseProducesInAnyOrder() ["200"] = new OpenApiResponse() { Description = "An OK response", - Content = new() + Content = new Dictionary() { ["application/json"] = okMediaType, ["application/xml"] = okMediaType, @@ -206,7 +206,7 @@ public async Task ShouldParseProducesInAnyOrder() ["default"] = new OpenApiResponse() { Description = "An error response", - Content = new() + Content = new Dictionary() { ["application/json"] = errorMediaType, ["application/xml"] = errorMediaType @@ -219,7 +219,7 @@ public async Task ShouldParseProducesInAnyOrder() }, Components = new() { - Schemas = new() + Schemas = new Dictionary() { ["Item"] = okSchema, ["Error"] = errorSchema diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs index 811feec75..9cb298f9b 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs @@ -9,6 +9,7 @@ using System.Threading.Tasks; using FluentAssertions; using Microsoft.OpenApi.Extensions; +using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.Interfaces; using Microsoft.OpenApi.Models.References; @@ -50,7 +51,7 @@ public class OpenApiOperationTests ["200"] = new OpenApiResponse { Description = "Pet updated.", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType(), ["application/xml"] = new OpenApiMediaType() @@ -82,7 +83,7 @@ public class OpenApiOperationTests { Description = "Pet to update with", Required = true, - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -92,7 +93,7 @@ public class OpenApiOperationTests } } }, - Extensions = new() + Extensions = new Dictionary() { [OpenApiConstants.BodyName] = new JsonNodeExtension("petObject") } @@ -102,7 +103,7 @@ public class OpenApiOperationTests ["200"] = new OpenApiResponse { Description = "Pet updated.", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType(), ["application/xml"] = new OpenApiMediaType() @@ -111,7 +112,7 @@ public class OpenApiOperationTests ["405"] = new OpenApiResponse { Description = "Invalid input", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType(), ["application/xml"] = new OpenApiMediaType() @@ -213,7 +214,7 @@ public void ParseOperationWithResponseExamplesShouldSucceed() { "200", new OpenApiResponse() { Description = "An array of float response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType() { @@ -532,7 +533,7 @@ public async Task SerializesBodyReferencesWorks() openApiDocument.AddComponent("UserRequest", new OpenApiRequestBody { Description = "User creation request body", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiPathItemTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiPathItemTests.cs index 7079b4b5a..5dc15b8bc 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiPathItemTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiPathItemTests.cs @@ -64,14 +64,14 @@ public class OpenApiPathItemTests ], RequestBody = new OpenApiRequestBody() { - Content = new() + Content = new Dictionary() { ["application/x-www-form-urlencoded"] = new() { Schema = new OpenApiSchema() { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["name"] = new OpenApiSchema() { @@ -95,7 +95,7 @@ public class OpenApiPathItemTests Schema = new OpenApiSchema() { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["name"] = new OpenApiSchema() { @@ -121,7 +121,7 @@ public class OpenApiPathItemTests ["200"] = new OpenApiResponse() { Description = "Pet updated.", - Content = new() + Content = new Dictionary() { ["application/json"] = new(), ["application/xml"] = new() @@ -130,7 +130,7 @@ public class OpenApiPathItemTests ["405"] = new OpenApiResponse() { Description = "Invalid input", - Content = new() + Content = new Dictionary() { ["application/json"] = new(), ["application/xml"] = new() @@ -170,14 +170,14 @@ public class OpenApiPathItemTests ], RequestBody = new OpenApiRequestBody() { - Content = new() + Content = new Dictionary() { ["application/x-www-form-urlencoded"] = new() { Schema = new OpenApiSchema() { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["name"] = new OpenApiSchema() { @@ -206,7 +206,7 @@ public class OpenApiPathItemTests Schema = new OpenApiSchema() { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["name"] = new OpenApiSchema() { @@ -237,7 +237,7 @@ public class OpenApiPathItemTests ["200"] = new OpenApiResponse() { Description = "Pet updated.", - Content = new() + Content = new Dictionary() { ["application/json"] = new(), ["application/xml"] = new() diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiSchemaTests.cs index bb81366c1..9b0461924 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiSchemaTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiSchemaTests.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. +using System.Collections.Generic; using System.IO; using System.Text.Json.Nodes; using System.Threading.Tasks; @@ -8,6 +9,7 @@ using FluentAssertions.Equivalency; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; +using Microsoft.OpenApi.Models.Interfaces; using Microsoft.OpenApi.Models.References; using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Reader.ParseNodes; @@ -111,7 +113,7 @@ public void PropertiesReferenceShouldWork() var targetSchema = new OpenApiSchema() { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["prop1"] = new OpenApiSchema() { @@ -119,7 +121,7 @@ public void PropertiesReferenceShouldWork() } } }; - workingDocument.Components.Schemas = new() + workingDocument.Components.Schemas = new Dictionary() { [referenceId] = targetSchema }; @@ -127,7 +129,7 @@ public void PropertiesReferenceShouldWork() var referenceSchema = new OpenApiSchema() { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["propA"] = new OpenApiSchemaReference(referenceId, workingDocument), } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs index 8fac3953e..d542ca401 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs @@ -32,7 +32,7 @@ public async Task ParseDocumentWithWebhooksShouldSucceed() var components = new OpenApiComponents { - Schemas = new() + Schemas = new Dictionary() { ["petSchema"] = new OpenApiSchema() { @@ -46,7 +46,7 @@ public async Task ParseDocumentWithWebhooksShouldSucceed() { { "tag", new HashSet { "category" } } }, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -78,7 +78,7 @@ public async Task ParseDocumentWithWebhooksShouldSucceed() { { "tag", new HashSet { "category" } } }, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -154,7 +154,7 @@ public async Task ParseDocumentWithWebhooksShouldSucceed() ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -182,7 +182,7 @@ public async Task ParseDocumentWithWebhooksShouldSucceed() { Description = "Information about a new pet in the system", Required = true, - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -195,7 +195,7 @@ public async Task ParseDocumentWithWebhooksShouldSucceed() ["200"] = new OpenApiResponse { Description = "Return a 200 status to indicate that the data was received successfully", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -224,7 +224,7 @@ public async Task ParseDocumentsWithReusablePathItemInWebhooksSucceeds() var components = new OpenApiComponents { - Schemas = new() + Schemas = new Dictionary() { ["petSchema"] = new OpenApiSchema() { @@ -238,7 +238,7 @@ public async Task ParseDocumentsWithReusablePathItemInWebhooksSucceeds() { { "tag", new HashSet { "category" } } }, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -270,7 +270,7 @@ public async Task ParseDocumentsWithReusablePathItemInWebhooksSucceeds() { { "tag", new HashSet { "category" } } }, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -344,7 +344,7 @@ public async Task ParseDocumentsWithReusablePathItemInWebhooksSucceeds() ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -372,7 +372,7 @@ public async Task ParseDocumentsWithReusablePathItemInWebhooksSucceeds() { Description = "Information about a new pet in the system", Required = true, - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -385,7 +385,7 @@ public async Task ParseDocumentsWithReusablePathItemInWebhooksSucceeds() ["200"] = new OpenApiResponse { Description = "Return a 200 status to indicate that the data was received successfully", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -447,7 +447,7 @@ public async Task ParseDocumentWithPatternPropertiesInSchemaWorks() var expectedSchema = new OpenApiSchema { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["prop1"] = new OpenApiSchema { @@ -462,7 +462,7 @@ public async Task ParseDocumentWithPatternPropertiesInSchemaWorks() Type = JsonSchemaType.String } }, - PatternProperties = new() + PatternProperties = new Dictionary() { ["^x-.*$"] = new OpenApiSchema { diff --git a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs index 6277f1755..364058628 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs @@ -41,7 +41,7 @@ public async Task ParseBasicV31SchemaShouldSucceed() Schema = new Uri("https://json-schema.org/draft/2020-12/schema"), Description = "A representation of a person, company, organization, or place", Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["fruits"] = new OpenApiSchema { @@ -70,7 +70,7 @@ public async Task ParseBasicV31SchemaShouldSucceed() { { "veggieType", new HashSet { "veggieColor", "veggieSize" } } }, - Properties = new() + Properties = new Dictionary() { ["veggieName"] = new OpenApiSchema { @@ -181,7 +181,7 @@ public async Task ParseV31SchemaShouldSucceed() var expectedSchema = new OpenApiSchema { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["one"] = new OpenApiSchema() { @@ -205,7 +205,7 @@ public async Task ParseAdvancedV31SchemaShouldSucceed() var expectedSchema = new OpenApiSchema { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["one"] = new OpenApiSchema() { diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs index d6b393404..6b16c037b 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs @@ -190,7 +190,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() var components = new OpenApiComponents { - Schemas = new() + Schemas = new Dictionary() { ["pet1"] = new OpenApiSchema() { @@ -200,7 +200,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() "id", "name" }, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -224,7 +224,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() { "name" }, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -249,7 +249,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() "code", "message" }, - Properties = new() + Properties = new Dictionary() { ["code"] = new OpenApiSchema() { @@ -343,7 +343,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -366,7 +366,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -377,7 +377,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -395,7 +395,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() { Description = "Pet to add to the store", Required = true, - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -408,7 +408,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -419,7 +419,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -430,7 +430,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -471,7 +471,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -486,7 +486,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -497,7 +497,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -535,7 +535,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -546,7 +546,7 @@ public async Task ParseStandardPetStoreDocumentShouldSucceed() ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -576,7 +576,7 @@ public async Task ParseModifiedPetStoreDocumentWithTagAndSecurityShouldSucceed() var components = new OpenApiComponents { - Schemas = new() + Schemas = new Dictionary() { ["pet1"] = new OpenApiSchema() { @@ -586,7 +586,7 @@ public async Task ParseModifiedPetStoreDocumentWithTagAndSecurityShouldSucceed() "id", "name" }, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -610,7 +610,7 @@ public async Task ParseModifiedPetStoreDocumentWithTagAndSecurityShouldSucceed() { "name" }, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -635,7 +635,7 @@ public async Task ParseModifiedPetStoreDocumentWithTagAndSecurityShouldSucceed() "code", "message" }, - Properties = new() + Properties = new Dictionary() { ["code"] = new OpenApiSchema() { @@ -767,7 +767,7 @@ public async Task ParseModifiedPetStoreDocumentWithTagAndSecurityShouldSucceed() ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -790,7 +790,7 @@ public async Task ParseModifiedPetStoreDocumentWithTagAndSecurityShouldSucceed() ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -801,7 +801,7 @@ public async Task ParseModifiedPetStoreDocumentWithTagAndSecurityShouldSucceed() ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -824,7 +824,7 @@ public async Task ParseModifiedPetStoreDocumentWithTagAndSecurityShouldSucceed() { Description = "Pet to add to the store", Required = true, - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -837,7 +837,7 @@ public async Task ParseModifiedPetStoreDocumentWithTagAndSecurityShouldSucceed() ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -848,7 +848,7 @@ public async Task ParseModifiedPetStoreDocumentWithTagAndSecurityShouldSucceed() ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -859,7 +859,7 @@ public async Task ParseModifiedPetStoreDocumentWithTagAndSecurityShouldSucceed() ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -912,7 +912,7 @@ [new OpenApiSecuritySchemeReference("securitySchemeName2")] = ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -927,7 +927,7 @@ [new OpenApiSecuritySchemeReference("securitySchemeName2")] = ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -938,7 +938,7 @@ [new OpenApiSecuritySchemeReference("securitySchemeName2")] = ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -976,7 +976,7 @@ [new OpenApiSecuritySchemeReference("securitySchemeName2")] = ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -987,7 +987,7 @@ [new OpenApiSecuritySchemeReference("securitySchemeName2")] = ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -1247,7 +1247,7 @@ public async Task SerializesDoubleHopeReferences() { Type = JsonSchemaType.Object, Description = "A pet", - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema { @@ -1282,7 +1282,7 @@ public async Task SerializesDoubleHopeReferences() ["200"] = new OpenApiResponse { Description = "A list of pets", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiParameterTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiParameterTests.cs index 7765545aa..0430591fc 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiParameterTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiParameterTests.cs @@ -110,7 +110,7 @@ public async Task ParseQueryParameterWithObjectTypeAndContentShouldSucceed() { In = ParameterLocation.Query, Name = "coordinates", - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -122,7 +122,7 @@ public async Task ParseQueryParameterWithObjectTypeAndContentShouldSucceed() "lat", "long" }, - Properties = new() + Properties = new Dictionary() { ["lat"] = new OpenApiSchema() { diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs index 55b403a8b..bd4570e5e 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs @@ -10,6 +10,7 @@ using FluentAssertions.Equivalency; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; +using Microsoft.OpenApi.Models.Interfaces; using Microsoft.OpenApi.Models.References; using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Reader.ParseNodes; @@ -195,7 +196,7 @@ public void ParseBasicSchemaWithExampleShouldSucceed() new OpenApiSchema { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -241,12 +242,12 @@ public async Task ParseBasicSchemaWithReferenceShouldSucceed() var expectedComponents = new OpenApiComponents { - Schemas = new() + Schemas = new Dictionary() { ["ErrorModel"] = new OpenApiSchema() { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["code"] = new OpenApiSchema() { @@ -274,7 +275,7 @@ public async Task ParseBasicSchemaWithReferenceShouldSucceed() { Type = JsonSchemaType.Object, Required = new HashSet {"rootCause"}, - Properties = new() + Properties = new Dictionary() { ["rootCause"] = new OpenApiSchema() { @@ -298,7 +299,7 @@ public async Task ParseAdvancedSchemaWithReferenceShouldSucceed() var expectedComponents = new OpenApiComponents { - Schemas = new() + Schemas = new Dictionary() { ["Pet"] = new OpenApiSchema() { @@ -307,7 +308,7 @@ public async Task ParseAdvancedSchemaWithReferenceShouldSucceed() { PropertyName = "petType" }, - Properties = new() + Properties = new Dictionary() { ["name"] = new OpenApiSchema() { @@ -334,7 +335,7 @@ public async Task ParseAdvancedSchemaWithReferenceShouldSucceed() { Type = JsonSchemaType.Object, Required = new HashSet{"huntingSkill"}, - Properties = new() + Properties = new Dictionary() { ["huntingSkill"] = new OpenApiSchema() { @@ -362,7 +363,7 @@ public async Task ParseAdvancedSchemaWithReferenceShouldSucceed() { Type = JsonSchemaType.Object, Required = new HashSet{"packSize"}, - Properties = new() + Properties = new Dictionary() { ["packSize"] = new OpenApiSchema() { @@ -404,7 +405,7 @@ public async Task ParseExternalReferenceSchemaShouldSucceed() var expectedComponents = new OpenApiComponents { - Schemas = new() + Schemas = new Dictionary() { ["RelativePathModel"] = new OpenApiSchema() { diff --git a/test/Microsoft.OpenApi.Tests/Mocks/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Tests/Mocks/OpenApiDocumentMock.cs index 84accabea..9762110f9 100644 --- a/test/Microsoft.OpenApi.Tests/Mocks/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Tests/Mocks/OpenApiDocumentMock.cs @@ -43,7 +43,7 @@ public static OpenApiDocument CreateCompleteOpenApiDocument() ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.cs index a6f724c66..1b90ee8d6 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.cs @@ -33,7 +33,7 @@ public class OpenApiCallbackTests { RequestBody = new OpenApiRequestBody() { - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -73,7 +73,7 @@ public class OpenApiCallbackTests { RequestBody = new OpenApiRequestBody() { - Content = new() + Content = new Dictionary() { ["application/json"] = new() { diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiComponentsTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiComponentsTests.cs index 65c53b322..116c2579a 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiComponentsTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiComponentsTests.cs @@ -17,11 +17,11 @@ public class OpenApiComponentsTests { public static OpenApiComponents AdvancedComponents = new() { - Schemas = new() + Schemas = new Dictionary() { ["schema1"] = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { ["property2"] = new OpenApiSchema() { @@ -66,11 +66,11 @@ public class OpenApiComponentsTests public static OpenApiComponents AdvancedComponentsWithReference = new() { - Schemas = new() + Schemas = new Dictionary() { ["schema1"] = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { ["property2"] = new OpenApiSchema() { @@ -81,7 +81,7 @@ public class OpenApiComponentsTests }, ["schema2"] = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { ["property2"] = new OpenApiSchema() { @@ -123,7 +123,7 @@ public class OpenApiComponentsTests public static OpenApiComponents BrokenComponents = new() { - Schemas = new() + Schemas = new Dictionary() { ["schema1"] = new OpenApiSchema() { @@ -151,13 +151,13 @@ public class OpenApiComponentsTests public static OpenApiComponents TopLevelReferencingComponents = new() { - Schemas = new() + Schemas = new Dictionary() { ["schema1"] = new OpenApiSchemaReference("schema2", null), ["schema2"] = new OpenApiSchema() { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["property1"] = new OpenApiSchema() { @@ -170,12 +170,12 @@ public class OpenApiComponentsTests public static OpenApiComponents TopLevelSelfReferencingComponentsWithOtherProperties = new() { - Schemas = new() + Schemas = new Dictionary() { ["schema1"] = new OpenApiSchema() { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["property1"] = new OpenApiSchema() { @@ -186,7 +186,7 @@ public class OpenApiComponentsTests ["schema2"] = new OpenApiSchema() { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["property1"] = new OpenApiSchema() { @@ -199,7 +199,7 @@ public class OpenApiComponentsTests public static OpenApiComponents TopLevelSelfReferencingComponents = new() { - Schemas = new() + Schemas = new Dictionary() { ["schema1"] = new OpenApiSchemaReference("schema1", null) } @@ -207,11 +207,11 @@ public class OpenApiComponentsTests public static OpenApiComponents ComponentsWithPathItem = new OpenApiComponents { - Schemas = new() + Schemas = new Dictionary() { ["schema1"] = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { ["property2"] = new OpenApiSchema() { @@ -223,7 +223,7 @@ public class OpenApiComponentsTests ["schema2"] = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { ["property2"] = new OpenApiSchema() { @@ -243,7 +243,7 @@ public class OpenApiComponentsTests RequestBody = new OpenApiRequestBody { Description = "Information about a new pet in the system", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiContactTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiContactTests.cs index 5f729b884..08d501510 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiContactTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiContactTests.cs @@ -1,8 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. +using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.OpenApi.Extensions; +using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; using Xunit; @@ -18,7 +20,7 @@ public class OpenApiContactTests Name = "API Support", Url = new("http://www.example.com/support"), Email = "support@example.com", - Extensions = new() + Extensions = new Dictionary() { {"x-internal-id", new JsonNodeExtension(42)} } diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs index 993de7a2d..da22a3300 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs @@ -8,6 +8,7 @@ using System.Net.Http; using System.Threading.Tasks; using Microsoft.OpenApi.Extensions; +using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.Interfaces; using Microsoft.OpenApi.Models.References; @@ -22,13 +23,13 @@ public class OpenApiDocumentTests { public static readonly OpenApiComponents TopLevelReferencingComponents = new OpenApiComponents() { - Schemas = new() + Schemas = new Dictionary() { ["schema1"] = new OpenApiSchemaReference("schema2", null), ["schema2"] = new OpenApiSchema() { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["property1"] = new OpenApiSchema() { @@ -42,12 +43,12 @@ public class OpenApiDocumentTests public static readonly OpenApiComponents TopLevelSelfReferencingComponentsWithOtherProperties = new OpenApiComponents() { - Schemas = new() + Schemas = new Dictionary() { ["schema1"] = new OpenApiSchema() { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["property1"] = new OpenApiSchema() { @@ -60,7 +61,7 @@ public class OpenApiDocumentTests ["schema2"] = new OpenApiSchema() { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["property1"] = new OpenApiSchema() { @@ -74,7 +75,7 @@ public class OpenApiDocumentTests public static readonly OpenApiComponents TopLevelSelfReferencingComponents = new OpenApiComponents() { - Schemas = new() + Schemas = new Dictionary() { ["schema1"] = new OpenApiSchema() { @@ -114,7 +115,7 @@ public class OpenApiDocumentTests public static readonly OpenApiComponents AdvancedComponentsWithReference = new OpenApiComponents { - Schemas = new() + Schemas = new Dictionary() { ["pet"] = new OpenApiSchema() { @@ -124,7 +125,7 @@ public class OpenApiDocumentTests "id", "name" }, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -148,7 +149,7 @@ public class OpenApiDocumentTests { "name" }, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -173,7 +174,7 @@ public class OpenApiDocumentTests "code", "message" }, - Properties = new() + Properties = new Dictionary() { ["code"] = new OpenApiSchema() { @@ -269,7 +270,7 @@ public class OpenApiDocumentTests ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -292,7 +293,7 @@ public class OpenApiDocumentTests ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -303,7 +304,7 @@ public class OpenApiDocumentTests ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -321,7 +322,7 @@ public class OpenApiDocumentTests { Description = "Pet to add to the store", Required = true, - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -334,7 +335,7 @@ public class OpenApiDocumentTests ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -345,7 +346,7 @@ public class OpenApiDocumentTests ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -356,7 +357,7 @@ public class OpenApiDocumentTests ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -397,7 +398,7 @@ public class OpenApiDocumentTests ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -412,7 +413,7 @@ public class OpenApiDocumentTests ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -423,7 +424,7 @@ public class OpenApiDocumentTests ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -461,7 +462,7 @@ public class OpenApiDocumentTests ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -472,7 +473,7 @@ public class OpenApiDocumentTests ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -491,7 +492,7 @@ public class OpenApiDocumentTests public static readonly OpenApiComponents AdvancedComponents = new OpenApiComponents { - Schemas = new() + Schemas = new Dictionary() { ["pet"] = new OpenApiSchema() { @@ -501,7 +502,7 @@ public class OpenApiDocumentTests "id", "name" }, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -525,7 +526,7 @@ public class OpenApiDocumentTests { "name" }, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -550,7 +551,7 @@ public class OpenApiDocumentTests "code", "message" }, - Properties = new() + Properties = new Dictionary() { ["code"] = new OpenApiSchema() { @@ -645,7 +646,7 @@ public class OpenApiDocumentTests ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -668,7 +669,7 @@ public class OpenApiDocumentTests ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -679,7 +680,7 @@ public class OpenApiDocumentTests ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -697,7 +698,7 @@ public class OpenApiDocumentTests { Description = "Pet to add to the store", Required = true, - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -710,7 +711,7 @@ public class OpenApiDocumentTests ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -721,7 +722,7 @@ public class OpenApiDocumentTests ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -732,7 +733,7 @@ public class OpenApiDocumentTests ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -773,7 +774,7 @@ public class OpenApiDocumentTests ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -788,7 +789,7 @@ public class OpenApiDocumentTests ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -799,7 +800,7 @@ public class OpenApiDocumentTests ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -837,7 +838,7 @@ public class OpenApiDocumentTests ["4XX"] = new OpenApiResponse { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -848,7 +849,7 @@ public class OpenApiDocumentTests ["5XX"] = new OpenApiResponse { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new OpenApiMediaType { @@ -883,7 +884,7 @@ public class OpenApiDocumentTests RequestBody = new OpenApiRequestBody { Description = "Information about a new pet in the system", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -904,7 +905,7 @@ public class OpenApiDocumentTests }, Components = new OpenApiComponents { - Schemas = new() + Schemas = new Dictionary() { ["Pet"] = new OpenApiSchema() { @@ -912,7 +913,7 @@ public class OpenApiDocumentTests { "id", "name" }, - Properties = new() + Properties = new Dictionary() { ["id"] = new OpenApiSchema() { @@ -968,12 +969,12 @@ public class OpenApiDocumentTests Schema = new OpenApiSchema() { Type = JsonSchemaType.Integer, - Extensions = new() + Extensions = new Dictionary() { ["my-extension"] = new JsonNodeExtension(4) } }, - Extensions = new() + Extensions = new Dictionary() { ["my-extension"] = new JsonNodeExtension(4), } @@ -987,12 +988,12 @@ public class OpenApiDocumentTests Schema = new OpenApiSchema() { Type = JsonSchemaType.Integer, - Extensions = new() + Extensions = new Dictionary() { ["my-extension"] = new JsonNodeExtension(4) } }, - Extensions = new() + Extensions = new Dictionary() { ["my-extension"] = new JsonNodeExtension(4), } @@ -1003,7 +1004,7 @@ public class OpenApiDocumentTests ["200"] = new OpenApiResponse { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -1104,7 +1105,7 @@ public class OpenApiDocumentTests ["200"] = new OpenApiResponse() { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -1127,7 +1128,7 @@ public class OpenApiDocumentTests ["4XX"] = new OpenApiResponse() { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new() { @@ -1138,7 +1139,7 @@ public class OpenApiDocumentTests ["5XX"] = new OpenApiResponse() { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new() { @@ -1156,7 +1157,7 @@ public class OpenApiDocumentTests { Description = "Pet to add to the store", Required = true, - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -1169,7 +1170,7 @@ public class OpenApiDocumentTests ["200"] = new OpenApiResponse() { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -1180,7 +1181,7 @@ public class OpenApiDocumentTests ["4XX"] = new OpenApiResponse() { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new() { @@ -1191,7 +1192,7 @@ public class OpenApiDocumentTests ["5XX"] = new OpenApiResponse() { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new() { @@ -1232,7 +1233,7 @@ public class OpenApiDocumentTests ["200"] = new OpenApiResponse() { Description = "pet response", - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -1247,7 +1248,7 @@ public class OpenApiDocumentTests ["4XX"] = new OpenApiResponse() { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new() { @@ -1258,7 +1259,7 @@ public class OpenApiDocumentTests ["5XX"] = new OpenApiResponse() { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new() { @@ -1296,7 +1297,7 @@ public class OpenApiDocumentTests ["4XX"] = new OpenApiResponse() { Description = "unexpected client error", - Content = new() + Content = new Dictionary() { ["text/html"] = new() { @@ -1307,7 +1308,7 @@ public class OpenApiDocumentTests ["5XX"] = new OpenApiResponse() { Description = "unexpected server error", - Content = new() + Content = new Dictionary() { ["text/html"] = new() { @@ -1538,7 +1539,7 @@ public async Task SerializeDocumentWithReferenceButNoComponents() { ["200"] = new OpenApiResponse { - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType { @@ -1795,7 +1796,7 @@ public async Task SerializeV2DocumentWithStyleAsNullDoesNotWriteOutStyleValue() ["200"] = new OpenApiResponse { Description = "foo", - Content = new() + Content = new Dictionary() { ["text/plain"] = new OpenApiMediaType { @@ -1826,7 +1827,7 @@ public void OpenApiDocumentCopyConstructorWithAnnotationsSucceeds() { var baseDocument = new OpenApiDocument { - Metadata = new() + Metadata = new Dictionary { ["key1"] = "value1", ["key2"] = 2 @@ -1857,7 +1858,7 @@ public void SerializeExamplesDoesNotThrowNullReferenceException() { RequestBody = new OpenApiRequestBody() { - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType() { @@ -2074,7 +2075,7 @@ public async Task SerializeDocumentTagsWithMultipleExtensionsWorks() new OpenApiTag { Name = "tag1", - Extensions = new() + Extensions = new Dictionary() { ["x-tag1"] = new JsonNodeExtension("tag1") } @@ -2082,7 +2083,7 @@ public async Task SerializeDocumentTagsWithMultipleExtensionsWorks() new OpenApiTag { Name = "tag2", - Extensions = new() + Extensions = new Dictionary() { ["x-tag2"] = new JsonNodeExtension("tag2") } @@ -2103,7 +2104,7 @@ public void DeduplicatesTags() new OpenApiTag { Name = "tag1", - Extensions = new() + Extensions = new Dictionary() { ["x-tag1"] = new JsonNodeExtension("tag1") } @@ -2111,7 +2112,7 @@ public void DeduplicatesTags() new OpenApiTag { Name = "tag2", - Extensions = new() + Extensions = new Dictionary() { ["x-tag2"] = new JsonNodeExtension("tag2") } @@ -2119,7 +2120,7 @@ public void DeduplicatesTags() new OpenApiTag { Name = "tag1", - Extensions = new() + Extensions = new Dictionary() { ["x-tag1"] = new JsonNodeExtension("tag1") } diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiInfoTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiInfoTests.cs index 3145ee146..92592ce60 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiInfoTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiInfoTests.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.OpenApi.Extensions; +using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; using Xunit; @@ -20,7 +21,7 @@ public class OpenApiInfoTests Contact = OpenApiContactTests.AdvanceContact, License = OpenApiLicenseTests.AdvanceLicense, Version = "1.1.1", - Extensions = new() + Extensions = new Dictionary() { {"x-updated", new JsonNodeExtension("metadata")} } diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiLicenseTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiLicenseTests.cs index 114ac6945..8fe139606 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiLicenseTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiLicenseTests.cs @@ -1,8 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. +using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.OpenApi.Extensions; +using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; using Xunit; @@ -20,7 +22,7 @@ public class OpenApiLicenseTests { Name = "Apache 2.0", Url = new("http://www.apache.org/licenses/LICENSE-2.0.html"), - Extensions = new() + Extensions = new Dictionary() { {"x-copyright", new JsonNodeExtension("Abc")} } diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.cs index 0d1be7130..4379191e8 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using Microsoft.OpenApi.Expressions; using Microsoft.OpenApi.Extensions; +using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; using Microsoft.OpenApi.Writers; @@ -125,7 +126,7 @@ public void LinkExtensionsSerializationWorks() // Arrange var link = new OpenApiLink() { - Extensions = new() + Extensions = new Dictionary() { { "x-display", new JsonNodeExtension("Abc") } diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs index 6eff288ad..322481e9a 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiMediaTypeTests.cs @@ -437,7 +437,7 @@ public void MediaTypeCopyConstructorWorks() Example = 42, Examples = new Dictionary(), Encoding = new Dictionary(), - Extensions = new() + Extensions = new Dictionary() }; // Assert diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiOperationTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiOperationTests.cs index 351365065..104079f56 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiOperationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiOperationTests.cs @@ -45,7 +45,7 @@ public class OpenApiOperationTests { Description = "description2", Required = true, - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -63,7 +63,7 @@ public class OpenApiOperationTests ["200"] = new OpenApiResponseReference("response1"), ["400"] = new OpenApiResponse() { - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -119,7 +119,7 @@ public class OpenApiOperationTests { Description = "description2", Required = true, - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -137,7 +137,7 @@ public class OpenApiOperationTests ["200"] = new OpenApiResponseReference("response1"), ["400"] = new OpenApiResponse() { - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -223,13 +223,13 @@ private static OpenApiDocument __advancedOperationWithTagsAndSecurity_supporting ], RequestBody = new OpenApiRequestBody() { - Content = new() + Content = new Dictionary() { ["application/x-www-form-urlencoded"] = new() { Schema = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { ["name"] = new OpenApiSchema() { @@ -252,7 +252,7 @@ private static OpenApiDocument __advancedOperationWithTagsAndSecurity_supporting { Schema = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { ["name"] = new OpenApiSchema() { diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.cs index 8d037629b..d83aba7a8 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.cs @@ -20,7 +20,7 @@ public class OpenApiRequestBodyTests { Description = "description", Required = true, - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -37,7 +37,7 @@ public class OpenApiRequestBodyTests { Description = "description", Required = true, - Content = new() + Content = new Dictionary() { ["application/json"] = new() { diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.cs index 64a111e9d..a6a9b91f4 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.cs @@ -6,6 +6,7 @@ using System.IO; using System.Threading.Tasks; using Microsoft.OpenApi.Extensions; +using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.Interfaces; using Microsoft.OpenApi.Models.References; @@ -33,7 +34,7 @@ public class OpenApiResponseTests Items = new OpenApiSchemaReference("customType", null) }, Example = "Blabla", - Extensions = new() + Extensions = new Dictionary() { ["myextension"] = new JsonNodeExtension("myextensionvalue"), }, @@ -72,7 +73,7 @@ public class OpenApiResponseTests Items = new OpenApiSchemaReference("customType", null) }, Example = "Blabla", - Extensions = new() + Extensions = new Dictionary() { ["myextension"] = new JsonNodeExtension("myextensionvalue"), }, diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs index 82f1ac11b..2b5345736 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs @@ -9,6 +9,7 @@ using System.Threading.Tasks; using FluentAssertions; using Microsoft.OpenApi.Extensions; +using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.Interfaces; using Microsoft.OpenApi.Services; @@ -42,11 +43,11 @@ public class OpenApiSchemaTests public static readonly OpenApiSchema AdvancedSchemaObject = new() { Title = "title1", - Properties = new() + Properties = new Dictionary() { ["property1"] = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { ["property2"] = new OpenApiSchema() { @@ -61,11 +62,11 @@ public class OpenApiSchemaTests }, ["property4"] = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { ["property5"] = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { ["property6"] = new OpenApiSchema() { @@ -96,7 +97,7 @@ public class OpenApiSchemaTests new OpenApiSchema() { Title = "title2", - Properties = new() + Properties = new Dictionary() { ["property1"] = new OpenApiSchema() { @@ -112,11 +113,11 @@ public class OpenApiSchemaTests new OpenApiSchema() { Title = "title3", - Properties = new() + Properties = new Dictionary() { ["property3"] = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { ["property4"] = new OpenApiSchema() { @@ -159,12 +160,12 @@ public class OpenApiSchemaTests { Title = "title1", Required = new HashSet { "property1" }, - Properties = new() + Properties = new Dictionary() { ["property1"] = new OpenApiSchema() { Required = new HashSet { "property3" }, - Properties = new() + Properties = new Dictionary() { ["property2"] = new OpenApiSchema() { @@ -181,11 +182,11 @@ public class OpenApiSchemaTests }, ["property4"] = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { ["property5"] = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { ["property6"] = new OpenApiSchema() { @@ -534,7 +535,7 @@ public void CloningSchemaExtensionsWorks() // Arrange var schema = new OpenApiSchema { - Extensions = new() + Extensions = new Dictionary() { { "x-myextension", new JsonNodeExtension(42) } } @@ -545,7 +546,7 @@ public void CloningSchemaExtensionsWorks() Assert.Single(schemaCopy.Extensions); // Act && Assert - schemaCopy.Extensions = new() + schemaCopy.Extensions = new Dictionary() { { "x-myextension" , new JsonNodeExtension(40) } }; diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.cs index 2cb7f1da6..c8199a85a 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.cs @@ -25,7 +25,7 @@ public class OpenApiTagTests Name = "pet", Description = "Pets operations", ExternalDocs = OpenApiExternalDocsTests.AdvanceExDocs, - Extensions = new() + Extensions = new Dictionary() { {"x-tag-extension", null} } diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiXmlTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiXmlTests.cs index 6848d2e3d..d190ae20e 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiXmlTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiXmlTests.cs @@ -1,8 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. +using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.OpenApi.Extensions; +using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; using Xunit; @@ -18,7 +20,7 @@ public class OpenApiXmlTests Prefix = "sample", Wrapped = true, Attribute = true, - Extensions = new() + Extensions = new Dictionary() { {"x-xml-extension", new JsonNodeExtension(7)} } diff --git a/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt b/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt index 25c5ccda7..e75dd5e9e 100644 --- a/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt +++ b/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt @@ -197,12 +197,12 @@ namespace Microsoft.OpenApi.Interfaces public interface IDiagnostic { } public interface IMetadataContainer { - System.Collections.Generic.Dictionary? Metadata { get; set; } + System.Collections.Generic.IDictionary? Metadata { get; set; } } public interface IOpenApiElement { } public interface IOpenApiExtensible : Microsoft.OpenApi.Interfaces.IOpenApiElement { - System.Collections.Generic.Dictionary? Extensions { get; set; } + System.Collections.Generic.IDictionary? Extensions { get; set; } } public interface IOpenApiExtension { @@ -210,7 +210,7 @@ namespace Microsoft.OpenApi.Interfaces } public interface IOpenApiReadOnlyExtensible { - System.Collections.Generic.Dictionary? Extensions { get; } + System.Collections.Generic.IDictionary? Extensions { get; } } public interface IOpenApiReader { @@ -347,10 +347,10 @@ namespace Microsoft.OpenApi.Models.Interfaces { bool AllowEmptyValue { get; } bool AllowReserved { get; } - System.Collections.Generic.Dictionary? Content { get; } + System.Collections.Generic.IDictionary? Content { get; } bool Deprecated { get; } System.Text.Json.Nodes.JsonNode? Example { get; } - System.Collections.Generic.Dictionary? Examples { get; } + System.Collections.Generic.IDictionary? Examples { get; } bool Explode { get; } bool Required { get; } Microsoft.OpenApi.Models.Interfaces.IOpenApiSchema? Schema { get; } @@ -360,7 +360,7 @@ namespace Microsoft.OpenApi.Models.Interfaces { string? OperationId { get; } string? OperationRef { get; } - System.Collections.Generic.Dictionary? Parameters { get; } + System.Collections.Generic.IDictionary? Parameters { get; } Microsoft.OpenApi.Models.RuntimeExpressionAnyWrapper? RequestBody { get; } Microsoft.OpenApi.Models.OpenApiServer? Server { get; } } @@ -368,10 +368,10 @@ namespace Microsoft.OpenApi.Models.Interfaces { bool AllowEmptyValue { get; } bool AllowReserved { get; } - System.Collections.Generic.Dictionary? Content { get; } + System.Collections.Generic.IDictionary? Content { get; } bool Deprecated { get; } System.Text.Json.Nodes.JsonNode? Example { get; } - System.Collections.Generic.Dictionary? Examples { get; } + System.Collections.Generic.IDictionary? Examples { get; } bool Explode { get; } Microsoft.OpenApi.Models.ParameterLocation? In { get; } string? Name { get; } @@ -391,16 +391,16 @@ namespace Microsoft.OpenApi.Models.Interfaces } public interface IOpenApiRequestBody : Microsoft.OpenApi.Interfaces.IOpenApiElement, Microsoft.OpenApi.Interfaces.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.Interfaces.IOpenApiReferenceable, Microsoft.OpenApi.Interfaces.IOpenApiSerializable, Microsoft.OpenApi.Interfaces.IShallowCopyable, Microsoft.OpenApi.Models.Interfaces.IOpenApiDescribedElement { - System.Collections.Generic.Dictionary? Content { get; } + System.Collections.Generic.IDictionary? Content { get; } bool Required { get; } Microsoft.OpenApi.Models.Interfaces.IOpenApiParameter? ConvertToBodyParameter(Microsoft.OpenApi.Writers.IOpenApiWriter writer); System.Collections.Generic.IEnumerable? ConvertToFormDataParameters(Microsoft.OpenApi.Writers.IOpenApiWriter writer); } public interface IOpenApiResponse : Microsoft.OpenApi.Interfaces.IOpenApiElement, Microsoft.OpenApi.Interfaces.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.Interfaces.IOpenApiReferenceable, Microsoft.OpenApi.Interfaces.IOpenApiSerializable, Microsoft.OpenApi.Interfaces.IShallowCopyable, Microsoft.OpenApi.Models.Interfaces.IOpenApiDescribedElement { - System.Collections.Generic.Dictionary? Content { get; } - System.Collections.Generic.Dictionary? Headers { get; } - System.Collections.Generic.Dictionary? Links { get; } + System.Collections.Generic.IDictionary? Content { get; } + System.Collections.Generic.IDictionary? Headers { get; } + System.Collections.Generic.IDictionary? Links { get; } } public interface IOpenApiSchema : Microsoft.OpenApi.Interfaces.IOpenApiElement, Microsoft.OpenApi.Interfaces.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.Interfaces.IOpenApiReferenceable, Microsoft.OpenApi.Interfaces.IOpenApiSerializable, Microsoft.OpenApi.Interfaces.IShallowCopyable, Microsoft.OpenApi.Models.Interfaces.IOpenApiDescribedElement { @@ -411,8 +411,8 @@ namespace Microsoft.OpenApi.Models.Interfaces string? Comment { get; } string? Const { get; } System.Text.Json.Nodes.JsonNode? Default { get; } - System.Collections.Generic.Dictionary? Definitions { get; } - System.Collections.Generic.Dictionary>? DependentRequired { get; } + System.Collections.Generic.IDictionary? Definitions { get; } + System.Collections.Generic.IDictionary>? DependentRequired { get; } bool Deprecated { get; } Microsoft.OpenApi.Models.OpenApiDiscriminator? Discriminator { get; } string? DynamicAnchor { get; } @@ -438,8 +438,8 @@ namespace Microsoft.OpenApi.Models.Interfaces Microsoft.OpenApi.Models.Interfaces.IOpenApiSchema? Not { get; } System.Collections.Generic.List? OneOf { get; } string? Pattern { get; } - System.Collections.Generic.Dictionary? PatternProperties { get; } - System.Collections.Generic.Dictionary? Properties { get; } + System.Collections.Generic.IDictionary? PatternProperties { get; } + System.Collections.Generic.IDictionary? Properties { get; } bool ReadOnly { get; } System.Collections.Generic.HashSet? Required { get; } System.Uri? Schema { get; } @@ -447,8 +447,8 @@ namespace Microsoft.OpenApi.Models.Interfaces Microsoft.OpenApi.Models.JsonSchemaType? Type { get; } bool UnevaluatedProperties { get; } bool? UniqueItems { get; } - System.Collections.Generic.Dictionary? UnrecognizedKeywords { get; } - System.Collections.Generic.Dictionary? Vocabulary { get; } + System.Collections.Generic.IDictionary? UnrecognizedKeywords { get; } + System.Collections.Generic.IDictionary? Vocabulary { get; } bool WriteOnly { get; } Microsoft.OpenApi.Models.OpenApiXml? Xml { get; } } @@ -488,7 +488,7 @@ namespace Microsoft.OpenApi.Models public class OpenApiCallback : Microsoft.OpenApi.Interfaces.IOpenApiElement, Microsoft.OpenApi.Interfaces.IOpenApiExtensible, Microsoft.OpenApi.Interfaces.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.Interfaces.IOpenApiReferenceable, Microsoft.OpenApi.Interfaces.IOpenApiSerializable, Microsoft.OpenApi.Interfaces.IShallowCopyable, Microsoft.OpenApi.Models.Interfaces.IOpenApiCallback { public OpenApiCallback() { } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public System.Collections.Generic.Dictionary? PathItems { get; set; } public void AddPathItem(Microsoft.OpenApi.Expressions.RuntimeExpression expression, Microsoft.OpenApi.Models.Interfaces.IOpenApiPathItem pathItem) { } public Microsoft.OpenApi.Models.Interfaces.IOpenApiCallback CreateShallowCopy() { } @@ -500,17 +500,17 @@ namespace Microsoft.OpenApi.Models { public OpenApiComponents() { } public OpenApiComponents(Microsoft.OpenApi.Models.OpenApiComponents? components) { } - public System.Collections.Generic.Dictionary? Callbacks { get; set; } - public System.Collections.Generic.Dictionary? Examples { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } - public System.Collections.Generic.Dictionary? Headers { get; set; } - public System.Collections.Generic.Dictionary? Links { get; set; } - public System.Collections.Generic.Dictionary? Parameters { get; set; } - public System.Collections.Generic.Dictionary? PathItems { get; set; } - public System.Collections.Generic.Dictionary? RequestBodies { get; set; } - public System.Collections.Generic.Dictionary? Responses { get; set; } - public System.Collections.Generic.Dictionary? Schemas { get; set; } - public System.Collections.Generic.Dictionary? SecuritySchemes { get; set; } + public System.Collections.Generic.IDictionary? Callbacks { get; set; } + public System.Collections.Generic.IDictionary? Examples { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Headers { get; set; } + public System.Collections.Generic.IDictionary? Links { get; set; } + public System.Collections.Generic.IDictionary? Parameters { get; set; } + public System.Collections.Generic.IDictionary? PathItems { get; set; } + public System.Collections.Generic.IDictionary? RequestBodies { get; set; } + public System.Collections.Generic.IDictionary? Responses { get; set; } + public System.Collections.Generic.IDictionary? Schemas { get; set; } + public System.Collections.Generic.IDictionary? SecuritySchemes { get; set; } public virtual void SerializeAsV2(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } public virtual void SerializeAsV3(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } public virtual void SerializeAsV31(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } @@ -678,7 +678,7 @@ namespace Microsoft.OpenApi.Models public OpenApiContact() { } public OpenApiContact(Microsoft.OpenApi.Models.OpenApiContact contact) { } public string? Email { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public string? Name { get; set; } public System.Uri? Url { get; set; } public virtual void SerializeAsV2(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } @@ -689,8 +689,8 @@ namespace Microsoft.OpenApi.Models { public OpenApiDiscriminator() { } public OpenApiDiscriminator(Microsoft.OpenApi.Models.OpenApiDiscriminator discriminator) { } - public System.Collections.Generic.Dictionary? Extensions { get; set; } - public System.Collections.Generic.Dictionary? Mapping { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Mapping { get; set; } public string? PropertyName { get; set; } public void SerializeAsV2(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } public void SerializeAsV3(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } @@ -702,16 +702,16 @@ namespace Microsoft.OpenApi.Models public OpenApiDocument(Microsoft.OpenApi.Models.OpenApiDocument? document) { } public System.Uri BaseUri { get; } public Microsoft.OpenApi.Models.OpenApiComponents? Components { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public Microsoft.OpenApi.Models.OpenApiExternalDocs? ExternalDocs { get; set; } public Microsoft.OpenApi.Models.OpenApiInfo Info { get; set; } public System.Uri? JsonSchemaDialect { get; set; } - public System.Collections.Generic.Dictionary? Metadata { get; set; } + public System.Collections.Generic.IDictionary? Metadata { get; set; } public Microsoft.OpenApi.Models.OpenApiPaths Paths { get; set; } public System.Collections.Generic.List? Security { get; set; } public System.Collections.Generic.List? Servers { get; set; } public System.Collections.Generic.HashSet? Tags { get; set; } - public System.Collections.Generic.Dictionary? Webhooks { get; set; } + public System.Collections.Generic.IDictionary? Webhooks { get; set; } public Microsoft.OpenApi.Services.OpenApiWorkspace? Workspace { get; set; } public bool AddComponent(string id, T componentToRegister) { } public System.Threading.Tasks.Task GetHashCodeAsync(System.Threading.CancellationToken cancellationToken = default) { } @@ -733,8 +733,8 @@ namespace Microsoft.OpenApi.Models public bool? AllowReserved { get; set; } public string? ContentType { get; set; } public bool? Explode { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } - public System.Collections.Generic.Dictionary? Headers { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Headers { get; set; } public Microsoft.OpenApi.Models.ParameterStyle? Style { get; set; } public virtual void SerializeAsV2(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } public virtual void SerializeAsV3(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } @@ -753,7 +753,7 @@ namespace Microsoft.OpenApi.Models { public OpenApiExample() { } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public string? ExternalValue { get; set; } public string? Summary { get; set; } public System.Text.Json.Nodes.JsonNode? Value { get; set; } @@ -767,7 +767,7 @@ namespace Microsoft.OpenApi.Models { protected OpenApiExtensibleDictionary() { } protected OpenApiExtensibleDictionary(System.Collections.Generic.Dictionary dictionary, System.Collections.Generic.Dictionary? extensions = null) { } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public void SerializeAsV2(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } public void SerializeAsV3(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } public void SerializeAsV31(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } @@ -777,7 +777,7 @@ namespace Microsoft.OpenApi.Models public OpenApiExternalDocs() { } public OpenApiExternalDocs(Microsoft.OpenApi.Models.OpenApiExternalDocs externalDocs) { } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public System.Uri? Url { get; set; } public virtual void SerializeAsV2(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } public virtual void SerializeAsV3(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } @@ -788,13 +788,13 @@ namespace Microsoft.OpenApi.Models public OpenApiHeader() { } public bool AllowEmptyValue { get; set; } public bool AllowReserved { get; set; } - public System.Collections.Generic.Dictionary? Content { get; set; } + public System.Collections.Generic.IDictionary? Content { get; set; } public bool Deprecated { get; set; } public string? Description { get; set; } public System.Text.Json.Nodes.JsonNode? Example { get; set; } - public System.Collections.Generic.Dictionary? Examples { get; set; } + public System.Collections.Generic.IDictionary? Examples { get; set; } public bool Explode { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public bool Required { get; set; } public Microsoft.OpenApi.Models.Interfaces.IOpenApiSchema? Schema { get; set; } public Microsoft.OpenApi.Models.ParameterStyle? Style { get; set; } @@ -809,7 +809,7 @@ namespace Microsoft.OpenApi.Models public OpenApiInfo(Microsoft.OpenApi.Models.OpenApiInfo info) { } public Microsoft.OpenApi.Models.OpenApiContact? Contact { get; set; } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public Microsoft.OpenApi.Models.OpenApiLicense? License { get; set; } public string? Summary { get; set; } public System.Uri? TermsOfService { get; set; } @@ -823,7 +823,7 @@ namespace Microsoft.OpenApi.Models { public OpenApiLicense() { } public OpenApiLicense(Microsoft.OpenApi.Models.OpenApiLicense license) { } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public string? Identifier { get; set; } public string? Name { get; set; } public System.Uri? Url { get; set; } @@ -835,10 +835,10 @@ namespace Microsoft.OpenApi.Models { public OpenApiLink() { } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public string? OperationId { get; set; } public string? OperationRef { get; set; } - public System.Collections.Generic.Dictionary? Parameters { get; set; } + public System.Collections.Generic.IDictionary? Parameters { get; set; } public Microsoft.OpenApi.Models.RuntimeExpressionAnyWrapper? RequestBody { get; set; } public Microsoft.OpenApi.Models.OpenApiServer? Server { get; set; } public Microsoft.OpenApi.Models.Interfaces.IOpenApiLink CreateShallowCopy() { } @@ -850,10 +850,10 @@ namespace Microsoft.OpenApi.Models { public OpenApiMediaType() { } public OpenApiMediaType(Microsoft.OpenApi.Models.OpenApiMediaType? mediaType) { } - public System.Collections.Generic.Dictionary? Encoding { get; set; } + public System.Collections.Generic.IDictionary? Encoding { get; set; } public System.Text.Json.Nodes.JsonNode? Example { get; set; } - public System.Collections.Generic.Dictionary? Examples { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Examples { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public Microsoft.OpenApi.Models.Interfaces.IOpenApiSchema? Schema { get; set; } public virtual void SerializeAsV2(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } public virtual void SerializeAsV3(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } @@ -864,9 +864,9 @@ namespace Microsoft.OpenApi.Models public OpenApiOAuthFlow() { } public OpenApiOAuthFlow(Microsoft.OpenApi.Models.OpenApiOAuthFlow oAuthFlow) { } public System.Uri? AuthorizationUrl { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public System.Uri? RefreshUrl { get; set; } - public System.Collections.Generic.Dictionary? Scopes { get; set; } + public System.Collections.Generic.IDictionary? Scopes { get; set; } public System.Uri? TokenUrl { get; set; } public void SerializeAsV2(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } public void SerializeAsV3(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } @@ -878,7 +878,7 @@ namespace Microsoft.OpenApi.Models public OpenApiOAuthFlows(Microsoft.OpenApi.Models.OpenApiOAuthFlows oAuthFlows) { } public Microsoft.OpenApi.Models.OpenApiOAuthFlow? AuthorizationCode { get; set; } public Microsoft.OpenApi.Models.OpenApiOAuthFlow? ClientCredentials { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public Microsoft.OpenApi.Models.OpenApiOAuthFlow? Implicit { get; set; } public Microsoft.OpenApi.Models.OpenApiOAuthFlow? Password { get; set; } public virtual void SerializeAsV2(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } @@ -890,12 +890,12 @@ namespace Microsoft.OpenApi.Models public const bool DeprecatedDefault = false; public OpenApiOperation() { } public OpenApiOperation(Microsoft.OpenApi.Models.OpenApiOperation operation) { } - public System.Collections.Generic.Dictionary? Callbacks { get; set; } + public System.Collections.Generic.IDictionary? Callbacks { get; set; } public bool Deprecated { get; set; } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public Microsoft.OpenApi.Models.OpenApiExternalDocs? ExternalDocs { get; set; } - public System.Collections.Generic.Dictionary? Metadata { get; set; } + public System.Collections.Generic.IDictionary? Metadata { get; set; } public string? OperationId { get; set; } public System.Collections.Generic.List? Parameters { get; set; } public Microsoft.OpenApi.Models.Interfaces.IOpenApiRequestBody? RequestBody { get; set; } @@ -913,13 +913,13 @@ namespace Microsoft.OpenApi.Models public OpenApiParameter() { } public bool AllowEmptyValue { get; set; } public bool AllowReserved { get; set; } - public System.Collections.Generic.Dictionary? Content { get; set; } + public System.Collections.Generic.IDictionary? Content { get; set; } public bool Deprecated { get; set; } public string? Description { get; set; } public System.Text.Json.Nodes.JsonNode? Example { get; set; } - public System.Collections.Generic.Dictionary? Examples { get; set; } + public System.Collections.Generic.IDictionary? Examples { get; set; } public bool Explode { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public Microsoft.OpenApi.Models.ParameterLocation? In { get; set; } public string? Name { get; set; } public bool Required { get; set; } @@ -934,7 +934,7 @@ namespace Microsoft.OpenApi.Models { public OpenApiPathItem() { } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public System.Collections.Generic.Dictionary? Operations { get; set; } public System.Collections.Generic.List? Parameters { get; set; } public System.Collections.Generic.List? Servers { get; set; } @@ -972,9 +972,9 @@ namespace Microsoft.OpenApi.Models public class OpenApiRequestBody : Microsoft.OpenApi.Interfaces.IOpenApiElement, Microsoft.OpenApi.Interfaces.IOpenApiExtensible, Microsoft.OpenApi.Interfaces.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.Interfaces.IOpenApiReferenceable, Microsoft.OpenApi.Interfaces.IOpenApiSerializable, Microsoft.OpenApi.Interfaces.IShallowCopyable, Microsoft.OpenApi.Models.Interfaces.IOpenApiDescribedElement, Microsoft.OpenApi.Models.Interfaces.IOpenApiRequestBody { public OpenApiRequestBody() { } - public System.Collections.Generic.Dictionary? Content { get; set; } + public System.Collections.Generic.IDictionary? Content { get; set; } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public bool Required { get; set; } public Microsoft.OpenApi.Models.Interfaces.IOpenApiParameter ConvertToBodyParameter(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } public System.Collections.Generic.IEnumerable ConvertToFormDataParameters(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } @@ -986,11 +986,11 @@ namespace Microsoft.OpenApi.Models public class OpenApiResponse : Microsoft.OpenApi.Interfaces.IOpenApiElement, Microsoft.OpenApi.Interfaces.IOpenApiExtensible, Microsoft.OpenApi.Interfaces.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.Interfaces.IOpenApiReferenceable, Microsoft.OpenApi.Interfaces.IOpenApiSerializable, Microsoft.OpenApi.Interfaces.IShallowCopyable, Microsoft.OpenApi.Models.Interfaces.IOpenApiDescribedElement, Microsoft.OpenApi.Models.Interfaces.IOpenApiResponse { public OpenApiResponse() { } - public System.Collections.Generic.Dictionary? Content { get; set; } + public System.Collections.Generic.IDictionary? Content { get; set; } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } - public System.Collections.Generic.Dictionary? Headers { get; set; } - public System.Collections.Generic.Dictionary? Links { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Headers { get; set; } + public System.Collections.Generic.IDictionary? Links { get; set; } public Microsoft.OpenApi.Models.Interfaces.IOpenApiResponse CreateShallowCopy() { } public virtual void SerializeAsV2(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } public virtual void SerializeAsV3(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } @@ -1011,8 +1011,8 @@ namespace Microsoft.OpenApi.Models public string? Comment { get; set; } public string? Const { get; set; } public System.Text.Json.Nodes.JsonNode? Default { get; set; } - public System.Collections.Generic.Dictionary? Definitions { get; set; } - public System.Collections.Generic.Dictionary>? DependentRequired { get; set; } + public System.Collections.Generic.IDictionary? Definitions { get; set; } + public System.Collections.Generic.IDictionary>? DependentRequired { get; set; } public bool Deprecated { get; set; } public string? Description { get; set; } public Microsoft.OpenApi.Models.OpenApiDiscriminator? Discriminator { get; set; } @@ -1023,7 +1023,7 @@ namespace Microsoft.OpenApi.Models public System.Collections.Generic.List? Examples { get; set; } public string? ExclusiveMaximum { get; set; } public string? ExclusiveMinimum { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public Microsoft.OpenApi.Models.OpenApiExternalDocs? ExternalDocs { get; set; } public string? Format { get; set; } public string? Id { get; set; } @@ -1032,7 +1032,7 @@ namespace Microsoft.OpenApi.Models public int? MaxLength { get; set; } public int? MaxProperties { get; set; } public string? Maximum { get; set; } - public System.Collections.Generic.Dictionary? Metadata { get; set; } + public System.Collections.Generic.IDictionary? Metadata { get; set; } public int? MinItems { get; set; } public int? MinLength { get; set; } public int? MinProperties { get; set; } @@ -1041,8 +1041,8 @@ namespace Microsoft.OpenApi.Models public Microsoft.OpenApi.Models.Interfaces.IOpenApiSchema? Not { get; set; } public System.Collections.Generic.List? OneOf { get; set; } public string? Pattern { get; set; } - public System.Collections.Generic.Dictionary? PatternProperties { get; set; } - public System.Collections.Generic.Dictionary? Properties { get; set; } + public System.Collections.Generic.IDictionary? PatternProperties { get; set; } + public System.Collections.Generic.IDictionary? Properties { get; set; } public bool ReadOnly { get; set; } public System.Collections.Generic.HashSet? Required { get; set; } public System.Uri? Schema { get; set; } @@ -1050,8 +1050,8 @@ namespace Microsoft.OpenApi.Models public Microsoft.OpenApi.Models.JsonSchemaType? Type { get; set; } public bool UnevaluatedProperties { get; set; } public bool? UniqueItems { get; set; } - public System.Collections.Generic.Dictionary? UnrecognizedKeywords { get; set; } - public System.Collections.Generic.Dictionary? Vocabulary { get; set; } + public System.Collections.Generic.IDictionary? UnrecognizedKeywords { get; set; } + public System.Collections.Generic.IDictionary? Vocabulary { get; set; } public bool WriteOnly { get; set; } public Microsoft.OpenApi.Models.OpenApiXml? Xml { get; set; } public Microsoft.OpenApi.Models.Interfaces.IOpenApiSchema CreateShallowCopy() { } @@ -1071,7 +1071,7 @@ namespace Microsoft.OpenApi.Models public OpenApiSecurityScheme() { } public string? BearerFormat { get; set; } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public Microsoft.OpenApi.Models.OpenApiOAuthFlows? Flows { get; set; } public Microsoft.OpenApi.Models.ParameterLocation? In { get; set; } public string? Name { get; set; } @@ -1088,9 +1088,9 @@ namespace Microsoft.OpenApi.Models public OpenApiServer() { } public OpenApiServer(Microsoft.OpenApi.Models.OpenApiServer server) { } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public string? Url { get; set; } - public System.Collections.Generic.Dictionary? Variables { get; set; } + public System.Collections.Generic.IDictionary? Variables { get; set; } public virtual void SerializeAsV2(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } public virtual void SerializeAsV3(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } public virtual void SerializeAsV31(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } @@ -1102,7 +1102,7 @@ namespace Microsoft.OpenApi.Models public string? Default { get; set; } public string? Description { get; set; } public System.Collections.Generic.List? Enum { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public void SerializeAsV2(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } public void SerializeAsV3(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } public void SerializeAsV31(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } @@ -1111,7 +1111,7 @@ namespace Microsoft.OpenApi.Models { public OpenApiTag() { } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public Microsoft.OpenApi.Models.OpenApiExternalDocs? ExternalDocs { get; set; } public string? Name { get; set; } public Microsoft.OpenApi.Models.Interfaces.IOpenApiTag CreateShallowCopy() { } @@ -1124,7 +1124,7 @@ namespace Microsoft.OpenApi.Models public OpenApiXml() { } public OpenApiXml(Microsoft.OpenApi.Models.OpenApiXml xml) { } public bool Attribute { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public string? Name { get; set; } public System.Uri? Namespace { get; set; } public string? Prefix { get; set; } @@ -1226,7 +1226,7 @@ namespace Microsoft.OpenApi.Models.References public class OpenApiCallbackReference : Microsoft.OpenApi.Models.References.BaseOpenApiReferenceHolder, Microsoft.OpenApi.Interfaces.IOpenApiElement, Microsoft.OpenApi.Interfaces.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.Interfaces.IOpenApiReferenceable, Microsoft.OpenApi.Interfaces.IOpenApiSerializable, Microsoft.OpenApi.Interfaces.IShallowCopyable, Microsoft.OpenApi.Models.Interfaces.IOpenApiCallback { public OpenApiCallbackReference(string referenceId, Microsoft.OpenApi.Models.OpenApiDocument? hostDocument = null, string? externalResource = null) { } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public System.Collections.Generic.Dictionary? PathItems { get; } public override Microsoft.OpenApi.Models.Interfaces.IOpenApiCallback CopyReferenceAsTargetElementWithOverrides(Microsoft.OpenApi.Models.Interfaces.IOpenApiCallback source) { } public Microsoft.OpenApi.Models.Interfaces.IOpenApiCallback CreateShallowCopy() { } @@ -1236,7 +1236,7 @@ namespace Microsoft.OpenApi.Models.References { public OpenApiExampleReference(string referenceId, Microsoft.OpenApi.Models.OpenApiDocument? hostDocument = null, string? externalResource = null) { } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public string? ExternalValue { get; } public string? Summary { get; set; } public System.Text.Json.Nodes.JsonNode? Value { get; } @@ -1249,13 +1249,13 @@ namespace Microsoft.OpenApi.Models.References public OpenApiHeaderReference(string referenceId, Microsoft.OpenApi.Models.OpenApiDocument? hostDocument = null, string? externalResource = null) { } public bool AllowEmptyValue { get; } public bool AllowReserved { get; } - public System.Collections.Generic.Dictionary? Content { get; } + public System.Collections.Generic.IDictionary? Content { get; } public bool Deprecated { get; } public string? Description { get; set; } public System.Text.Json.Nodes.JsonNode? Example { get; } - public System.Collections.Generic.Dictionary? Examples { get; } + public System.Collections.Generic.IDictionary? Examples { get; } public bool Explode { get; } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public bool Required { get; } public Microsoft.OpenApi.Models.Interfaces.IOpenApiSchema? Schema { get; } public Microsoft.OpenApi.Models.ParameterStyle? Style { get; } @@ -1266,10 +1266,10 @@ namespace Microsoft.OpenApi.Models.References { public OpenApiLinkReference(string referenceId, Microsoft.OpenApi.Models.OpenApiDocument? hostDocument = null, string? externalResource = null) { } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public string? OperationId { get; } public string? OperationRef { get; } - public System.Collections.Generic.Dictionary? Parameters { get; } + public System.Collections.Generic.IDictionary? Parameters { get; } public Microsoft.OpenApi.Models.RuntimeExpressionAnyWrapper? RequestBody { get; } public Microsoft.OpenApi.Models.OpenApiServer? Server { get; } public override Microsoft.OpenApi.Models.Interfaces.IOpenApiLink CopyReferenceAsTargetElementWithOverrides(Microsoft.OpenApi.Models.Interfaces.IOpenApiLink source) { } @@ -1281,13 +1281,13 @@ namespace Microsoft.OpenApi.Models.References public OpenApiParameterReference(string referenceId, Microsoft.OpenApi.Models.OpenApiDocument? hostDocument = null, string? externalResource = null) { } public bool AllowEmptyValue { get; } public bool AllowReserved { get; } - public System.Collections.Generic.Dictionary? Content { get; } + public System.Collections.Generic.IDictionary? Content { get; } public bool Deprecated { get; } public string? Description { get; set; } public System.Text.Json.Nodes.JsonNode? Example { get; } - public System.Collections.Generic.Dictionary? Examples { get; } + public System.Collections.Generic.IDictionary? Examples { get; } public bool Explode { get; } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public Microsoft.OpenApi.Models.ParameterLocation? In { get; } public string? Name { get; } public bool Required { get; } @@ -1300,7 +1300,7 @@ namespace Microsoft.OpenApi.Models.References { public OpenApiPathItemReference(string referenceId, Microsoft.OpenApi.Models.OpenApiDocument? hostDocument = null, string? externalResource = null) { } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public System.Collections.Generic.Dictionary? Operations { get; } public System.Collections.Generic.List? Parameters { get; } public System.Collections.Generic.List? Servers { get; } @@ -1312,9 +1312,9 @@ namespace Microsoft.OpenApi.Models.References public class OpenApiRequestBodyReference : Microsoft.OpenApi.Models.References.BaseOpenApiReferenceHolder, Microsoft.OpenApi.Interfaces.IOpenApiElement, Microsoft.OpenApi.Interfaces.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.Interfaces.IOpenApiReferenceable, Microsoft.OpenApi.Interfaces.IOpenApiSerializable, Microsoft.OpenApi.Interfaces.IShallowCopyable, Microsoft.OpenApi.Models.Interfaces.IOpenApiDescribedElement, Microsoft.OpenApi.Models.Interfaces.IOpenApiRequestBody { public OpenApiRequestBodyReference(string referenceId, Microsoft.OpenApi.Models.OpenApiDocument? hostDocument = null, string? externalResource = null) { } - public System.Collections.Generic.Dictionary? Content { get; } + public System.Collections.Generic.IDictionary? Content { get; } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public bool Required { get; } public Microsoft.OpenApi.Models.Interfaces.IOpenApiParameter? ConvertToBodyParameter(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } public System.Collections.Generic.IEnumerable? ConvertToFormDataParameters(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } @@ -1325,11 +1325,11 @@ namespace Microsoft.OpenApi.Models.References public class OpenApiResponseReference : Microsoft.OpenApi.Models.References.BaseOpenApiReferenceHolder, Microsoft.OpenApi.Interfaces.IOpenApiElement, Microsoft.OpenApi.Interfaces.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.Interfaces.IOpenApiReferenceable, Microsoft.OpenApi.Interfaces.IOpenApiSerializable, Microsoft.OpenApi.Interfaces.IShallowCopyable, Microsoft.OpenApi.Models.Interfaces.IOpenApiDescribedElement, Microsoft.OpenApi.Models.Interfaces.IOpenApiResponse { public OpenApiResponseReference(string referenceId, Microsoft.OpenApi.Models.OpenApiDocument? hostDocument = null, string? externalResource = null) { } - public System.Collections.Generic.Dictionary? Content { get; } + public System.Collections.Generic.IDictionary? Content { get; } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; } - public System.Collections.Generic.Dictionary? Headers { get; } - public System.Collections.Generic.Dictionary? Links { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Headers { get; } + public System.Collections.Generic.IDictionary? Links { get; } public override Microsoft.OpenApi.Models.Interfaces.IOpenApiResponse CopyReferenceAsTargetElementWithOverrides(Microsoft.OpenApi.Models.Interfaces.IOpenApiResponse source) { } public Microsoft.OpenApi.Models.Interfaces.IOpenApiResponse CreateShallowCopy() { } } @@ -1343,8 +1343,8 @@ namespace Microsoft.OpenApi.Models.References public string? Comment { get; } public string? Const { get; } public System.Text.Json.Nodes.JsonNode? Default { get; } - public System.Collections.Generic.Dictionary? Definitions { get; } - public System.Collections.Generic.Dictionary>? DependentRequired { get; } + public System.Collections.Generic.IDictionary? Definitions { get; } + public System.Collections.Generic.IDictionary>? DependentRequired { get; } public bool Deprecated { get; } public string? Description { get; set; } public Microsoft.OpenApi.Models.OpenApiDiscriminator? Discriminator { get; } @@ -1355,7 +1355,7 @@ namespace Microsoft.OpenApi.Models.References public System.Collections.Generic.List? Examples { get; } public string? ExclusiveMaximum { get; } public string? ExclusiveMinimum { get; } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public Microsoft.OpenApi.Models.OpenApiExternalDocs? ExternalDocs { get; } public string? Format { get; } public string? Id { get; } @@ -1372,8 +1372,8 @@ namespace Microsoft.OpenApi.Models.References public Microsoft.OpenApi.Models.Interfaces.IOpenApiSchema? Not { get; } public System.Collections.Generic.List? OneOf { get; } public string? Pattern { get; } - public System.Collections.Generic.Dictionary? PatternProperties { get; } - public System.Collections.Generic.Dictionary? Properties { get; } + public System.Collections.Generic.IDictionary? PatternProperties { get; } + public System.Collections.Generic.IDictionary? Properties { get; } public bool ReadOnly { get; } public System.Collections.Generic.HashSet? Required { get; } public System.Uri? Schema { get; } @@ -1381,8 +1381,8 @@ namespace Microsoft.OpenApi.Models.References public Microsoft.OpenApi.Models.JsonSchemaType? Type { get; } public bool UnevaluatedProperties { get; } public bool? UniqueItems { get; } - public System.Collections.Generic.Dictionary? UnrecognizedKeywords { get; } - public System.Collections.Generic.Dictionary? Vocabulary { get; } + public System.Collections.Generic.IDictionary? UnrecognizedKeywords { get; } + public System.Collections.Generic.IDictionary? Vocabulary { get; } public bool WriteOnly { get; } public Microsoft.OpenApi.Models.OpenApiXml? Xml { get; } public override Microsoft.OpenApi.Models.Interfaces.IOpenApiSchema CopyReferenceAsTargetElementWithOverrides(Microsoft.OpenApi.Models.Interfaces.IOpenApiSchema source) { } @@ -1396,7 +1396,7 @@ namespace Microsoft.OpenApi.Models.References public OpenApiSecuritySchemeReference(string referenceId, Microsoft.OpenApi.Models.OpenApiDocument? hostDocument = null, string? externalResource = null) { } public string? BearerFormat { get; } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public Microsoft.OpenApi.Models.OpenApiOAuthFlows? Flows { get; } public Microsoft.OpenApi.Models.ParameterLocation? In { get; } public string? Name { get; } @@ -1410,7 +1410,7 @@ namespace Microsoft.OpenApi.Models.References { public OpenApiTagReference(string referenceId, Microsoft.OpenApi.Models.OpenApiDocument? hostDocument = null, string? externalResource = null) { } public string? Description { get; } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public Microsoft.OpenApi.Models.OpenApiExternalDocs? ExternalDocs { get; } public string? Name { get; } public override Microsoft.OpenApi.Models.Interfaces.IOpenApiTag? Target { get; } @@ -1562,11 +1562,11 @@ namespace Microsoft.OpenApi.Services public class OpenApiUrlTreeNode { public static readonly System.Collections.Generic.IReadOnlyDictionary MermaidNodeStyles; - public System.Collections.Generic.Dictionary> AdditionalData { get; set; } - public System.Collections.Generic.Dictionary Children { get; } + public System.Collections.Generic.IDictionary> AdditionalData { get; set; } + public System.Collections.Generic.IDictionary Children { get; } public bool IsParameter { get; } public string Path { get; set; } - public System.Collections.Generic.Dictionary PathItems { get; } + public System.Collections.Generic.IDictionary PathItems { get; } public string Segment { get; } public void AddAdditionalData(System.Collections.Generic.Dictionary> additionalData) { } public void Attach(Microsoft.OpenApi.Models.OpenApiDocument doc, string label) { } @@ -1613,17 +1613,17 @@ namespace Microsoft.OpenApi.Services public virtual void Visit(Microsoft.OpenApi.Models.OpenApiServerVariable serverVariable) { } public virtual void Visit(Microsoft.OpenApi.Models.OpenApiTag tag) { } public virtual void Visit(Microsoft.OpenApi.Models.References.OpenApiTagReference tag) { } - public virtual void Visit(System.Collections.Generic.Dictionary operations) { } - public virtual void Visit(System.Collections.Generic.Dictionary callbacks) { } - public virtual void Visit(System.Collections.Generic.Dictionary examples) { } - public virtual void Visit(System.Collections.Generic.Dictionary headers) { } - public virtual void Visit(System.Collections.Generic.Dictionary links) { } - public virtual void Visit(System.Collections.Generic.Dictionary webhooks) { } - public virtual void Visit(System.Collections.Generic.Dictionary encodings) { } - public virtual void Visit(System.Collections.Generic.Dictionary content) { } - public virtual void Visit(System.Collections.Generic.Dictionary serverVariables) { } public virtual void Visit(System.Collections.Generic.HashSet openApiTags) { } public virtual void Visit(System.Collections.Generic.HashSet openApiTags) { } + public virtual void Visit(System.Collections.Generic.IDictionary operations) { } + public virtual void Visit(System.Collections.Generic.IDictionary callbacks) { } + public virtual void Visit(System.Collections.Generic.IDictionary examples) { } + public virtual void Visit(System.Collections.Generic.IDictionary headers) { } + public virtual void Visit(System.Collections.Generic.IDictionary links) { } + public virtual void Visit(System.Collections.Generic.IDictionary webhooks) { } + public virtual void Visit(System.Collections.Generic.IDictionary encodings) { } + public virtual void Visit(System.Collections.Generic.IDictionary content) { } + public virtual void Visit(System.Collections.Generic.IDictionary serverVariables) { } public virtual void Visit(System.Collections.Generic.List example) { } public virtual void Visit(System.Collections.Generic.List parameters) { } public virtual void Visit(System.Collections.Generic.List openApiSecurityRequirements) { } @@ -1709,14 +1709,14 @@ namespace Microsoft.OpenApi.Validations public override void Visit(Microsoft.OpenApi.Models.OpenApiServer server) { } public override void Visit(Microsoft.OpenApi.Models.OpenApiServerVariable serverVariable) { } public override void Visit(Microsoft.OpenApi.Models.OpenApiTag tag) { } - public override void Visit(System.Collections.Generic.Dictionary operations) { } - public override void Visit(System.Collections.Generic.Dictionary callbacks) { } - public override void Visit(System.Collections.Generic.Dictionary examples) { } - public override void Visit(System.Collections.Generic.Dictionary headers) { } - public override void Visit(System.Collections.Generic.Dictionary links) { } - public override void Visit(System.Collections.Generic.Dictionary encodings) { } - public override void Visit(System.Collections.Generic.Dictionary content) { } - public override void Visit(System.Collections.Generic.Dictionary serverVariables) { } + public override void Visit(System.Collections.Generic.IDictionary operations) { } + public override void Visit(System.Collections.Generic.IDictionary callbacks) { } + public override void Visit(System.Collections.Generic.IDictionary examples) { } + public override void Visit(System.Collections.Generic.IDictionary headers) { } + public override void Visit(System.Collections.Generic.IDictionary links) { } + public override void Visit(System.Collections.Generic.IDictionary encodings) { } + public override void Visit(System.Collections.Generic.IDictionary content) { } + public override void Visit(System.Collections.Generic.IDictionary serverVariables) { } public override void Visit(System.Collections.Generic.List example) { } } public class OpenApiValidatorError : Microsoft.OpenApi.Models.OpenApiError @@ -1911,7 +1911,7 @@ namespace Microsoft.OpenApi.Writers public static class OpenApiWriterAnyExtensions { public static void WriteAny(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, System.Text.Json.Nodes.JsonNode? node) { } - public static void WriteExtensions(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, System.Collections.Generic.Dictionary? extensions, Microsoft.OpenApi.OpenApiSpecVersion specVersion) { } + public static void WriteExtensions(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, System.Collections.Generic.IDictionary? extensions, Microsoft.OpenApi.OpenApiSpecVersion specVersion) { } } public abstract class OpenApiWriterBase : Microsoft.OpenApi.Writers.IOpenApiWriter { @@ -1958,13 +1958,13 @@ namespace Microsoft.OpenApi.Writers { public static void WriteOptionalCollection(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, string name, System.Collections.Generic.IEnumerable? elements, System.Action action) { } public static void WriteOptionalCollection(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, string name, System.Collections.Generic.IEnumerable? elements, System.Action action) { } - public static void WriteOptionalMap(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, string name, System.Collections.Generic.Dictionary>? elements, System.Action> action) { } - public static void WriteOptionalMap(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, string name, System.Collections.Generic.Dictionary? elements, System.Action action) { } - public static void WriteOptionalMap(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, string name, System.Collections.Generic.Dictionary? elements, System.Action action) { } - public static void WriteOptionalMap(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, string name, System.Collections.Generic.Dictionary? elements, System.Action action) { } - public static void WriteOptionalMap(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, string name, System.Collections.Generic.Dictionary? elements, System.Action action) + public static void WriteOptionalMap(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, string name, System.Collections.Generic.IDictionary>? elements, System.Action> action) { } + public static void WriteOptionalMap(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, string name, System.Collections.Generic.IDictionary? elements, System.Action action) { } + public static void WriteOptionalMap(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, string name, System.Collections.Generic.IDictionary? elements, System.Action action) { } + public static void WriteOptionalMap(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, string name, System.Collections.Generic.IDictionary? elements, System.Action action) { } + public static void WriteOptionalMap(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, string name, System.Collections.Generic.IDictionary? elements, System.Action action) where T : Microsoft.OpenApi.Interfaces.IOpenApiElement { } - public static void WriteOptionalMap(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, string name, System.Collections.Generic.Dictionary? elements, System.Action action) + public static void WriteOptionalMap(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, string name, System.Collections.Generic.IDictionary? elements, System.Action action) where T : Microsoft.OpenApi.Interfaces.IOpenApiElement { } public static void WriteOptionalObject(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, string name, T? value, System.Action action) { } public static void WriteOptionalOrEmptyCollection(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, string name, System.Collections.Generic.IEnumerable? elements, System.Action action) { } @@ -1977,8 +1977,8 @@ namespace Microsoft.OpenApi.Writers where T : struct { } public static void WriteRequiredCollection(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, string name, System.Collections.Generic.IEnumerable elements, System.Action action) where T : Microsoft.OpenApi.Interfaces.IOpenApiElement { } - public static void WriteRequiredMap(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, string name, System.Collections.Generic.Dictionary? elements, System.Action action) { } - public static void WriteRequiredMap(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, string name, System.Collections.Generic.Dictionary? elements, System.Action action) + public static void WriteRequiredMap(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, string name, System.Collections.Generic.IDictionary? elements, System.Action action) { } + public static void WriteRequiredMap(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, string name, System.Collections.Generic.IDictionary? elements, System.Action action) where T : Microsoft.OpenApi.Interfaces.IOpenApiElement { } public static void WriteRequiredObject(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, string name, T? value, System.Action action) { } public static void WriteRequiredProperty(this Microsoft.OpenApi.Writers.IOpenApiWriter writer, string name, string? value) { } diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiReferenceValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiReferenceValidationTests.cs index 0fb23578b..582721754 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiReferenceValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiReferenceValidationTests.cs @@ -29,7 +29,7 @@ public void ReferencedSchemaShouldOnlyBeValidatedOnce() var document = new OpenApiDocument(); document.Components = new() { - Schemas = new() + Schemas = new Dictionary() { ["test"] = sharedSchema } @@ -47,7 +47,7 @@ public void ReferencedSchemaShouldOnlyBeValidatedOnce() { ["200"] = new OpenApiResponse() { - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -101,7 +101,7 @@ public void UnresolvedSchemaReferencedShouldNotBeValidated() { ["200"] = new OpenApiResponse() { - Content = new() + Content = new Dictionary() { ["application/json"] = new() { diff --git a/test/Microsoft.OpenApi.Tests/Visitors/InheritanceTests.cs b/test/Microsoft.OpenApi.Tests/Visitors/InheritanceTests.cs index 030e60581..563648526 100644 --- a/test/Microsoft.OpenApi.Tests/Visitors/InheritanceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Visitors/InheritanceTests.cs @@ -143,7 +143,7 @@ public override void Visit(OpenApiServerVariable serverVariable) base.Visit(serverVariable); } - public override void Visit(Dictionary operations) + public override void Visit(IDictionary operations) { EncodeCall(); base.Visit(operations); @@ -173,13 +173,13 @@ public override void Visit(IOpenApiRequestBody requestBody) base.Visit(requestBody); } - public override void Visit(Dictionary headers) + public override void Visit(IDictionary headers) { EncodeCall(); base.Visit(headers); } - public override void Visit(Dictionary callbacks) + public override void Visit(IDictionary callbacks) { EncodeCall(); base.Visit(callbacks); @@ -197,7 +197,7 @@ public override void Visit(OpenApiResponses response) base.Visit(response); } - public override void Visit(Dictionary content) + public override void Visit(IDictionary content) { EncodeCall(); base.Visit(content); @@ -215,7 +215,7 @@ public override void Visit(OpenApiEncoding encoding) base.Visit(encoding); } - public override void Visit(Dictionary examples) + public override void Visit(IDictionary examples) { EncodeCall(); base.Visit(examples); @@ -239,7 +239,7 @@ public override void Visit(IOpenApiSchema schema) base.Visit(schema); } - public override void Visit(Dictionary links) + public override void Visit(IDictionary links) { EncodeCall(); base.Visit(links); @@ -323,13 +323,13 @@ public override void Visit(List example) base.Visit(example); } - public override void Visit(Dictionary serverVariables) + public override void Visit(IDictionary serverVariables) { EncodeCall(); base.Visit(serverVariables); } - public override void Visit(Dictionary encodings) + public override void Visit(IDictionary encodings) { EncodeCall(); base.Visit(encodings); diff --git a/test/Microsoft.OpenApi.Tests/Walkers/WalkerLocationTests.cs b/test/Microsoft.OpenApi.Tests/Walkers/WalkerLocationTests.cs index 862179b6f..ad13462a9 100644 --- a/test/Microsoft.OpenApi.Tests/Walkers/WalkerLocationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Walkers/WalkerLocationTests.cs @@ -76,7 +76,7 @@ public void LocatePathOperationContentSchema() { ["200"] = new OpenApiResponse() { - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -119,7 +119,7 @@ public void WalkDOMWithCycles() var loopySchema = new OpenApiSchema { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["name"] = new OpenApiSchema() { Type = JsonSchemaType.String } } @@ -131,7 +131,7 @@ public void WalkDOMWithCycles() { Components = new() { - Schemas = new() + Schemas = new Dictionary() { ["loopy"] = loopySchema } @@ -161,7 +161,7 @@ public void LocateReferences() var baseSchema = new OpenApiSchema { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { ["type"] = new OpenApiSchema() { Type = JsonSchemaType.String } }, @@ -201,7 +201,7 @@ public void LocateReferences() { ["200"] = new OpenApiResponse() { - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -220,7 +220,7 @@ public void LocateReferences() }, Components = new() { - Schemas = new() + Schemas = new Dictionary() { ["derived"] = derivedSchema, ["base"] = baseSchema, @@ -302,7 +302,7 @@ public override void Visit(IOpenApiReferenceHolder referenceable) { Locations.Add("referenceAt: " + this.PathString); } - public override void Visit(Dictionary content) + public override void Visit(IDictionary content) { Locations.Add(this.PathString); } diff --git a/test/Microsoft.OpenApi.Tests/Workspaces/OpenApiWorkspaceTests.cs b/test/Microsoft.OpenApi.Tests/Workspaces/OpenApiWorkspaceTests.cs index ba66aeedf..f31d823a0 100644 --- a/test/Microsoft.OpenApi.Tests/Workspaces/OpenApiWorkspaceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Workspaces/OpenApiWorkspaceTests.cs @@ -37,7 +37,7 @@ public void OpenApiWorkspacesCanAddComponentsFromAnotherDocument() { ["200"] = new OpenApiResponse() { - Content = new() + Content = new Dictionary() { ["application/json"] = new OpenApiMediaType() { @@ -56,7 +56,7 @@ public void OpenApiWorkspacesCanAddComponentsFromAnotherDocument() { Components = new OpenApiComponents() { - Schemas = new() + Schemas = new Dictionary() { ["test"] = testSchema } @@ -132,7 +132,7 @@ private static OpenApiDocument CreateCommonDocument() { Components = new() { - Schemas = new() + Schemas = new Dictionary() { ["test"] = new OpenApiSchema() { diff --git a/test/Microsoft.OpenApi.Tests/Writers/OpenApiYamlWriterTests.cs b/test/Microsoft.OpenApi.Tests/Writers/OpenApiYamlWriterTests.cs index dd5608f53..3e508a3fd 100644 --- a/test/Microsoft.OpenApi.Tests/Writers/OpenApiYamlWriterTests.cs +++ b/test/Microsoft.OpenApi.Tests/Writers/OpenApiYamlWriterTests.cs @@ -465,7 +465,7 @@ private static OpenApiDocument CreateDocWithSimpleSchemaToInline() ["200"] = new OpenApiResponse() { Description = "OK", - Content = new() + Content = new Dictionary() { ["application/json"] = new() { @@ -480,7 +480,7 @@ private static OpenApiDocument CreateDocWithSimpleSchemaToInline() }, Components = new() { - Schemas = new() + Schemas = new Dictionary() { ["thing"] = thingSchema } From 8a861c9b7b7cc857e95a5698b577769ef9a2bd0c Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 20 May 2025 20:43:51 +0300 Subject: [PATCH 02/12] feat: Add writer settings to enable sorting collections using a comparer --- .../Extensions/DictionaryExtensions.cs | 51 +++++++++++++++++++ .../Writers/OpenApiWriterExtensions.cs | 12 +++++ .../Writers/OpenApiWriterSettings.cs | 11 ++++ 3 files changed, 74 insertions(+) create mode 100644 src/Microsoft.OpenApi/Extensions/DictionaryExtensions.cs diff --git a/src/Microsoft.OpenApi/Extensions/DictionaryExtensions.cs b/src/Microsoft.OpenApi/Extensions/DictionaryExtensions.cs new file mode 100644 index 000000000..3f98ffe86 --- /dev/null +++ b/src/Microsoft.OpenApi/Extensions/DictionaryExtensions.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.OpenApi.Extensions +{ + /// + /// Dictionary extension methods + /// + public static class DictionaryExtensions + { + /// + /// Returns a new dictionary with entries sorted by key using the default comparer. + /// + public static IDictionary Sort( + this IDictionary source) + where TKey : notnull + { +#if NET7_0_OR_GREATER + ArgumentNullException.ThrowIfNull(nameof(source)); +#else + if (source == null) + throw new ArgumentNullException(nameof(source)); +#endif + + return source.OrderBy(kvp => kvp.Key) + .ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + } + + /// + /// Returns a new dictionary with entries sorted by key using a custom comparer. + /// + public static IDictionary Sort( + this IDictionary source, + IComparer comparer) + where TKey : notnull + { +#if NET7_0_OR_GREATER + ArgumentNullException.ThrowIfNull(nameof(source)); + ArgumentNullException.ThrowIfNull(nameof(comparer)); +#else + if (source == null) + throw new ArgumentNullException(nameof(source)); + if (comparer == null) + throw new ArgumentNullException(nameof(comparer)); +#endif + return source.OrderBy(kvp => kvp.Key, comparer) + .ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + } + } +} diff --git a/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs b/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs index 0e7087554..8addb48e7 100644 --- a/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs +++ b/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Linq; using System.Text.Json.Nodes; +using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Interfaces; namespace Microsoft.OpenApi.Writers @@ -458,6 +459,17 @@ private static void WriteMapInternal( if (elements != null) { + var settings = writer.GetSettings(); + + if (settings?.EnableSorting == true) + { + elements = elements.Sort(); // sort with default comparer + } + else if (settings?.KeyComparer != null) + { + elements = elements.Sort(settings.KeyComparer); // sort using custom comparer + } + foreach (var item in elements) { writer.WritePropertyName(item.Key); diff --git a/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs b/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs index e6364affa..b9023f577 100644 --- a/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs +++ b/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Services; @@ -24,5 +25,15 @@ internal bool ShouldInlineReference(OpenApiReference reference) return (reference.IsLocal && InlineLocalReferences) || (reference.IsExternal && InlineExternalReferences); } + + /// + /// Enables sorting of collections using the default comparer + /// + public bool EnableSorting { get; set; } + + /// + /// Custom comparer for sorting collections. + /// + public IComparer? KeyComparer { get; set; } } } From 54fed370b24dc603575b35f39e1d562e9a1983f3 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 20 May 2025 20:44:16 +0300 Subject: [PATCH 03/12] chore: add tests and update public API --- ...ntSucceeds_version=OpenApi2_0.verified.txt | 57 +++++ ...ntSucceeds_version=OpenApi3_0.verified.txt | 56 +++++ ...ntSucceeds_version=OpenApi3_1.verified.txt | 56 +++++ ...erSucceeds_version=OpenApi2_0.verified.txt | 57 +++++ ...erSucceeds_version=OpenApi3_0.verified.txt | 56 +++++ ...erSucceeds_version=OpenApi3_1.verified.txt | 56 +++++ .../Extensions/DictionaryExtensionsTests.cs | 217 ++++++++++++++++++ .../Extensions/Samples/petStore.yaml | 190 +++++++++++++++ .../Microsoft.OpenApi.Tests.csproj | 4 + .../PublicApi/PublicApi.approved.txt | 9 + 10 files changed, 758 insertions(+) create mode 100644 test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi2_0.verified.txt create mode 100644 test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi3_0.verified.txt create mode 100644 test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi3_1.verified.txt create mode 100644 test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi2_0.verified.txt create mode 100644 test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi3_0.verified.txt create mode 100644 test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi3_1.verified.txt create mode 100644 test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.cs create mode 100644 test/Microsoft.OpenApi.Tests/Extensions/Samples/petStore.yaml diff --git a/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi2_0.verified.txt b/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi2_0.verified.txt new file mode 100644 index 000000000..316c35558 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi2_0.verified.txt @@ -0,0 +1,57 @@ +swagger: '2.0' +info: + title: Test API + version: '1.0' +paths: + pet: + get: + responses: + '200': + description: Return a 200 status to indicate that the data was received successfully + newPet: + post: + consumes: + - application/json + parameters: + - in: body + name: body + description: Information about a new pet in the system + schema: + $ref: '#/definitions/Pet' + responses: + '200': + description: Return a 200 status to indicate that the data was received successfully +definitions: + errorModel: + type: object + required: + - code + - message + properties: + code: + type: integer + format: int32 + message: + type: string + newPet: + type: object + required: + - name + properties: + id: + type: integer + format: int64 + name: + type: string + Pet: + required: + - id + - name + properties: + id: + type: integer + format: int64 + name: + type: string + tag: + type: string \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi3_0.verified.txt b/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi3_0.verified.txt new file mode 100644 index 000000000..ca83e6790 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi3_0.verified.txt @@ -0,0 +1,56 @@ +openapi: 3.0.4 +info: + title: Test API + version: '1.0' +paths: + pet: + get: + responses: + '200': + description: Return a 200 status to indicate that the data was received successfully + newPet: + post: + requestBody: + description: Information about a new pet in the system + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + responses: + '200': + description: Return a 200 status to indicate that the data was received successfully +components: + schemas: + errorModel: + required: + - code + - message + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + newPet: + required: + - name + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + Pet: + required: + - id + - name + properties: + id: + type: integer + format: int64 + name: + type: string + tag: + type: string \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi3_1.verified.txt b/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi3_1.verified.txt new file mode 100644 index 000000000..78392d7e5 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi3_1.verified.txt @@ -0,0 +1,56 @@ +openapi: '3.1.1' +info: + title: Test API + version: '1.0' +paths: + pet: + get: + responses: + '200': + description: Return a 200 status to indicate that the data was received successfully + newPet: + post: + requestBody: + description: Information about a new pet in the system + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + responses: + '200': + description: Return a 200 status to indicate that the data was received successfully +components: + schemas: + errorModel: + required: + - code + - message + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + newPet: + required: + - name + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + Pet: + required: + - id + - name + properties: + id: + type: integer + format: int64 + name: + type: string + tag: + type: string \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi2_0.verified.txt b/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi2_0.verified.txt new file mode 100644 index 000000000..e285124a9 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi2_0.verified.txt @@ -0,0 +1,57 @@ +swagger: '2.0' +info: + title: Test API + version: '1.0' +paths: + pet: + get: + responses: + '200': + description: Return a 200 status to indicate that the data was received successfully + newPet: + post: + consumes: + - application/json + parameters: + - in: body + name: body + description: Information about a new pet in the system + schema: + $ref: '#/definitions/Pet' + responses: + '200': + description: Return a 200 status to indicate that the data was received successfully +definitions: + errorModel: + type: object + required: + - code + - message + properties: + code: + type: integer + format: int32 + message: + type: string + newPet: + type: object + required: + - name + properties: + id: + type: integer + format: int64 + name: + type: string + pet: + required: + - id + - name + properties: + id: + type: integer + format: int64 + name: + type: string + tag: + type: string \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi3_0.verified.txt b/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi3_0.verified.txt new file mode 100644 index 000000000..da60b8ac2 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi3_0.verified.txt @@ -0,0 +1,56 @@ +openapi: 3.0.4 +info: + title: Test API + version: '1.0' +paths: + pet: + get: + responses: + '200': + description: Return a 200 status to indicate that the data was received successfully + newPet: + post: + requestBody: + description: Information about a new pet in the system + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + responses: + '200': + description: Return a 200 status to indicate that the data was received successfully +components: + schemas: + errorModel: + required: + - code + - message + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + newPet: + required: + - name + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + pet: + required: + - id + - name + properties: + id: + type: integer + format: int64 + name: + type: string + tag: + type: string \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi3_1.verified.txt b/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi3_1.verified.txt new file mode 100644 index 000000000..dbab6f41a --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi3_1.verified.txt @@ -0,0 +1,56 @@ +openapi: '3.1.1' +info: + title: Test API + version: '1.0' +paths: + pet: + get: + responses: + '200': + description: Return a 200 status to indicate that the data was received successfully + newPet: + post: + requestBody: + description: Information about a new pet in the system + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + responses: + '200': + description: Return a 200 status to indicate that the data was received successfully +components: + schemas: + errorModel: + required: + - code + - message + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + newPet: + required: + - name + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + pet: + required: + - id + - name + properties: + id: + type: integer + format: int64 + name: + type: string + tag: + type: string \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.cs b/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.cs new file mode 100644 index 000000000..e9f7af514 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.cs @@ -0,0 +1,217 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Net.Http; +using System.Threading.Tasks; +using Microsoft.OpenApi.Extensions; +using Microsoft.OpenApi.Models; +using Microsoft.OpenApi.Models.Interfaces; +using Microsoft.OpenApi.Models.References; +using Microsoft.OpenApi.Writers; +using VerifyXunit; +using Xunit; + +namespace Microsoft.OpenApi.Tests.Extensions +{ + public class DictionaryExtensionsTests + { + public static readonly OpenApiDocument Document = new OpenApiDocument + { + Info = new OpenApiInfo { Title = "Test API", Version = "1.0" }, + Paths = new OpenApiPaths + { + ["pet"] = new OpenApiPathItem + { + Operations = new () + { + [HttpMethod.Get] = new OpenApiOperation + { + Responses = new OpenApiResponses + { + ["200"] = new OpenApiResponse + { + Description = "Return a 200 status to indicate that the data was received successfully" + } + } + } + } + }, + ["newPet"] = new OpenApiPathItem + { + Operations = new() + { + [HttpMethod.Post] = new OpenApiOperation + { + RequestBody = new OpenApiRequestBody + { + Description = "Information about a new pet in the system", + Content = new Dictionary() + { + ["application/json"] = new OpenApiMediaType + { + Schema = new OpenApiSchemaReference("Pet", null) + } + } + }, + Responses = new OpenApiResponses + { + ["200"] = new OpenApiResponse + { + Description = "Return a 200 status to indicate that the data was received successfully" + } + } + } + } + } + }, + Components = new OpenApiComponents + { + Schemas = new Dictionary() + { + ["pet"] = new OpenApiSchema() + { + Required = new HashSet + { + "id", "name" + }, + Properties = new Dictionary() + { + ["name"] = new OpenApiSchema() + { + Type = JsonSchemaType.String + }, + ["id"] = new OpenApiSchema() + { + Type = JsonSchemaType.Integer, + Format = "int64" + }, + ["tag"] = new OpenApiSchema() + { + Type = JsonSchemaType.String + } + }, + }, + ["newPet"] = new OpenApiSchema() + { + Type = JsonSchemaType.Object, + Required = new HashSet + { + "name" + }, + Properties = new Dictionary() + { + ["name"] = new OpenApiSchema() + { + Type = JsonSchemaType.String + }, + ["id"] = new OpenApiSchema() + { + Type = JsonSchemaType.Integer, + Format = "int64" + } + } + }, + ["errorModel"] = new OpenApiSchema() + { + Type = JsonSchemaType.Object, + Required = new HashSet + { + "code", + "message" + }, + Properties = new Dictionary() + { + ["message"] = new OpenApiSchema() + { + Type = JsonSchemaType.String + }, + ["code"] = new OpenApiSchema() + { + Type = JsonSchemaType.Integer, + Format = "int32" + } + } + } + } + } + }; + + [Fact] + public void SortEmptyDictionaryReturnsEmptyDictionary() + { + // Arrange + Document.Components.Headers = new Dictionary(); + + // Act + var sortedDictionary = Document.Components.Headers.Sort(); + + // Assert + Assert.Empty(sortedDictionary); + } + + [Fact] + public async Task SortOpenApiDocumentLexicographicallySucceeds() + { + // Arrange + var expected = @"required: + - id + - name +properties: + id: + type: integer + format: int64 + name: + type: string + tag: + type: string"; + + var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); + var settings = new OpenApiWriterSettings + { + EnableSorting = true + }; + var writer = new OpenApiYamlWriter(outputStringWriter, settings); + + // Act + var schema = Document.Components.Schemas["pet"]; + + schema.SerializeAsV3(writer); + await writer.FlushAsync(); + var actual = outputStringWriter.ToString(); + + // Assert + Assert.Equal(expected.MakeLineBreaksEnvironmentNeutral(), actual.MakeLineBreaksEnvironmentNeutral()); + } + + [Theory] + [MemberData(nameof(OpenApiSpecVersions))] + public async Task SortOpenApiDocumentUsingCustomComparerSucceeds(OpenApiSpecVersion version) + { + // Arrange + var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); + var settings = new OpenApiWriterSettings + { + KeyComparer = StringComparer.OrdinalIgnoreCase + }; + var writer = new OpenApiYamlWriter(outputStringWriter, settings); + + // Act + Document.SerializeAs(version, writer); + await writer.FlushAsync(); + + // Assert + await Verifier.Verify(outputStringWriter).UseParameters(version); + } + + public static TheoryData OpenApiSpecVersions() + { + var values = new TheoryData(); + foreach (var value in Enum.GetValues()) + { + values.Add(value); + } + return values; + } + } +} diff --git a/test/Microsoft.OpenApi.Tests/Extensions/Samples/petStore.yaml b/test/Microsoft.OpenApi.Tests/Extensions/Samples/petStore.yaml new file mode 100644 index 000000000..6a9df318b --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Extensions/Samples/petStore.yaml @@ -0,0 +1,190 @@ +openapi: '3.0.0' +info: + version: '1.0.0' + title: Swagger Petstore (Simple) + description: A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification + termsOfService: http://helloreverb.com/terms/ + contact: + name: Swagger API team + email: foo@example.com + url: http://swagger.io + license: + name: MIT + url: http://opensource.org/licenses/MIT +servers: + - url: http://petstore.swagger.io/api +paths: + /pets: + get: + description: Returns all pets from the system that the user has access to + operationId: findPets + parameters: + - name: tags + in: query + description: tags to filter by + required: false + schema: + type: array + items: + type: string + - name: limit + in: query + description: maximum number of results to return + required: false + schema: + type: integer + format: int32 + responses: + '200': + description: pet response + content: + application/json: + schema: + type: array + items: + "$ref": '#/components/schemas/pet1' + application/xml: + schema: + type: array + items: + "$ref": '#/components/schemas/pet1' + + '4XX': + description: unexpected client error + content: + text/html: + schema: + "$ref": '#/components/schemas/errorModel' + '5XX': + description: unexpected server error + content: + text/html: + schema: + "$ref": '#/components/schemas/errorModel' + post: + description: Creates a new pet in the store. Duplicates are allowed + operationId: addPet + requestBody: + description: Pet to add to the store + required: true + content: + 'application/json': + schema: + "$ref": '#/components/schemas/newPet' + responses: + '200': + description: pet response + content: + application/json: + schema: + "$ref": '#/components/schemas/pet1' + '4XX': + description: unexpected client error + content: + text/html: + schema: + "$ref": '#/components/schemas/errorModel' + '5XX': + description: unexpected server error + content: + text/html: + schema: + "$ref": '#/components/schemas/errorModel' + /pets/{id}: + get: + description: Returns a user based on a single ID, if the user does not have access to the pet + operationId: findPetById + parameters: + - name: id + in: path + description: ID of pet to fetch + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: pet response + content: + application/json: + schema: + "$ref": '#/components/schemas/pet1' + application/xml: + schema: + "$ref": '#/components/schemas/pet1' + '4XX': + description: unexpected client error + content: + text/html: + schema: + "$ref": '#/components/schemas/errorModel' + '5XX': + description: unexpected server error + content: + text/html: + schema: + "$ref": '#/components/schemas/errorModel' + delete: + description: deletes a single pet based on the ID supplied + operationId: deletePet + parameters: + - name: id + in: path + description: ID of pet to delete + required: true + schema: + type: integer + format: int64 + responses: + '204': + description: pet deleted + '4XX': + description: unexpected client error + content: + text/html: + schema: + "$ref": '#/components/schemas/errorModel' + '5XX': + description: unexpected server error + content: + text/html: + schema: + "$ref": '#/components/schemas/errorModel' +components: + schemas: + pet1: + type: object + required: + - id + - name + properties: + id: + type: integer + format: int64 + name: + type: string + tag: + type: string + newPet: + type: object + required: + - name + properties: + id: + type: integer + format: int64 + name: + type: string + tag: + type: string + errorModel: + type: object + required: + - code + - message + properties: + code: + type: integer + format: int32 + message: + type: string diff --git a/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj b/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj index 9f65e7c78..37a454bec 100644 --- a/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj +++ b/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj @@ -65,4 +65,8 @@ PreserveNewest + + + + \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt b/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt index e75dd5e9e..1c5cf510c 100644 --- a/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt +++ b/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt @@ -133,6 +133,13 @@ namespace Microsoft.OpenApi.Expressions } namespace Microsoft.OpenApi.Extensions { + public static class DictionaryExtensions + { + public static System.Collections.Generic.IDictionary Sort(this System.Collections.Generic.IDictionary source) + where TKey : notnull { } + public static System.Collections.Generic.IDictionary Sort(this System.Collections.Generic.IDictionary source, System.Collections.Generic.IComparer comparer) + where TKey : notnull { } + } public static class EnumExtensions { [System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2075", Justification="Fields are never trimmed for enum types.")] @@ -1986,8 +1993,10 @@ namespace Microsoft.OpenApi.Writers public class OpenApiWriterSettings { public OpenApiWriterSettings() { } + public bool EnableSorting { get; set; } public bool InlineExternalReferences { get; set; } public bool InlineLocalReferences { get; set; } + public System.Collections.Generic.IComparer? KeyComparer { get; set; } } public class OpenApiYamlWriter : Microsoft.OpenApi.Writers.OpenApiWriterBase { From 1e65ae1bc700c3762844678536cce5a4fbb3106b Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Wed, 21 May 2025 11:27:17 +0300 Subject: [PATCH 04/12] fix: resolve merge conflict errors --- .../Models/OpenApiDocument.cs | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Microsoft.OpenApi/Models/OpenApiDocument.cs b/src/Microsoft.OpenApi/Models/OpenApiDocument.cs index 51f213a9d..f1f8fb304 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiDocument.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiDocument.cs @@ -666,7 +666,7 @@ public bool AddComponent(string id, T componentToRegister) Utils.CheckArgumentNullOrEmpty(id); Components ??= new(); - static bool AddToDictionary(Dictionary dict, string key, TValue value) + static bool AddToDictionary(IDictionary dict, string key, TValue value) { #if NET5_0_OR_GREATER return dict.TryAdd(key, value); @@ -684,43 +684,43 @@ static bool AddToDictionary(Dictionary dict, string key, switch (componentToRegister) { case IOpenApiSchema openApiSchema: - Components.Schemas ??= []; + Components.Schemas ??= new Dictionary(); added = AddToDictionary(Components.Schemas, id, openApiSchema); break; case IOpenApiParameter openApiParameter: - Components.Parameters ??= []; + Components.Parameters ??= new Dictionary(); added = AddToDictionary(Components.Parameters, id, openApiParameter); break; case IOpenApiResponse openApiResponse: - Components.Responses ??= []; + Components.Responses ??= new Dictionary(); added = AddToDictionary(Components.Responses, id, openApiResponse); break; case IOpenApiRequestBody openApiRequestBody: - Components.RequestBodies ??= []; + Components.RequestBodies ??= new Dictionary(); added = AddToDictionary(Components.RequestBodies, id, openApiRequestBody); break; case IOpenApiLink openApiLink: - Components.Links ??= []; + Components.Links ??= new Dictionary(); added = AddToDictionary(Components.Links, id, openApiLink); break; case IOpenApiCallback openApiCallback: - Components.Callbacks ??= []; + Components.Callbacks ??= new Dictionary(); added = AddToDictionary(Components.Callbacks, id, openApiCallback); break; case IOpenApiPathItem openApiPathItem: - Components.PathItems ??= []; + Components.PathItems ??= new Dictionary(); added = AddToDictionary(Components.PathItems, id, openApiPathItem); break; case IOpenApiExample openApiExample: - Components.Examples ??= []; + Components.Examples ??= new Dictionary(); added = AddToDictionary(Components.Examples, id, openApiExample); break; case IOpenApiHeader openApiHeader: - Components.Headers ??= []; + Components.Headers ??= new Dictionary(); added = AddToDictionary(Components.Headers, id, openApiHeader); break; case IOpenApiSecurityScheme openApiSecurityScheme: - Components.SecuritySchemes ??= []; + Components.SecuritySchemes ??= new Dictionary(); added = AddToDictionary(Components.SecuritySchemes, id, openApiSecurityScheme); break; default: From 392e5a7a83fe10e59fde9ee894281255f0687e3d Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Fri, 23 May 2025 14:49:18 +0300 Subject: [PATCH 05/12] chore: revert collections to use interface types --- .../Formatters/PowerShellFormatter.cs | 6 +++--- .../Models/Interfaces/IOpenApiPathItem.cs | 4 ++-- .../Models/Interfaces/IOpenApiSchema.cs | 12 ++++++------ .../Models/OpenApiDocument.cs | 10 +++++----- .../Models/OpenApiOperation.cs | 14 +++++++------- .../Models/OpenApiPathItem.cs | 4 ++-- src/Microsoft.OpenApi/Models/OpenApiSchema.cs | 16 ++++++++-------- .../References/OpenApiPathItemReference.cs | 4 ++-- .../References/OpenApiSchemaReference.cs | 12 ++++++------ .../Reader/OpenApiDiagnostic.cs | 4 ++-- .../Reader/V2/OpenApiDocumentDeserializer.cs | 2 +- .../Services/OpenApiFilterService.cs | 4 ++-- .../Services/OpenApiVisitorBase.cs | 10 +++++----- .../Services/OpenApiWalker.cs | 12 ++++++------ .../Services/OperationSearch.cs | 4 ++-- src/Microsoft.OpenApi/Services/SearchResult.cs | 2 +- .../Validations/Rules/OpenApiSchemaRules.cs | 2 +- .../Validations/ValidationRuleSet.cs | 4 ++-- .../Mocks/OpenApiDocumentMock.cs | 11 +++++------ .../Models/OpenApiOperationTests.cs | 18 +++++++++--------- .../OpenApiTagComparerTests.cs | 14 +++++++------- .../Visitors/InheritanceTests.cs | 8 ++++---- .../Walkers/WalkerLocationTests.cs | 6 +++--- 23 files changed, 91 insertions(+), 92 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs index a07888a99..c3aa81e6b 100644 --- a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs +++ b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs @@ -77,7 +77,7 @@ public override void Visit(OpenApiOperation operation) // Order matters. Resolve operationId. operationId = RemoveHashSuffix(operationId); if (operationTypeExtension.IsEquals("action") || operationTypeExtension.IsEquals("function")) - operationId = RemoveKeyTypeSegment(operationId, operation.Parameters ?? []); + operationId = RemoveKeyTypeSegment(operationId, operation.Parameters ?? new List()); operationId = SingularizeAndDeduplicateOperationId(operationId.SplitByChar('.')); operationId = ResolveODataCastOperationId(operationId); operationId = ResolveByRefOperationId(operationId); @@ -145,7 +145,7 @@ private static string RemoveHashSuffix(string operationId) return s_hashSuffixRegex.Match(operationId).Value; } - private static string RemoveKeyTypeSegment(string operationId, List parameters) + private static string RemoveKeyTypeSegment(string operationId, IList parameters) { var segments = operationId.SplitByChar('.'); foreach (var parameter in parameters) @@ -159,7 +159,7 @@ private static string RemoveKeyTypeSegment(string operationId, List parameters) + private static void ResolveFunctionParameters(IList parameters) { foreach (var parameter in parameters.OfType().Where(static p => p.Content?.Count > 0)) { diff --git a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiPathItem.cs b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiPathItem.cs index ca105bd76..4543bdd89 100644 --- a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiPathItem.cs +++ b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiPathItem.cs @@ -19,11 +19,11 @@ public interface IOpenApiPathItem : IOpenApiDescribedElement, IOpenApiSummarized /// /// An alternative server array to service all operations in this path. /// - public List? Servers { get; } + public IList? Servers { get; } /// /// A list of parameters that are applicable for all the operations described under this path. /// These parameters can be overridden at the operation level, but cannot be removed there. /// - public List? Parameters { get; } + public IList? Parameters { get; } } diff --git a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiSchema.cs b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiSchema.cs index 97f4b01fb..4abddeef6 100644 --- a/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiSchema.cs +++ b/src/Microsoft.OpenApi/Models/Interfaces/IOpenApiSchema.cs @@ -145,19 +145,19 @@ public interface IOpenApiSchema : IOpenApiDescribedElement, IOpenApiReadOnlyExte /// Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation /// Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. /// - public List? AllOf { get; } + public IList? AllOf { get; } /// /// Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation /// Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. /// - public List? OneOf { get; } + public IList? OneOf { get; } /// /// Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation /// Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. /// - public List? AnyOf { get; } + public IList? AnyOf { get; } /// /// Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation @@ -168,7 +168,7 @@ public interface IOpenApiSchema : IOpenApiDescribedElement, IOpenApiReadOnlyExte /// /// Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation /// - public HashSet? Required { get; } + public ISet? Required { get; } /// /// Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation @@ -247,12 +247,12 @@ public interface IOpenApiSchema : IOpenApiDescribedElement, IOpenApiReadOnlyExte /// To represent examples that cannot be naturally represented in JSON or YAML, /// a list of values can be used to contain the examples with escaping where necessary. /// - public List? Examples { get; } + public IList? Examples { get; } /// /// Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation /// - public List? Enum { get; } + public IList? Enum { get; } /// /// Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-validation diff --git a/src/Microsoft.OpenApi/Models/OpenApiDocument.cs b/src/Microsoft.OpenApi/Models/OpenApiDocument.cs index f1f8fb304..2d6de168b 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiDocument.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiDocument.cs @@ -49,7 +49,7 @@ public void RegisterComponents() /// /// An array of Server Objects, which provide connectivity information to a target server. /// - public List? Servers { get; set; } = []; + public IList? Servers { get; set; } = []; /// /// REQUIRED. The available paths and operations for the API. @@ -71,13 +71,13 @@ public void RegisterComponents() /// /// A declaration of which security mechanisms can be used across the API. /// - public List? Security { get; set; } + public IList? Security { get; set; } - private HashSet? _tags; + private ISet? _tags; /// /// A list of tags used by the specification with additional metadata. /// - public HashSet? Tags + public ISet? Tags { get { @@ -414,7 +414,7 @@ public void SerializeAsV2(IOpenApiWriter writer) return server.ReplaceServerUrlVariables([]); } - private static void WriteHostInfoV2(IOpenApiWriter writer, List? servers) + private static void WriteHostInfoV2(IOpenApiWriter writer, IList? servers) { if (servers == null || !servers.Any()) { diff --git a/src/Microsoft.OpenApi/Models/OpenApiOperation.cs b/src/Microsoft.OpenApi/Models/OpenApiOperation.cs index e747c54aa..f6343f9c3 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiOperation.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiOperation.cs @@ -22,12 +22,12 @@ public class OpenApiOperation : IOpenApiSerializable, IOpenApiExtensible, IMetad /// public const bool DeprecatedDefault = false; - private HashSet? _tags; + private ISet? _tags; /// /// A list of tags for API documentation control. /// Tags can be used for logical grouping of operations by resources or any other qualifier. /// - public HashSet? Tags + public ISet? Tags { get { @@ -74,7 +74,7 @@ public HashSet? Tags /// The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a name and location. /// The list can use the Reference Object to link to parameters that are defined at the OpenAPI Object's components/parameters. /// - public List? Parameters { get; set; } + public IList? Parameters { get; set; } /// /// The request body applicable for this operation. @@ -111,14 +111,14 @@ public HashSet? Tags /// This definition overrides any declared top-level security. /// To remove a top-level security declaration, an empty array can be used. /// - public List? Security { get; set; } + public IList? Security { get; set; } /// /// An alternative server array to service this operation. /// If an alternative server object is specified at the Path Item Object or Root level, /// it will be overridden by this value. /// - public List? Servers { get; set; } + public IList? Servers { get; set; } /// /// This object MAY be extended with Specification Extensions. @@ -139,7 +139,7 @@ public OpenApiOperation() { } public OpenApiOperation(OpenApiOperation operation) { Utils.CheckArgumentNull(operation); - Tags = operation.Tags != null ? [.. operation.Tags] : null; + Tags = operation.Tags != null ? new HashSet(operation.Tags) : null; Summary = operation.Summary ?? Summary; Description = operation.Description ?? Description; ExternalDocs = operation.ExternalDocs != null ? new(operation.ExternalDocs) : null; @@ -357,7 +357,7 @@ public virtual void SerializeAsV2(IOpenApiWriter writer) writer.WriteEndObject(); } - private static HashSet? VerifyTagReferences(HashSet? tags) + private static ISet? VerifyTagReferences(ISet? tags) { if (tags?.Count > 0) { diff --git a/src/Microsoft.OpenApi/Models/OpenApiPathItem.cs b/src/Microsoft.OpenApi/Models/OpenApiPathItem.cs index 09ff3a155..b07114220 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiPathItem.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiPathItem.cs @@ -25,10 +25,10 @@ public class OpenApiPathItem : IOpenApiExtensible, IOpenApiPathItem public Dictionary? Operations { get; set; } /// - public List? Servers { get; set; } + public IList? Servers { get; set; } /// - public List? Parameters { get; set; } + public IList? Parameters { get; set; } /// public IDictionary? Extensions { get; set; } diff --git a/src/Microsoft.OpenApi/Models/OpenApiSchema.cs b/src/Microsoft.OpenApi/Models/OpenApiSchema.cs index 6215e17de..8bbe03baf 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiSchema.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiSchema.cs @@ -180,19 +180,19 @@ public string? Minimum public bool WriteOnly { get; set; } /// - public List? AllOf { get; set; } + public IList? AllOf { get; set; } /// - public List? OneOf { get; set; } + public IList? OneOf { get; set; } /// - public List? AnyOf { get; set; } + public IList? AnyOf { get; set; } /// public IOpenApiSchema? Not { get; set; } /// - public HashSet? Required { get; set; } + public ISet? Required { get; set; } /// public IOpenApiSchema? Items { get; set; } @@ -231,10 +231,10 @@ public string? Minimum public JsonNode? Example { get; set; } /// - public List? Examples { get; set; } + public IList? Examples { get; set; } /// - public List? Enum { get; set; } + public IList? Enum { get; set; } /// public bool UnevaluatedProperties { get; set; } @@ -305,7 +305,7 @@ internal OpenApiSchema(IOpenApiSchema schema) OneOf = schema.OneOf != null ? [.. schema.OneOf] : null; AnyOf = schema.AnyOf != null ? [.. schema.AnyOf] : null; Not = schema.Not?.CreateShallowCopy(); - Required = schema.Required != null ? [.. schema.Required] : null; + Required = schema.Required != null ? new HashSet(schema.Required) : null; Items = schema.Items?.CreateShallowCopy(); MaxItems = schema.MaxItems ?? MaxItems; MinItems = schema.MinItems ?? MinItems; @@ -625,7 +625,7 @@ private void WriteFormatProperty(IOpenApiWriter writer) /// The property name that will be serialized. private void SerializeAsV2( IOpenApiWriter writer, - HashSet? parentRequiredProperties, + ISet? parentRequiredProperties, string? propertyName) { parentRequiredProperties ??= new HashSet(); diff --git a/src/Microsoft.OpenApi/Models/References/OpenApiPathItemReference.cs b/src/Microsoft.OpenApi/Models/References/OpenApiPathItemReference.cs index e612cd92e..db799ffbf 100644 --- a/src/Microsoft.OpenApi/Models/References/OpenApiPathItemReference.cs +++ b/src/Microsoft.OpenApi/Models/References/OpenApiPathItemReference.cs @@ -56,10 +56,10 @@ public string? Description public Dictionary? Operations { get => Target?.Operations; } /// - public List? Servers { get => Target?.Servers; } + public IList? Servers { get => Target?.Servers; } /// - public List? Parameters { get => Target?.Parameters; } + public IList? Parameters { get => Target?.Parameters; } /// public IDictionary? Extensions { get => Target?.Extensions; } diff --git a/src/Microsoft.OpenApi/Models/References/OpenApiSchemaReference.cs b/src/Microsoft.OpenApi/Models/References/OpenApiSchemaReference.cs index 9261a8eeb..db23704b8 100644 --- a/src/Microsoft.OpenApi/Models/References/OpenApiSchemaReference.cs +++ b/src/Microsoft.OpenApi/Models/References/OpenApiSchemaReference.cs @@ -88,15 +88,15 @@ public string? Description /// public bool WriteOnly { get => Target?.WriteOnly ?? false; } /// - public List? AllOf { get => Target?.AllOf; } + public IList? AllOf { get => Target?.AllOf; } /// - public List? OneOf { get => Target?.OneOf; } + public IList? OneOf { get => Target?.OneOf; } /// - public List? AnyOf { get => Target?.AnyOf; } + public IList? AnyOf { get => Target?.AnyOf; } /// public IOpenApiSchema? Not { get => Target?.Not; } /// - public HashSet? Required { get => Target?.Required; } + public ISet? Required { get => Target?.Required; } /// public IOpenApiSchema? Items { get => Target?.Items; } /// @@ -122,9 +122,9 @@ public string? Description /// public JsonNode? Example { get => Target?.Example; } /// - public List? Examples { get => Target?.Examples; } + public IList? Examples { get => Target?.Examples; } /// - public List? Enum { get => Target?.Enum; } + public IList? Enum { get => Target?.Enum; } /// public bool UnevaluatedProperties { get => Target?.UnevaluatedProperties ?? false; } /// diff --git a/src/Microsoft.OpenApi/Reader/OpenApiDiagnostic.cs b/src/Microsoft.OpenApi/Reader/OpenApiDiagnostic.cs index be718c28d..7f170f65e 100644 --- a/src/Microsoft.OpenApi/Reader/OpenApiDiagnostic.cs +++ b/src/Microsoft.OpenApi/Reader/OpenApiDiagnostic.cs @@ -15,12 +15,12 @@ public class OpenApiDiagnostic : IDiagnostic /// /// List of all errors. /// - public List Errors { get; set; } = []; + public IList Errors { get; set; } = []; /// /// List of all warnings /// - public List Warnings { get; set; } = []; + public IList Warnings { get; set; } = []; /// /// Open API specification version of the document parsed. diff --git a/src/Microsoft.OpenApi/Reader/V2/OpenApiDocumentDeserializer.cs b/src/Microsoft.OpenApi/Reader/V2/OpenApiDocumentDeserializer.cs index 0a0d9c8b9..a7d9ba976 100644 --- a/src/Microsoft.OpenApi/Reader/V2/OpenApiDocumentDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V2/OpenApiDocumentDeserializer.cs @@ -117,7 +117,7 @@ internal static partial class OpenApiV2Deserializer {s => s.StartsWith(OpenApiConstants.ExtensionFieldNamePrefix, StringComparison.OrdinalIgnoreCase), (o, p, n, _) => o.AddExtension(p, LoadExtension(p, n))} }; - private static void MakeServers(List servers, ParsingContext context, RootNode rootNode) + private static void MakeServers(IList servers, ParsingContext context, RootNode rootNode) { var host = context.GetFromTempStorage("host"); var basePath = context.GetFromTempStorage("basePath"); diff --git a/src/Microsoft.OpenApi/Services/OpenApiFilterService.cs b/src/Microsoft.OpenApi/Services/OpenApiFilterService.cs index f58053b1c..c17f8cc04 100644 --- a/src/Microsoft.OpenApi/Services/OpenApiFilterService.cs +++ b/src/Microsoft.OpenApi/Services/OpenApiFilterService.cs @@ -230,7 +230,7 @@ public static OpenApiUrlTreeNode CreateOpenApiUrlTreeNode(Dictionary FindOperations(OpenApiDocument sourceDocument, Func predicate) + private static IList FindOperations(OpenApiDocument sourceDocument, Func predicate) { var search = new OperationSearch(predicate); var walker = new OpenApiWalker(search); @@ -354,7 +354,7 @@ private static bool AddReferences(OpenApiComponents newComponents, OpenApiCompon return moreStuff; } - private static string ExtractPath(string url, List? serverList) + private static string ExtractPath(string url, IList? serverList) { // if OpenAPI has servers, then see if the url matches one of them var baseUrl = serverList?.Select(s => s.Url?.TrimEnd('/')) diff --git a/src/Microsoft.OpenApi/Services/OpenApiVisitorBase.cs b/src/Microsoft.OpenApi/Services/OpenApiVisitorBase.cs index 1ecad08a5..bbb7c0ac5 100644 --- a/src/Microsoft.OpenApi/Services/OpenApiVisitorBase.cs +++ b/src/Microsoft.OpenApi/Services/OpenApiVisitorBase.cs @@ -86,7 +86,7 @@ public virtual void Visit(OpenApiLicense license) /// /// Visits list of /// - public virtual void Visit(List servers) + public virtual void Visit(IList servers) { } @@ -142,7 +142,7 @@ public virtual void Visit(OpenApiOperation operation) /// /// Visits list of /// - public virtual void Visit(List parameters) + public virtual void Visit(IList parameters) { } @@ -310,21 +310,21 @@ public virtual void Visit(IOpenApiExample example) /// /// Visits list of /// - public virtual void Visit(HashSet openApiTags) + public virtual void Visit(ISet openApiTags) { } /// /// Visits list of /// - public virtual void Visit(HashSet openApiTags) + public virtual void Visit(ISet openApiTags) { } /// /// Visits list of /// - public virtual void Visit(List openApiSecurityRequirements) + public virtual void Visit(IList openApiSecurityRequirements) { } diff --git a/src/Microsoft.OpenApi/Services/OpenApiWalker.cs b/src/Microsoft.OpenApi/Services/OpenApiWalker.cs index c31b59cf5..66a81dbae 100644 --- a/src/Microsoft.OpenApi/Services/OpenApiWalker.cs +++ b/src/Microsoft.OpenApi/Services/OpenApiWalker.cs @@ -61,7 +61,7 @@ public void Walk(OpenApiDocument? doc) /// /// Visits list of and child objects /// - internal void Walk(HashSet? tags) + internal void Walk(ISet? tags) { if (tags == null) { @@ -84,7 +84,7 @@ internal void Walk(HashSet? tags) /// /// Visits list of and child objects /// - internal void Walk(HashSet? tags) + internal void Walk(ISet? tags) { if (tags == null) { @@ -306,7 +306,7 @@ internal void Walk(IDictionary? webhooks) /// /// Visits list of and child objects /// - internal void Walk(List? servers) + internal void Walk(IList? servers) { if (servers == null) { @@ -609,7 +609,7 @@ internal void Walk(OpenApiOperation operation) /// /// Visits list of /// - internal void Walk(List? securityRequirements) + internal void Walk(IList? securityRequirements) { if (securityRequirements == null) { @@ -630,7 +630,7 @@ internal void Walk(List? securityRequirements) /// /// Visits list of /// - internal void Walk(List? parameters) + internal void Walk(IList? parameters) { if (parameters == null) { @@ -1044,7 +1044,7 @@ internal void Walk(List examples) /// /// Visits a list of and child objects /// - internal void Walk(List schemas) + internal void Walk(IList schemas) { if (schemas == null) { diff --git a/src/Microsoft.OpenApi/Services/OperationSearch.cs b/src/Microsoft.OpenApi/Services/OperationSearch.cs index 53e23f9af..ff2de5d2d 100644 --- a/src/Microsoft.OpenApi/Services/OperationSearch.cs +++ b/src/Microsoft.OpenApi/Services/OperationSearch.cs @@ -21,7 +21,7 @@ public class OperationSearch : OpenApiVisitorBase /// /// A list of operations from the operation search. /// - public List SearchResults => _searchResults; + public IList SearchResults => _searchResults; /// /// The OperationSearch constructor. @@ -59,7 +59,7 @@ public override void Visit(IOpenApiPathItem pathItem) /// Visits list of . /// /// The target list of . - public override void Visit(List parameters) + public override void Visit(IList parameters) { /* The Parameter.Explode property should be true * if Parameter.Style == Form; but OData query params diff --git a/src/Microsoft.OpenApi/Services/SearchResult.cs b/src/Microsoft.OpenApi/Services/SearchResult.cs index 32e999e98..2fea9e03d 100644 --- a/src/Microsoft.OpenApi/Services/SearchResult.cs +++ b/src/Microsoft.OpenApi/Services/SearchResult.cs @@ -25,6 +25,6 @@ public class SearchResult /// /// Parameters object /// - public List? Parameters { get; set; } + public IList? Parameters { get; set; } } } diff --git a/src/Microsoft.OpenApi/Validations/Rules/OpenApiSchemaRules.cs b/src/Microsoft.OpenApi/Validations/Rules/OpenApiSchemaRules.cs index 808124f01..e6c83731a 100644 --- a/src/Microsoft.OpenApi/Validations/Rules/OpenApiSchemaRules.cs +++ b/src/Microsoft.OpenApi/Validations/Rules/OpenApiSchemaRules.cs @@ -83,7 +83,7 @@ public static bool ValidateChildSchemaAgainstDiscriminator(IOpenApiSchema schema /// between other schemas which may satisfy the payload description. /// The child schema. /// - public static bool TraverseSchemaElements(string discriminatorName, List? childSchema) + public static bool TraverseSchemaElements(string discriminatorName, IList? childSchema) { if (childSchema is not null) { diff --git a/src/Microsoft.OpenApi/Validations/ValidationRuleSet.cs b/src/Microsoft.OpenApi/Validations/ValidationRuleSet.cs index 943b88e6b..49e158499 100644 --- a/src/Microsoft.OpenApi/Validations/ValidationRuleSet.cs +++ b/src/Microsoft.OpenApi/Validations/ValidationRuleSet.cs @@ -26,7 +26,7 @@ public sealed class ValidationRuleSet /// /// Gets the rules in this rule set. /// - public List Rules => _rulesDictionary.Values.SelectMany(v => v).ToList(); + public IList Rules => _rulesDictionary.Values.SelectMany(v => v).ToList(); /// /// Gets the number of elements contained in this rule set. @@ -45,7 +45,7 @@ public ValidationRuleSet() /// /// The type that is to be validated /// Either the rules related to the type, or an empty list. - public List FindRules(Type type) + public IList FindRules(Type type) { _rulesDictionary.TryGetValue(type, out var results); return results ?? _emptyRules; diff --git a/test/Microsoft.OpenApi.Tests/Mocks/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Tests/Mocks/OpenApiDocumentMock.cs index 9762110f9..7787c5ca8 100644 --- a/test/Microsoft.OpenApi.Tests/Mocks/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Tests/Mocks/OpenApiDocumentMock.cs @@ -285,7 +285,7 @@ [new OpenApiSecuritySchemeReference("securitySchemeName2")] = ["name"] = new OpenApiSchema { Type = JsonSchemaType.String }, ["tag"] = new OpenApiSchema { Type = JsonSchemaType.String } }, - Required = ["id", "name"] + Required = new HashSet { "id", "name" } } }, Parameters = new Dictionary @@ -440,14 +440,13 @@ [new OpenApiSecuritySchemeReference("securitySchemeName2")] = } } ], - Tags = - [ - new OpenApiTag - { + Tags = new HashSet + { + new() { Name = "pets", Description = "Operations related to pets" } - ], + }, ExternalDocs = new OpenApiExternalDocs { Description = "Find out more", diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiOperationTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiOperationTests.cs index 104079f56..de6b4a55f 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiOperationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiOperationTests.cs @@ -869,21 +869,21 @@ public async Task SerializeAsJsonAsyncThrowsIfTagReferenceIsUnresolved(OpenApiSp { var document = new OpenApiDocument() { - Tags = - [ + Tags = new HashSet + { new() { Name = "one" }, new() { Name = "three" } - ] + } }; var operation = new OpenApiOperation() { - Tags = - [ - new OpenApiTagReference("one", document), - new OpenApiTagReference("two", document), - new OpenApiTagReference("three", document) - ] + Tags = new HashSet + { + new("one", document), + new("two", document), + new("three", document) + } }; var exception = await Assert.ThrowsAsync(() => operation.SerializeAsJsonAsync(version)); diff --git a/test/Microsoft.OpenApi.Tests/OpenApiTagComparerTests.cs b/test/Microsoft.OpenApi.Tests/OpenApiTagComparerTests.cs index c3cbc2d1a..5c14f014b 100644 --- a/test/Microsoft.OpenApi.Tests/OpenApiTagComparerTests.cs +++ b/test/Microsoft.OpenApi.Tests/OpenApiTagComparerTests.cs @@ -78,7 +78,7 @@ public void SameReferenceIdAreEqualWithValidTagReferences() { var document = new OpenApiDocument { - Tags = [new() { Name = "tag" }] + Tags = new HashSet { new() { Name = "tag" } } }; var openApiTag1 = new OpenApiTagReference("tag", document); @@ -91,11 +91,11 @@ public void DifferentReferenceIdAreNotEqualWithValidTagReferences() { var document = new OpenApiDocument { - Tags = - [ + Tags = new HashSet + { new() { Name = "one" }, new() { Name = "two" }, - ] + } }; var openApiTag1 = new OpenApiTagReference("one", document); @@ -133,12 +133,12 @@ public void WorksCorrectlyWithHashSetOfReferencesToValidTags() { var document = new OpenApiDocument { - Tags = - [ + Tags = new HashSet + { new() { Name = "one" }, new() { Name = "two" }, new() { Name = "three" } - ] + } }; var tags = new HashSet(_comparer) diff --git a/test/Microsoft.OpenApi.Tests/Visitors/InheritanceTests.cs b/test/Microsoft.OpenApi.Tests/Visitors/InheritanceTests.cs index 563648526..3c903b853 100644 --- a/test/Microsoft.OpenApi.Tests/Visitors/InheritanceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Visitors/InheritanceTests.cs @@ -113,7 +113,7 @@ public override void Visit(OpenApiLicense license) base.Visit(license); } - public override void Visit(List servers) + public override void Visit(IList servers) { EncodeCall(); base.Visit(servers); @@ -155,7 +155,7 @@ public override void Visit(OpenApiOperation operation) base.Visit(operation); } - public override void Visit(List parameters) + public override void Visit(IList parameters) { EncodeCall(); base.Visit(parameters); @@ -293,13 +293,13 @@ public override void Visit(IOpenApiExample example) base.Visit(example); } - public override void Visit(HashSet openApiTags) + public override void Visit(ISet openApiTags) { EncodeCall(); base.Visit(openApiTags); } - public override void Visit(List openApiSecurityRequirements) + public override void Visit(IList openApiSecurityRequirements) { EncodeCall(); base.Visit(openApiSecurityRequirements); diff --git a/test/Microsoft.OpenApi.Tests/Walkers/WalkerLocationTests.cs b/test/Microsoft.OpenApi.Tests/Walkers/WalkerLocationTests.cs index ad13462a9..dd7fe9190 100644 --- a/test/Microsoft.OpenApi.Tests/Walkers/WalkerLocationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Walkers/WalkerLocationTests.cs @@ -318,12 +318,12 @@ public override void Visit(IOpenApiSchema schema) Locations.Add(this.PathString); } - public override void Visit(HashSet openApiTags) + public override void Visit(ISet openApiTags) { Locations.Add(this.PathString); } - public override void Visit(List servers) + public override void Visit(IList servers) { Locations.Add(this.PathString); } @@ -332,7 +332,7 @@ public override void Visit(OpenApiServer server) { Locations.Add(this.PathString); } - public override void Visit(HashSet openApiTags) + public override void Visit(ISet openApiTags) { Locations.Add(this.PathString); } From 58cb4ac718a840a8dfb5c8821a3c0a484c29befd Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Fri, 23 May 2025 15:18:35 +0300 Subject: [PATCH 06/12] fix: rename class; add logic for sorting IEnumerable collections --- ...yExtensions.cs => CollectionExtensions.cs} | 27 +++++++++---------- .../Writers/OpenApiWriterExtensions.cs | 16 ++++++----- .../Writers/OpenApiWriterSettings.cs | 7 +---- 3 files changed, 23 insertions(+), 27 deletions(-) rename src/Microsoft.OpenApi/Extensions/{DictionaryExtensions.cs => CollectionExtensions.cs} (71%) diff --git a/src/Microsoft.OpenApi/Extensions/DictionaryExtensions.cs b/src/Microsoft.OpenApi/Extensions/CollectionExtensions.cs similarity index 71% rename from src/Microsoft.OpenApi/Extensions/DictionaryExtensions.cs rename to src/Microsoft.OpenApi/Extensions/CollectionExtensions.cs index 3f98ffe86..982b76cb5 100644 --- a/src/Microsoft.OpenApi/Extensions/DictionaryExtensions.cs +++ b/src/Microsoft.OpenApi/Extensions/CollectionExtensions.cs @@ -7,45 +7,44 @@ namespace Microsoft.OpenApi.Extensions /// /// Dictionary extension methods /// - public static class DictionaryExtensions + public static class CollectionExtensions { /// - /// Returns a new dictionary with entries sorted by key using the default comparer. + /// Returns a new dictionary with entries sorted by key using a custom comparer. /// public static IDictionary Sort( - this IDictionary source) + this IDictionary source, + IComparer comparer) where TKey : notnull { #if NET7_0_OR_GREATER ArgumentNullException.ThrowIfNull(nameof(source)); + ArgumentNullException.ThrowIfNull(nameof(comparer)); #else if (source == null) throw new ArgumentNullException(nameof(source)); + if (comparer == null) + throw new ArgumentNullException(nameof(comparer)); #endif - - return source.OrderBy(kvp => kvp.Key) + return source.OrderBy(kvp => kvp.Key, comparer) .ToDictionary(kvp => kvp.Key, kvp => kvp.Value); } /// - /// Returns a new dictionary with entries sorted by key using a custom comparer. + /// Sorts any IEnumerable using the specified comparer and returns a List. /// - public static IDictionary Sort( - this IDictionary source, - IComparer comparer) - where TKey : notnull + public static List Sort(this IEnumerable source, IComparer comparer) { #if NET7_0_OR_GREATER - ArgumentNullException.ThrowIfNull(nameof(source)); - ArgumentNullException.ThrowIfNull(nameof(comparer)); + ArgumentNullException.ThrowIfNull(source); + ArgumentNullException.ThrowIfNull(comparer); #else if (source == null) throw new ArgumentNullException(nameof(source)); if (comparer == null) throw new ArgumentNullException(nameof(comparer)); #endif - return source.OrderBy(kvp => kvp.Key, comparer) - .ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + return source.OrderBy(item => item, comparer).ToList(); } } } diff --git a/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs b/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs index 8addb48e7..f83dd6f40 100644 --- a/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs +++ b/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs @@ -421,6 +421,13 @@ private static void WriteCollectionInternal( writer.WriteStartArray(); if (elements != null) { + var settings = writer.GetSettings(); + + if (settings?.Comparer is IComparer typedComparer) + { + elements = elements.Sort(typedComparer); + } + foreach (var item in elements) { if (item != null) @@ -460,14 +467,9 @@ private static void WriteMapInternal( if (elements != null) { var settings = writer.GetSettings(); - - if (settings?.EnableSorting == true) - { - elements = elements.Sort(); // sort with default comparer - } - else if (settings?.KeyComparer != null) + if (settings?.Comparer != null) { - elements = elements.Sort(settings.KeyComparer); // sort using custom comparer + elements = elements.Sort(settings.Comparer); // sort using custom comparer } foreach (var item in elements) diff --git a/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs b/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs index b9023f577..28199690e 100644 --- a/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs +++ b/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs @@ -26,14 +26,9 @@ internal bool ShouldInlineReference(OpenApiReference reference) || (reference.IsExternal && InlineExternalReferences); } - /// - /// Enables sorting of collections using the default comparer - /// - public bool EnableSorting { get; set; } - /// /// Custom comparer for sorting collections. /// - public IComparer? KeyComparer { get; set; } + public IComparer? Comparer { get; set; } } } From 7f0e56189faf06483e3406686eddff60b69e390c Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Fri, 23 May 2025 15:19:21 +0300 Subject: [PATCH 07/12] chore: add tests to validate --- ...sTests.cs => CollectionExtensionsTests.cs} | 71 +++++++++++-------- 1 file changed, 40 insertions(+), 31 deletions(-) rename test/Microsoft.OpenApi.Tests/Extensions/{DictionaryExtensionsTests.cs => CollectionExtensionsTests.cs} (85%) diff --git a/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.cs b/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.cs similarity index 85% rename from test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.cs rename to test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.cs index e9f7af514..fb803c34e 100644 --- a/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.cs +++ b/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.cs @@ -14,7 +14,7 @@ namespace Microsoft.OpenApi.Tests.Extensions { - public class DictionaryExtensionsTests + public class CollectionExtensionsTests { public static readonly OpenApiDocument Document = new OpenApiDocument { @@ -137,72 +137,73 @@ public class DictionaryExtensionsTests } }; - [Fact] - public void SortEmptyDictionaryReturnsEmptyDictionary() + [Theory] + [MemberData(nameof(OpenApiSpecVersions))] + public async Task SortOpenApiDocumentUsingCustomComparerSucceeds(OpenApiSpecVersion version) { // Arrange - Document.Components.Headers = new Dictionary(); + var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); + var settings = new OpenApiWriterSettings + { + Comparer = StringComparer.OrdinalIgnoreCase + }; + var writer = new OpenApiYamlWriter(outputStringWriter, settings); // Act - var sortedDictionary = Document.Components.Headers.Sort(); + Document.SerializeAs(version, writer); + await writer.FlushAsync(); // Assert - Assert.Empty(sortedDictionary); + await Verifier.Verify(outputStringWriter).UseParameters(version); } [Fact] - public async Task SortOpenApiDocumentLexicographicallySucceeds() + public async Task SortHashSetsWorks() { // Arrange var expected = @"required: - id - name -properties: - id: - type: integer - format: int64 - name: - type: string - tag: - type: string"; + - tag"; + var schema = new OpenApiSchema + { + Required = new HashSet { "tag", "id", "name" }, + }; var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); var settings = new OpenApiWriterSettings { - EnableSorting = true + Comparer = StringComparer.OrdinalIgnoreCase }; var writer = new OpenApiYamlWriter(outputStringWriter, settings); // Act - var schema = Document.Components.Schemas["pet"]; - schema.SerializeAsV3(writer); await writer.FlushAsync(); - var actual = outputStringWriter.ToString(); + var sortedString = outputStringWriter.ToString(); // Assert - Assert.Equal(expected.MakeLineBreaksEnvironmentNeutral(), actual.MakeLineBreaksEnvironmentNeutral()); + Assert.Equal(expected.MakeLineBreaksEnvironmentNeutral(), sortedString.MakeLineBreaksEnvironmentNeutral()); } - [Theory] - [MemberData(nameof(OpenApiSpecVersions))] - public async Task SortOpenApiDocumentUsingCustomComparerSucceeds(OpenApiSpecVersion version) + [Fact] + public void SortTagsByNameUsingComparerWorks() { // Arrange - var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); - var settings = new OpenApiWriterSettings + var tags = new HashSet { - KeyComparer = StringComparer.OrdinalIgnoreCase + new() { Name = "three" }, + new() { Name = "two" }, + new() { Name = "one" } }; - var writer = new OpenApiYamlWriter(outputStringWriter, settings); // Act - Document.SerializeAs(version, writer); - await writer.FlushAsync(); + var sortedTags = tags.Sort(new OpenApiTagNameComparer()); // Assert - await Verifier.Verify(outputStringWriter).UseParameters(version); - } + Assert.Equal(3, sortedTags.Count); + Assert.True(sortedTags[0].Name == "one"); + } public static TheoryData OpenApiSpecVersions() { @@ -214,4 +215,12 @@ public static TheoryData OpenApiSpecVersions() return values; } } + + public class OpenApiTagNameComparer : IComparer + { + public int Compare(OpenApiTag tag1, OpenApiTag tag2) + { + return string.Compare(tag1.Name, tag2.Name, StringComparison.OrdinalIgnoreCase); + } + } } From b7eeadd9583acbc983b356c969217e02ce04ab3c Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Fri, 23 May 2025 15:20:15 +0300 Subject: [PATCH 08/12] chore: clean up tests --- .../V2Tests/OpenApiPathItemTests.cs | 6 +- ...tSucceeds_version=OpenApi2_0.verified.txt} | 0 ...tSucceeds_version=OpenApi3_0.verified.txt} | 0 ...tSucceeds_version=OpenApi3_1.verified.txt} | 0 ...rSucceeds_version=OpenApi2_0.verified.txt} | 0 ...rSucceeds_version=OpenApi3_0.verified.txt} | 0 ...rSucceeds_version=OpenApi3_1.verified.txt} | 0 .../Microsoft.OpenApi.Tests.csproj | 24 +++++ .../PublicApi/PublicApi.approved.txt | 96 +++++++++---------- 9 files changed, 74 insertions(+), 52 deletions(-) rename test/Microsoft.OpenApi.Tests/Extensions/{DictionaryExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi2_0.verified.txt => CollectionExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi2_0.verified.txt} (100%) rename test/Microsoft.OpenApi.Tests/Extensions/{DictionaryExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi3_0.verified.txt => CollectionExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi3_0.verified.txt} (100%) rename test/Microsoft.OpenApi.Tests/Extensions/{DictionaryExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi3_1.verified.txt => CollectionExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi3_1.verified.txt} (100%) rename test/Microsoft.OpenApi.Tests/Extensions/{DictionaryExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi2_0.verified.txt => CollectionExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi2_0.verified.txt} (100%) rename test/Microsoft.OpenApi.Tests/Extensions/{DictionaryExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi3_0.verified.txt => CollectionExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi3_0.verified.txt} (100%) rename test/Microsoft.OpenApi.Tests/Extensions/{DictionaryExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi3_1.verified.txt => CollectionExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi3_1.verified.txt} (100%) diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiPathItemTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiPathItemTests.cs index 5dc15b8bc..d5645f915 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiPathItemTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiPathItemTests.cs @@ -224,10 +224,10 @@ public class OpenApiPathItemTests Type = JsonSchemaType.String } }, - Required = - [ + Required = new HashSet + { "name" - ] + } } } } diff --git a/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi2_0.verified.txt b/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi2_0.verified.txt similarity index 100% rename from test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi2_0.verified.txt rename to test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi2_0.verified.txt diff --git a/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi3_0.verified.txt b/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi3_0.verified.txt similarity index 100% rename from test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi3_0.verified.txt rename to test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi3_0.verified.txt diff --git a/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi3_1.verified.txt b/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi3_1.verified.txt similarity index 100% rename from test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi3_1.verified.txt rename to test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentSucceeds_version=OpenApi3_1.verified.txt diff --git a/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi2_0.verified.txt b/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi2_0.verified.txt similarity index 100% rename from test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi2_0.verified.txt rename to test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi2_0.verified.txt diff --git a/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi3_0.verified.txt b/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi3_0.verified.txt similarity index 100% rename from test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi3_0.verified.txt rename to test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi3_0.verified.txt diff --git a/test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi3_1.verified.txt b/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi3_1.verified.txt similarity index 100% rename from test/Microsoft.OpenApi.Tests/Extensions/DictionaryExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi3_1.verified.txt rename to test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.SortOpenApiDocumentUsingCustomComparerSucceeds_version=OpenApi3_1.verified.txt diff --git a/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj b/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj index 37a454bec..58950a1ea 100644 --- a/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj +++ b/test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj @@ -39,6 +39,30 @@ + + CollectionExtensionsTests.cs + + + + CollectionExtensionsTests.cs + + + + CollectionExtensionsTests.cs + + + + CollectionExtensionsTests.cs + + + + CollectionExtensionsTests.cs + + + + CollectionExtensionsTests.cs + + OpenApiCallbackReferenceTests.cs diff --git a/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt b/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt index 1c5cf510c..a4fe30e20 100644 --- a/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt +++ b/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt @@ -133,10 +133,9 @@ namespace Microsoft.OpenApi.Expressions } namespace Microsoft.OpenApi.Extensions { - public static class DictionaryExtensions + public static class CollectionExtensions { - public static System.Collections.Generic.IDictionary Sort(this System.Collections.Generic.IDictionary source) - where TKey : notnull { } + public static System.Collections.Generic.List Sort(this System.Collections.Generic.IEnumerable source, System.Collections.Generic.IComparer comparer) { } public static System.Collections.Generic.IDictionary Sort(this System.Collections.Generic.IDictionary source, System.Collections.Generic.IComparer comparer) where TKey : notnull { } } @@ -389,8 +388,8 @@ namespace Microsoft.OpenApi.Models.Interfaces public interface IOpenApiPathItem : Microsoft.OpenApi.Interfaces.IOpenApiElement, Microsoft.OpenApi.Interfaces.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.Interfaces.IOpenApiReferenceable, Microsoft.OpenApi.Interfaces.IOpenApiSerializable, Microsoft.OpenApi.Interfaces.IShallowCopyable, Microsoft.OpenApi.Models.Interfaces.IOpenApiDescribedElement, Microsoft.OpenApi.Models.Interfaces.IOpenApiSummarizedElement { System.Collections.Generic.Dictionary? Operations { get; } - System.Collections.Generic.List? Parameters { get; } - System.Collections.Generic.List? Servers { get; } + System.Collections.Generic.IList? Parameters { get; } + System.Collections.Generic.IList? Servers { get; } } public interface IOpenApiReadOnlyDescribedElement : Microsoft.OpenApi.Interfaces.IOpenApiElement { @@ -413,8 +412,8 @@ namespace Microsoft.OpenApi.Models.Interfaces { Microsoft.OpenApi.Models.Interfaces.IOpenApiSchema? AdditionalProperties { get; } bool AdditionalPropertiesAllowed { get; } - System.Collections.Generic.List? AllOf { get; } - System.Collections.Generic.List? AnyOf { get; } + System.Collections.Generic.IList? AllOf { get; } + System.Collections.Generic.IList? AnyOf { get; } string? Comment { get; } string? Const { get; } System.Text.Json.Nodes.JsonNode? Default { get; } @@ -424,9 +423,9 @@ namespace Microsoft.OpenApi.Models.Interfaces Microsoft.OpenApi.Models.OpenApiDiscriminator? Discriminator { get; } string? DynamicAnchor { get; } string? DynamicRef { get; } - System.Collections.Generic.List? Enum { get; } + System.Collections.Generic.IList? Enum { get; } System.Text.Json.Nodes.JsonNode? Example { get; } - System.Collections.Generic.List? Examples { get; } + System.Collections.Generic.IList? Examples { get; } string? ExclusiveMaximum { get; } string? ExclusiveMinimum { get; } Microsoft.OpenApi.Models.OpenApiExternalDocs? ExternalDocs { get; } @@ -443,12 +442,12 @@ namespace Microsoft.OpenApi.Models.Interfaces string? Minimum { get; } decimal? MultipleOf { get; } Microsoft.OpenApi.Models.Interfaces.IOpenApiSchema? Not { get; } - System.Collections.Generic.List? OneOf { get; } + System.Collections.Generic.IList? OneOf { get; } string? Pattern { get; } System.Collections.Generic.IDictionary? PatternProperties { get; } System.Collections.Generic.IDictionary? Properties { get; } bool ReadOnly { get; } - System.Collections.Generic.HashSet? Required { get; } + System.Collections.Generic.ISet? Required { get; } System.Uri? Schema { get; } string? Title { get; } Microsoft.OpenApi.Models.JsonSchemaType? Type { get; } @@ -715,9 +714,9 @@ namespace Microsoft.OpenApi.Models public System.Uri? JsonSchemaDialect { get; set; } public System.Collections.Generic.IDictionary? Metadata { get; set; } public Microsoft.OpenApi.Models.OpenApiPaths Paths { get; set; } - public System.Collections.Generic.List? Security { get; set; } - public System.Collections.Generic.List? Servers { get; set; } - public System.Collections.Generic.HashSet? Tags { get; set; } + public System.Collections.Generic.IList? Security { get; set; } + public System.Collections.Generic.IList? Servers { get; set; } + public System.Collections.Generic.ISet? Tags { get; set; } public System.Collections.Generic.IDictionary? Webhooks { get; set; } public Microsoft.OpenApi.Services.OpenApiWorkspace? Workspace { get; set; } public bool AddComponent(string id, T componentToRegister) { } @@ -904,13 +903,13 @@ namespace Microsoft.OpenApi.Models public Microsoft.OpenApi.Models.OpenApiExternalDocs? ExternalDocs { get; set; } public System.Collections.Generic.IDictionary? Metadata { get; set; } public string? OperationId { get; set; } - public System.Collections.Generic.List? Parameters { get; set; } + public System.Collections.Generic.IList? Parameters { get; set; } public Microsoft.OpenApi.Models.Interfaces.IOpenApiRequestBody? RequestBody { get; set; } public Microsoft.OpenApi.Models.OpenApiResponses? Responses { get; set; } - public System.Collections.Generic.List? Security { get; set; } - public System.Collections.Generic.List? Servers { get; set; } + public System.Collections.Generic.IList? Security { get; set; } + public System.Collections.Generic.IList? Servers { get; set; } public string? Summary { get; set; } - public System.Collections.Generic.HashSet? Tags { get; set; } + public System.Collections.Generic.ISet? Tags { get; set; } public virtual void SerializeAsV2(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } public virtual void SerializeAsV3(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } public virtual void SerializeAsV31(Microsoft.OpenApi.Writers.IOpenApiWriter writer) { } @@ -943,8 +942,8 @@ namespace Microsoft.OpenApi.Models public string? Description { get; set; } public System.Collections.Generic.IDictionary? Extensions { get; set; } public System.Collections.Generic.Dictionary? Operations { get; set; } - public System.Collections.Generic.List? Parameters { get; set; } - public System.Collections.Generic.List? Servers { get; set; } + public System.Collections.Generic.IList? Parameters { get; set; } + public System.Collections.Generic.IList? Servers { get; set; } public string? Summary { get; set; } public void AddOperation(System.Net.Http.HttpMethod operationType, Microsoft.OpenApi.Models.OpenApiOperation operation) { } public Microsoft.OpenApi.Models.Interfaces.IOpenApiPathItem CreateShallowCopy() { } @@ -1013,8 +1012,8 @@ namespace Microsoft.OpenApi.Models public OpenApiSchema() { } public Microsoft.OpenApi.Models.Interfaces.IOpenApiSchema? AdditionalProperties { get; set; } public bool AdditionalPropertiesAllowed { get; set; } - public System.Collections.Generic.List? AllOf { get; set; } - public System.Collections.Generic.List? AnyOf { get; set; } + public System.Collections.Generic.IList? AllOf { get; set; } + public System.Collections.Generic.IList? AnyOf { get; set; } public string? Comment { get; set; } public string? Const { get; set; } public System.Text.Json.Nodes.JsonNode? Default { get; set; } @@ -1025,9 +1024,9 @@ namespace Microsoft.OpenApi.Models public Microsoft.OpenApi.Models.OpenApiDiscriminator? Discriminator { get; set; } public string? DynamicAnchor { get; set; } public string? DynamicRef { get; set; } - public System.Collections.Generic.List? Enum { get; set; } + public System.Collections.Generic.IList? Enum { get; set; } public System.Text.Json.Nodes.JsonNode? Example { get; set; } - public System.Collections.Generic.List? Examples { get; set; } + public System.Collections.Generic.IList? Examples { get; set; } public string? ExclusiveMaximum { get; set; } public string? ExclusiveMinimum { get; set; } public System.Collections.Generic.IDictionary? Extensions { get; set; } @@ -1046,12 +1045,12 @@ namespace Microsoft.OpenApi.Models public string? Minimum { get; set; } public decimal? MultipleOf { get; set; } public Microsoft.OpenApi.Models.Interfaces.IOpenApiSchema? Not { get; set; } - public System.Collections.Generic.List? OneOf { get; set; } + public System.Collections.Generic.IList? OneOf { get; set; } public string? Pattern { get; set; } public System.Collections.Generic.IDictionary? PatternProperties { get; set; } public System.Collections.Generic.IDictionary? Properties { get; set; } public bool ReadOnly { get; set; } - public System.Collections.Generic.HashSet? Required { get; set; } + public System.Collections.Generic.ISet? Required { get; set; } public System.Uri? Schema { get; set; } public string? Title { get; set; } public Microsoft.OpenApi.Models.JsonSchemaType? Type { get; set; } @@ -1309,8 +1308,8 @@ namespace Microsoft.OpenApi.Models.References public string? Description { get; set; } public System.Collections.Generic.IDictionary? Extensions { get; } public System.Collections.Generic.Dictionary? Operations { get; } - public System.Collections.Generic.List? Parameters { get; } - public System.Collections.Generic.List? Servers { get; } + public System.Collections.Generic.IList? Parameters { get; } + public System.Collections.Generic.IList? Servers { get; } public string? Summary { get; set; } public override Microsoft.OpenApi.Models.Interfaces.IOpenApiPathItem CopyReferenceAsTargetElementWithOverrides(Microsoft.OpenApi.Models.Interfaces.IOpenApiPathItem source) { } public Microsoft.OpenApi.Models.Interfaces.IOpenApiPathItem CreateShallowCopy() { } @@ -1345,8 +1344,8 @@ namespace Microsoft.OpenApi.Models.References public OpenApiSchemaReference(string referenceId, Microsoft.OpenApi.Models.OpenApiDocument? hostDocument = null, string? externalResource = null) { } public Microsoft.OpenApi.Models.Interfaces.IOpenApiSchema? AdditionalProperties { get; } public bool AdditionalPropertiesAllowed { get; } - public System.Collections.Generic.List? AllOf { get; } - public System.Collections.Generic.List? AnyOf { get; } + public System.Collections.Generic.IList? AllOf { get; } + public System.Collections.Generic.IList? AnyOf { get; } public string? Comment { get; } public string? Const { get; } public System.Text.Json.Nodes.JsonNode? Default { get; } @@ -1357,9 +1356,9 @@ namespace Microsoft.OpenApi.Models.References public Microsoft.OpenApi.Models.OpenApiDiscriminator? Discriminator { get; } public string? DynamicAnchor { get; } public string? DynamicRef { get; } - public System.Collections.Generic.List? Enum { get; } + public System.Collections.Generic.IList? Enum { get; } public System.Text.Json.Nodes.JsonNode? Example { get; } - public System.Collections.Generic.List? Examples { get; } + public System.Collections.Generic.IList? Examples { get; } public string? ExclusiveMaximum { get; } public string? ExclusiveMinimum { get; } public System.Collections.Generic.IDictionary? Extensions { get; } @@ -1377,12 +1376,12 @@ namespace Microsoft.OpenApi.Models.References public string? Minimum { get; } public decimal? MultipleOf { get; } public Microsoft.OpenApi.Models.Interfaces.IOpenApiSchema? Not { get; } - public System.Collections.Generic.List? OneOf { get; } + public System.Collections.Generic.IList? OneOf { get; } public string? Pattern { get; } public System.Collections.Generic.IDictionary? PatternProperties { get; } public System.Collections.Generic.IDictionary? Properties { get; } public bool ReadOnly { get; } - public System.Collections.Generic.HashSet? Required { get; } + public System.Collections.Generic.ISet? Required { get; } public System.Uri? Schema { get; } public string? Title { get; } public Microsoft.OpenApi.Models.JsonSchemaType? Type { get; } @@ -1430,9 +1429,9 @@ namespace Microsoft.OpenApi.Reader public class OpenApiDiagnostic : Microsoft.OpenApi.Interfaces.IDiagnostic { public OpenApiDiagnostic() { } - public System.Collections.Generic.List Errors { get; set; } + public System.Collections.Generic.IList Errors { get; set; } public Microsoft.OpenApi.OpenApiSpecVersion SpecificationVersion { get; set; } - public System.Collections.Generic.List Warnings { get; set; } + public System.Collections.Generic.IList Warnings { get; set; } public void AppendDiagnostic(Microsoft.OpenApi.Reader.OpenApiDiagnostic diagnosticToAdd, string? fileNameToAdd = null) { } } public class OpenApiJsonReader : Microsoft.OpenApi.Interfaces.IOpenApiReader @@ -1620,8 +1619,6 @@ namespace Microsoft.OpenApi.Services public virtual void Visit(Microsoft.OpenApi.Models.OpenApiServerVariable serverVariable) { } public virtual void Visit(Microsoft.OpenApi.Models.OpenApiTag tag) { } public virtual void Visit(Microsoft.OpenApi.Models.References.OpenApiTagReference tag) { } - public virtual void Visit(System.Collections.Generic.HashSet openApiTags) { } - public virtual void Visit(System.Collections.Generic.HashSet openApiTags) { } public virtual void Visit(System.Collections.Generic.IDictionary operations) { } public virtual void Visit(System.Collections.Generic.IDictionary callbacks) { } public virtual void Visit(System.Collections.Generic.IDictionary examples) { } @@ -1631,10 +1628,12 @@ namespace Microsoft.OpenApi.Services public virtual void Visit(System.Collections.Generic.IDictionary encodings) { } public virtual void Visit(System.Collections.Generic.IDictionary content) { } public virtual void Visit(System.Collections.Generic.IDictionary serverVariables) { } + public virtual void Visit(System.Collections.Generic.IList parameters) { } + public virtual void Visit(System.Collections.Generic.IList openApiSecurityRequirements) { } + public virtual void Visit(System.Collections.Generic.IList servers) { } + public virtual void Visit(System.Collections.Generic.ISet openApiTags) { } + public virtual void Visit(System.Collections.Generic.ISet openApiTags) { } public virtual void Visit(System.Collections.Generic.List example) { } - public virtual void Visit(System.Collections.Generic.List parameters) { } - public virtual void Visit(System.Collections.Generic.List openApiSecurityRequirements) { } - public virtual void Visit(System.Collections.Generic.List servers) { } public virtual void Visit(System.Text.Json.Nodes.JsonNode node) { } } public class OpenApiWalker @@ -1659,16 +1658,16 @@ namespace Microsoft.OpenApi.Services public class OperationSearch : Microsoft.OpenApi.Services.OpenApiVisitorBase { public OperationSearch(System.Func predicate) { } - public System.Collections.Generic.List SearchResults { get; } + public System.Collections.Generic.IList SearchResults { get; } public override void Visit(Microsoft.OpenApi.Models.Interfaces.IOpenApiPathItem pathItem) { } - public override void Visit(System.Collections.Generic.List parameters) { } + public override void Visit(System.Collections.Generic.IList parameters) { } } public class SearchResult { public SearchResult() { } public Microsoft.OpenApi.Services.CurrentKeys? CurrentKeys { get; set; } public Microsoft.OpenApi.Models.OpenApiOperation? Operation { get; set; } - public System.Collections.Generic.List? Parameters { get; set; } + public System.Collections.Generic.IList? Parameters { get; set; } } } namespace Microsoft.OpenApi.Validations @@ -1751,13 +1750,13 @@ namespace Microsoft.OpenApi.Validations public ValidationRuleSet(Microsoft.OpenApi.Validations.ValidationRuleSet ruleSet) { } public ValidationRuleSet(System.Collections.Generic.Dictionary> rules) { } public int Count { get; } - public System.Collections.Generic.List Rules { get; } + public System.Collections.Generic.IList Rules { get; } public void Add(System.Type key, Microsoft.OpenApi.Validations.ValidationRule rule) { } public void Add(System.Type key, System.Collections.Generic.List rules) { } public void Clear() { } public bool Contains(System.Type key, Microsoft.OpenApi.Validations.ValidationRule rule) { } public bool ContainsKey(System.Type key) { } - public System.Collections.Generic.List FindRules(System.Type type) { } + public System.Collections.Generic.IList FindRules(System.Type type) { } public System.Collections.Generic.IEnumerator GetEnumerator() { } public bool Remove(Microsoft.OpenApi.Validations.ValidationRule rule) { } public bool Remove(System.Type key) { } @@ -1856,7 +1855,7 @@ namespace Microsoft.OpenApi.Validations.Rules public static class OpenApiSchemaRules { public static Microsoft.OpenApi.Validations.ValidationRule ValidateSchemaDiscriminator { get; } - public static bool TraverseSchemaElements(string discriminatorName, System.Collections.Generic.List? childSchema) { } + public static bool TraverseSchemaElements(string discriminatorName, System.Collections.Generic.IList? childSchema) { } public static bool ValidateChildSchemaAgainstDiscriminator(Microsoft.OpenApi.Models.Interfaces.IOpenApiSchema schema, string? discriminatorName) { } } [Microsoft.OpenApi.Validations.Rules.OpenApiRule] @@ -1993,10 +1992,9 @@ namespace Microsoft.OpenApi.Writers public class OpenApiWriterSettings { public OpenApiWriterSettings() { } - public bool EnableSorting { get; set; } + public System.Collections.Generic.IComparer? Comparer { get; set; } public bool InlineExternalReferences { get; set; } public bool InlineLocalReferences { get; set; } - public System.Collections.Generic.IComparer? KeyComparer { get; set; } } public class OpenApiYamlWriter : Microsoft.OpenApi.Writers.OpenApiWriterBase { From 064b6caea5dab26250b12725e6b00aa3fae7196f Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Wed, 28 May 2025 15:07:27 +0300 Subject: [PATCH 09/12] chore: WIP on fix/revert-to-IDictionary-and-allow-sorting --- .../Validations/Rules/OpenApiComponentsRules.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi/Validations/Rules/OpenApiComponentsRules.cs b/src/Microsoft.OpenApi/Validations/Rules/OpenApiComponentsRules.cs index 80ab4e9ab..78269bcf2 100644 --- a/src/Microsoft.OpenApi/Validations/Rules/OpenApiComponentsRules.cs +++ b/src/Microsoft.OpenApi/Validations/Rules/OpenApiComponentsRules.cs @@ -5,6 +5,7 @@ using System.Text.RegularExpressions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Properties; +using System; namespace Microsoft.OpenApi.Validations.Rules { @@ -17,7 +18,7 @@ public static class OpenApiComponentsRules /// /// The key regex. /// - internal static readonly Regex KeyRegex = new(@"^[a-zA-Z0-9\.\-_]+$"); + internal static readonly Regex KeyRegex = new(@"^[a-zA-Z0-9\.\-_]+$", RegexOptions.None, TimeSpan.FromMilliseconds(100)); /// /// All the fixed fields declared above are objects From 85cd4b96b5004e39100cc8a202af390740305122 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Wed, 28 May 2025 15:07:45 +0300 Subject: [PATCH 10/12] chore: update memory allocation baselines --- .../performance.Descriptions-report.json | 1183 ++++++++++++++++- 1 file changed, 1182 insertions(+), 1 deletion(-) diff --git a/performance/benchmark/BenchmarkDotNet.Artifacts/results/performance.Descriptions-report.json b/performance/benchmark/BenchmarkDotNet.Artifacts/results/performance.Descriptions-report.json index 08e7c6c92..14e8fb356 100644 --- a/performance/benchmark/BenchmarkDotNet.Artifacts/results/performance.Descriptions-report.json +++ b/performance/benchmark/BenchmarkDotNet.Artifacts/results/performance.Descriptions-report.json @@ -1 +1,1182 @@ -{"Title":"performance.Descriptions-20250514-154213","HostEnvironmentInfo":{"BenchmarkDotNetCaption":"BenchmarkDotNet","BenchmarkDotNetVersion":"0.14.0","OsVersion":"Windows 11 (10.0.26100.3981)","ProcessorName":"11th Gen Intel Core i7-1185G7 3.00GHz","PhysicalProcessorCount":1,"PhysicalCoreCount":4,"LogicalCoreCount":8,"RuntimeVersion":".NET 8.0.16 (8.0.1625.21506)","Architecture":"X64","HasAttachedDebugger":false,"HasRyuJit":true,"Configuration":"RELEASE","DotNetCliVersion":"8.0.409","ChronometerFrequency":{"Hertz":10000000},"HardwareTimerKind":"Unknown"},"Benchmarks":[{"DisplayInfo":"Descriptions.PetStoreYaml: ShortRun(IterationCount=3, LaunchCount=1, WarmupCount=3)","Namespace":"performance","Type":"Descriptions","Method":"PetStoreYaml","MethodTitle":"PetStoreYaml","Parameters":"","FullName":"performance.Descriptions.PetStoreYaml","HardwareIntrinsics":"AVX-512F+CD+BW+DQ+VL+VBMI,AES,BMI1,BMI2,FMA,LZCNT,PCLMUL,POPCNT VectorSize=256","Statistics":{"OriginalValues":[465362.5,466458.984375,478982.8125],"N":3,"Min":465362.5,"LowerFence":455695.5078125,"Q1":465910.7421875,"Median":466458.984375,"Mean":470268.0989583333,"Q3":472720.8984375,"UpperFence":482936.1328125,"Max":478982.8125,"InterquartileRange":6810.15625,"LowerOutliers":[],"UpperOutliers":[],"AllOutliers":[],"StandardError":4368.838273543516,"Variance":57260243.58113606,"StandardDeviation":7567.049859828866,"Skewness":0.37582823758451755,"Kurtosis":0.6666666666666706,"ConfidenceInterval":{"N":3,"Mean":470268.0989583333,"StandardError":4368.838273543516,"Level":12,"Margin":138051.1584827056,"Lower":332216.9404756277,"Upper":608319.257441039},"Percentiles":{"P0":465362.5,"P25":465910.7421875,"P50":466458.984375,"P67":470717.0859375,"P80":473973.28125,"P85":475225.6640625,"P90":476478.046875,"P95":477730.4296875,"P100":478982.8125}},"Memory":{"Gen0Collections":15,"Gen1Collections":3,"Gen2Collections":0,"TotalOperations":256,"BytesAllocatedPerOperation":389660},"Measurements":[{"IterationMode":"Overhead","IterationStage":"Jitting","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":210500},{"IterationMode":"Workload","IterationStage":"Jitting","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":82571800},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":1,"Operations":2,"Nanoseconds":3872500},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":2,"Operations":3,"Nanoseconds":6115500},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":3,"Operations":4,"Nanoseconds":7331400},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":4,"Operations":5,"Nanoseconds":9186500},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":5,"Operations":6,"Nanoseconds":12504800},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":6,"Operations":7,"Nanoseconds":14797700},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":7,"Operations":8,"Nanoseconds":14768200},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":8,"Operations":9,"Nanoseconds":18440400},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":9,"Operations":10,"Nanoseconds":21516300},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":10,"Operations":11,"Nanoseconds":20485000},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":11,"Operations":12,"Nanoseconds":25991800},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":12,"Operations":13,"Nanoseconds":24538900},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":13,"Operations":14,"Nanoseconds":30255300},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":14,"Operations":15,"Nanoseconds":27933500},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":15,"Operations":16,"Nanoseconds":31059700},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":16,"Operations":32,"Nanoseconds":63905200},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":17,"Operations":64,"Nanoseconds":111009300},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":18,"Operations":128,"Nanoseconds":268925200},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":19,"Operations":256,"Nanoseconds":716804800},{"IterationMode":"Workload","IterationStage":"Warmup","LaunchIndex":1,"IterationIndex":1,"Operations":256,"Nanoseconds":220782800},{"IterationMode":"Workload","IterationStage":"Warmup","LaunchIndex":1,"IterationIndex":2,"Operations":256,"Nanoseconds":174724700},{"IterationMode":"Workload","IterationStage":"Warmup","LaunchIndex":1,"IterationIndex":3,"Operations":256,"Nanoseconds":127336100},{"IterationMode":"Workload","IterationStage":"Actual","LaunchIndex":1,"IterationIndex":1,"Operations":256,"Nanoseconds":119132800},{"IterationMode":"Workload","IterationStage":"Actual","LaunchIndex":1,"IterationIndex":2,"Operations":256,"Nanoseconds":119413500},{"IterationMode":"Workload","IterationStage":"Actual","LaunchIndex":1,"IterationIndex":3,"Operations":256,"Nanoseconds":122619600},{"IterationMode":"Workload","IterationStage":"Result","LaunchIndex":1,"IterationIndex":1,"Operations":256,"Nanoseconds":119132800},{"IterationMode":"Workload","IterationStage":"Result","LaunchIndex":1,"IterationIndex":2,"Operations":256,"Nanoseconds":119413500},{"IterationMode":"Workload","IterationStage":"Result","LaunchIndex":1,"IterationIndex":3,"Operations":256,"Nanoseconds":122619600}],"Metrics":[{"Value":58.59375,"Descriptor":{"Id":"Gen0Collects","DisplayName":"Gen0","Legend":"GC Generation 0 collects per 1000 operations","NumberFormat":"#0.0000","UnitType":0,"Unit":"Count","TheGreaterTheBetter":false,"PriorityInCategory":0}},{"Value":11.71875,"Descriptor":{"Id":"Gen1Collects","DisplayName":"Gen1","Legend":"GC Generation 1 collects per 1000 operations","NumberFormat":"#0.0000","UnitType":0,"Unit":"Count","TheGreaterTheBetter":false,"PriorityInCategory":1}},{"Value":0,"Descriptor":{"Id":"Gen2Collects","DisplayName":"Gen2","Legend":"GC Generation 2 collects per 1000 operations","NumberFormat":"#0.0000","UnitType":0,"Unit":"Count","TheGreaterTheBetter":false,"PriorityInCategory":2}},{"Value":389660,"Descriptor":{"Id":"Allocated Memory","DisplayName":"Allocated","Legend":"Allocated memory per single operation (managed only, inclusive, 1KB = 1024B)","NumberFormat":"0.##","UnitType":2,"Unit":"B","TheGreaterTheBetter":false,"PriorityInCategory":3}}]},{"DisplayInfo":"Descriptions.PetStoreJson: ShortRun(IterationCount=3, LaunchCount=1, WarmupCount=3)","Namespace":"performance","Type":"Descriptions","Method":"PetStoreJson","MethodTitle":"PetStoreJson","Parameters":"","FullName":"performance.Descriptions.PetStoreJson","HardwareIntrinsics":"AVX-512F+CD+BW+DQ+VL+VBMI,AES,BMI1,BMI2,FMA,LZCNT,PCLMUL,POPCNT VectorSize=256","Statistics":{"OriginalValues":[164686.81640625,164494.04296875,168749.0234375],"N":3,"Min":164494.04296875,"LowerFence":161399.1943359375,"Q1":164590.4296875,"Median":164686.81640625,"Mean":165976.62760416666,"Q3":166717.919921875,"UpperFence":169909.1552734375,"Max":168749.0234375,"InterquartileRange":2127.490234375,"LowerOutliers":[],"UpperOutliers":[],"AllOutliers":[],"StandardError":1387.3144791363893,"Variance":5773924.392064413,"StandardDeviation":2402.8991639401793,"Skewness":0.38211513228079363,"Kurtosis":0.6666666666666727,"ConfidenceInterval":{"N":3,"Mean":165976.62760416666,"StandardError":1387.3144791363893,"Level":12,"Margin":43837.82576352267,"Lower":122138.80184064398,"Upper":209814.45336768933},"Percentiles":{"P0":164494.04296875,"P25":164590.4296875,"P50":164686.81640625,"P67":166067.966796875,"P80":167124.140625,"P85":167530.361328125,"P90":167936.58203125,"P95":168342.802734375,"P100":168749.0234375}},"Memory":{"Gen0Collections":40,"Gen1Collections":9,"Gen2Collections":0,"TotalOperations":1024,"BytesAllocatedPerOperation":248489},"Measurements":[{"IterationMode":"Overhead","IterationStage":"Jitting","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":229900},{"IterationMode":"Workload","IterationStage":"Jitting","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":49778600},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":1,"Operations":2,"Nanoseconds":1747400},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":2,"Operations":3,"Nanoseconds":1888900},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":3,"Operations":4,"Nanoseconds":2252800},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":4,"Operations":5,"Nanoseconds":3001800},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":5,"Operations":6,"Nanoseconds":4090800},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":6,"Operations":7,"Nanoseconds":4234800},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":7,"Operations":8,"Nanoseconds":5649900},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":8,"Operations":9,"Nanoseconds":5566900},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":9,"Operations":10,"Nanoseconds":7057700},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":10,"Operations":11,"Nanoseconds":7532000},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":11,"Operations":12,"Nanoseconds":8156400},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":12,"Operations":13,"Nanoseconds":7620800},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":13,"Operations":14,"Nanoseconds":8519200},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":14,"Operations":15,"Nanoseconds":10029200},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":15,"Operations":16,"Nanoseconds":10782300},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":16,"Operations":32,"Nanoseconds":19995000},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":17,"Operations":64,"Nanoseconds":40188000},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":18,"Operations":128,"Nanoseconds":74045000},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":19,"Operations":256,"Nanoseconds":146500400},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":20,"Operations":512,"Nanoseconds":305057600},{"IterationMode":"Workload","IterationStage":"Pilot","LaunchIndex":1,"IterationIndex":21,"Operations":1024,"Nanoseconds":590308900},{"IterationMode":"Workload","IterationStage":"Warmup","LaunchIndex":1,"IterationIndex":1,"Operations":1024,"Nanoseconds":476135100},{"IterationMode":"Workload","IterationStage":"Warmup","LaunchIndex":1,"IterationIndex":2,"Operations":1024,"Nanoseconds":190273500},{"IterationMode":"Workload","IterationStage":"Warmup","LaunchIndex":1,"IterationIndex":3,"Operations":1024,"Nanoseconds":170380100},{"IterationMode":"Workload","IterationStage":"Actual","LaunchIndex":1,"IterationIndex":1,"Operations":1024,"Nanoseconds":168639300},{"IterationMode":"Workload","IterationStage":"Actual","LaunchIndex":1,"IterationIndex":2,"Operations":1024,"Nanoseconds":168441900},{"IterationMode":"Workload","IterationStage":"Actual","LaunchIndex":1,"IterationIndex":3,"Operations":1024,"Nanoseconds":172799000},{"IterationMode":"Workload","IterationStage":"Result","LaunchIndex":1,"IterationIndex":1,"Operations":1024,"Nanoseconds":168639300},{"IterationMode":"Workload","IterationStage":"Result","LaunchIndex":1,"IterationIndex":2,"Operations":1024,"Nanoseconds":168441900},{"IterationMode":"Workload","IterationStage":"Result","LaunchIndex":1,"IterationIndex":3,"Operations":1024,"Nanoseconds":172799000}],"Metrics":[{"Value":39.0625,"Descriptor":{"Id":"Gen0Collects","DisplayName":"Gen0","Legend":"GC Generation 0 collects per 1000 operations","NumberFormat":"#0.0000","UnitType":0,"Unit":"Count","TheGreaterTheBetter":false,"PriorityInCategory":0}},{"Value":8.7890625,"Descriptor":{"Id":"Gen1Collects","DisplayName":"Gen1","Legend":"GC Generation 1 collects per 1000 operations","NumberFormat":"#0.0000","UnitType":0,"Unit":"Count","TheGreaterTheBetter":false,"PriorityInCategory":1}},{"Value":0,"Descriptor":{"Id":"Gen2Collects","DisplayName":"Gen2","Legend":"GC Generation 2 collects per 1000 operations","NumberFormat":"#0.0000","UnitType":0,"Unit":"Count","TheGreaterTheBetter":false,"PriorityInCategory":2}},{"Value":248489,"Descriptor":{"Id":"Allocated Memory","DisplayName":"Allocated","Legend":"Allocated memory per single operation (managed only, inclusive, 1KB = 1024B)","NumberFormat":"0.##","UnitType":2,"Unit":"B","TheGreaterTheBetter":false,"PriorityInCategory":3}}]},{"DisplayInfo":"Descriptions.GHESYaml: ShortRun(IterationCount=3, LaunchCount=1, WarmupCount=3)","Namespace":"performance","Type":"Descriptions","Method":"GHESYaml","MethodTitle":"GHESYaml","Parameters":"","FullName":"performance.Descriptions.GHESYaml","HardwareIntrinsics":"AVX-512F+CD+BW+DQ+VL+VBMI,AES,BMI1,BMI2,FMA,LZCNT,PCLMUL,POPCNT VectorSize=256","Statistics":{"OriginalValues":[945590600,929477300,871151200],"N":3,"Min":871151200,"LowerFence":844484700,"Q1":900314250,"Median":929477300,"Mean":915406366.6666666,"Q3":937533950,"UpperFence":993363500,"Max":945590600,"InterquartileRange":37219700,"LowerOutliers":[],"UpperOutliers":[],"AllOutliers":[],"StandardError":22611202.546107784,"Variance":1533799441743333.5,"StandardDeviation":39163751.63008944,"Skewness":-0.3129062028807021,"Kurtosis":0.6666666666666653,"ConfidenceInterval":{"N":3,"Mean":915406366.6666666,"StandardError":22611202.546107784,"Level":12,"Margin":714492620.4021431,"Lower":200913746.2645235,"Upper":1629898987.0688097},"Percentiles":{"P0":871151200,"P25":900314250,"P50":929477300,"P67":934955822,"P80":939145280,"P85":940756610,"P90":942367940,"P95":943979270,"P100":945590600}},"Memory":{"Gen0Collections":68,"Gen1Collections":22,"Gen2Collections":4,"TotalOperations":1,"BytesAllocatedPerOperation":405300208},"Measurements":[{"IterationMode":"Overhead","IterationStage":"Jitting","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":238300},{"IterationMode":"Workload","IterationStage":"Jitting","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":1805606300},{"IterationMode":"Overhead","IterationStage":"Jitting","LaunchIndex":1,"IterationIndex":2,"Operations":1,"Nanoseconds":600},{"IterationMode":"Workload","IterationStage":"Jitting","LaunchIndex":1,"IterationIndex":2,"Operations":1,"Nanoseconds":1068747500},{"IterationMode":"Workload","IterationStage":"Warmup","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":998100500},{"IterationMode":"Workload","IterationStage":"Warmup","LaunchIndex":1,"IterationIndex":2,"Operations":1,"Nanoseconds":922151200},{"IterationMode":"Workload","IterationStage":"Warmup","LaunchIndex":1,"IterationIndex":3,"Operations":1,"Nanoseconds":915421700},{"IterationMode":"Workload","IterationStage":"Actual","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":945590600},{"IterationMode":"Workload","IterationStage":"Actual","LaunchIndex":1,"IterationIndex":2,"Operations":1,"Nanoseconds":929477300},{"IterationMode":"Workload","IterationStage":"Actual","LaunchIndex":1,"IterationIndex":3,"Operations":1,"Nanoseconds":871151200},{"IterationMode":"Workload","IterationStage":"Result","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":945590600},{"IterationMode":"Workload","IterationStage":"Result","LaunchIndex":1,"IterationIndex":2,"Operations":1,"Nanoseconds":929477300},{"IterationMode":"Workload","IterationStage":"Result","LaunchIndex":1,"IterationIndex":3,"Operations":1,"Nanoseconds":871151200}],"Metrics":[{"Value":68000,"Descriptor":{"Id":"Gen0Collects","DisplayName":"Gen0","Legend":"GC Generation 0 collects per 1000 operations","NumberFormat":"#0.0000","UnitType":0,"Unit":"Count","TheGreaterTheBetter":false,"PriorityInCategory":0}},{"Value":22000,"Descriptor":{"Id":"Gen1Collects","DisplayName":"Gen1","Legend":"GC Generation 1 collects per 1000 operations","NumberFormat":"#0.0000","UnitType":0,"Unit":"Count","TheGreaterTheBetter":false,"PriorityInCategory":1}},{"Value":4000,"Descriptor":{"Id":"Gen2Collects","DisplayName":"Gen2","Legend":"GC Generation 2 collects per 1000 operations","NumberFormat":"#0.0000","UnitType":0,"Unit":"Count","TheGreaterTheBetter":false,"PriorityInCategory":2}},{"Value":405300208,"Descriptor":{"Id":"Allocated Memory","DisplayName":"Allocated","Legend":"Allocated memory per single operation (managed only, inclusive, 1KB = 1024B)","NumberFormat":"0.##","UnitType":2,"Unit":"B","TheGreaterTheBetter":false,"PriorityInCategory":3}}]},{"DisplayInfo":"Descriptions.GHESJson: ShortRun(IterationCount=3, LaunchCount=1, WarmupCount=3)","Namespace":"performance","Type":"Descriptions","Method":"GHESJson","MethodTitle":"GHESJson","Parameters":"","FullName":"performance.Descriptions.GHESJson","HardwareIntrinsics":"AVX-512F+CD+BW+DQ+VL+VBMI,AES,BMI1,BMI2,FMA,LZCNT,PCLMUL,POPCNT VectorSize=256","Statistics":{"OriginalValues":[486026300,468580000,457221900],"N":3,"Min":457221900,"LowerFence":441297650,"Q1":462900950,"Median":468580000,"Mean":470609400,"Q3":477303150,"UpperFence":498906450,"Max":486026300,"InterquartileRange":14402200,"LowerOutliers":[],"UpperOutliers":[],"AllOutliers":[],"StandardError":8376797.580420177,"Variance":210512213110000,"StandardDeviation":14509039.014007784,"Skewness":0.13713498071671384,"Kurtosis":0.6666666666666666,"ConfidenceInterval":{"N":3,"Mean":470609400,"StandardError":8376797.580420177,"Level":12,"Margin":264698882.84836096,"Lower":205910517.15163904,"Upper":735308282.848361},"Percentiles":{"P0":457221900,"P25":462900950,"P50":468580000,"P67":474511742,"P80":479047780,"P85":480792410,"P90":482537040,"P95":484281670,"P100":486026300}},"Memory":{"Gen0Collections":42,"Gen1Collections":15,"Gen2Collections":3,"TotalOperations":1,"BytesAllocatedPerOperation":263444936},"Measurements":[{"IterationMode":"Overhead","IterationStage":"Jitting","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":609500},{"IterationMode":"Workload","IterationStage":"Jitting","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":1017050000},{"IterationMode":"Overhead","IterationStage":"Jitting","LaunchIndex":1,"IterationIndex":2,"Operations":1,"Nanoseconds":600},{"IterationMode":"Workload","IterationStage":"Jitting","LaunchIndex":1,"IterationIndex":2,"Operations":1,"Nanoseconds":836928600},{"IterationMode":"Workload","IterationStage":"Warmup","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":626599200},{"IterationMode":"Workload","IterationStage":"Warmup","LaunchIndex":1,"IterationIndex":2,"Operations":1,"Nanoseconds":501412100},{"IterationMode":"Workload","IterationStage":"Warmup","LaunchIndex":1,"IterationIndex":3,"Operations":1,"Nanoseconds":495906300},{"IterationMode":"Workload","IterationStage":"Actual","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":486026300},{"IterationMode":"Workload","IterationStage":"Actual","LaunchIndex":1,"IterationIndex":2,"Operations":1,"Nanoseconds":468580000},{"IterationMode":"Workload","IterationStage":"Actual","LaunchIndex":1,"IterationIndex":3,"Operations":1,"Nanoseconds":457221900},{"IterationMode":"Workload","IterationStage":"Result","LaunchIndex":1,"IterationIndex":1,"Operations":1,"Nanoseconds":486026300},{"IterationMode":"Workload","IterationStage":"Result","LaunchIndex":1,"IterationIndex":2,"Operations":1,"Nanoseconds":468580000},{"IterationMode":"Workload","IterationStage":"Result","LaunchIndex":1,"IterationIndex":3,"Operations":1,"Nanoseconds":457221900}],"Metrics":[{"Value":42000,"Descriptor":{"Id":"Gen0Collects","DisplayName":"Gen0","Legend":"GC Generation 0 collects per 1000 operations","NumberFormat":"#0.0000","UnitType":0,"Unit":"Count","TheGreaterTheBetter":false,"PriorityInCategory":0}},{"Value":15000,"Descriptor":{"Id":"Gen1Collects","DisplayName":"Gen1","Legend":"GC Generation 1 collects per 1000 operations","NumberFormat":"#0.0000","UnitType":0,"Unit":"Count","TheGreaterTheBetter":false,"PriorityInCategory":1}},{"Value":3000,"Descriptor":{"Id":"Gen2Collects","DisplayName":"Gen2","Legend":"GC Generation 2 collects per 1000 operations","NumberFormat":"#0.0000","UnitType":0,"Unit":"Count","TheGreaterTheBetter":false,"PriorityInCategory":2}},{"Value":263444936,"Descriptor":{"Id":"Allocated Memory","DisplayName":"Allocated","Legend":"Allocated memory per single operation (managed only, inclusive, 1KB = 1024B)","NumberFormat":"0.##","UnitType":2,"Unit":"B","TheGreaterTheBetter":false,"PriorityInCategory":3}}]}]} +{ + "Title": "performance.Descriptions-20250514-154213", + "HostEnvironmentInfo": { + "BenchmarkDotNetCaption": "BenchmarkDotNet", + "BenchmarkDotNetVersion": "0.14.0", + "OsVersion": "Windows 11 (10.0.26100.3981)", + "ProcessorName": "11th Gen Intel Core i7-1185G7 3.00GHz", + "PhysicalProcessorCount": 1, + "PhysicalCoreCount": 4, + "LogicalCoreCount": 8, + "RuntimeVersion": ".NET 8.0.16 (8.0.1625.21506)", + "Architecture": "X64", + "HasAttachedDebugger": false, + "HasRyuJit": true, + "Configuration": "RELEASE", + "DotNetCliVersion": "8.0.409", + "ChronometerFrequency": { "Hertz": 10000000 }, + "HardwareTimerKind": "Unknown" + }, + "Benchmarks": [ + { + "DisplayInfo": "Descriptions.PetStoreYaml: ShortRun(IterationCount=3, LaunchCount=1, WarmupCount=3)", + "Namespace": "performance", + "Type": "Descriptions", + "Method": "PetStoreYaml", + "MethodTitle": "PetStoreYaml", + "Parameters": "", + "FullName": "performance.Descriptions.PetStoreYaml", + "HardwareIntrinsics": "AVX-512F+CD+BW+DQ+VL+VBMI,AES,BMI1,BMI2,FMA,LZCNT,PCLMUL,POPCNT VectorSize=256", + "Statistics": { + "OriginalValues": [ 465362.5, 466458.984375, 478982.8125 ], + "N": 3, + "Min": 465362.5, + "LowerFence": 455695.5078125, + "Q1": 465910.7421875, + "Median": 466458.984375, + "Mean": 470268.0989583333, + "Q3": 472720.8984375, + "UpperFence": 482936.1328125, + "Max": 478982.8125, + "InterquartileRange": 6810.15625, + "LowerOutliers": [], + "UpperOutliers": [], + "AllOutliers": [], + "StandardError": 4368.838273543516, + "Variance": 57260243.58113606, + "StandardDeviation": 7567.049859828866, + "Skewness": 0.37582823758451755, + "Kurtosis": 0.6666666666666706, + "ConfidenceInterval": { + "N": 3, + "Mean": 470268.0989583333, + "StandardError": 4368.838273543516, + "Level": 12, + "Margin": 138051.1584827056, + "Lower": 332216.9404756277, + "Upper": 608319.257441039 + }, + "Percentiles": { + "P0": 465362.5, + "P25": 465910.7421875, + "P50": 466458.984375, + "P67": 470717.0859375, + "P80": 473973.28125, + "P85": 475225.6640625, + "P90": 476478.046875, + "P95": 477730.4296875, + "P100": 478982.8125 + } + }, + "Memory": { + "Gen0Collections": 15, + "Gen1Collections": 3, + "Gen2Collections": 0, + "TotalOperations": 256, + "BytesAllocatedPerOperation": 396052 + }, + "Measurements": [ + { + "IterationMode": "Overhead", + "IterationStage": "Jitting", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 210500 + }, + { + "IterationMode": "Workload", + "IterationStage": "Jitting", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 82571800 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 2, + "Nanoseconds": 3872500 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 3, + "Nanoseconds": 6115500 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 4, + "Nanoseconds": 7331400 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 4, + "Operations": 5, + "Nanoseconds": 9186500 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 5, + "Operations": 6, + "Nanoseconds": 12504800 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 6, + "Operations": 7, + "Nanoseconds": 14797700 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 7, + "Operations": 8, + "Nanoseconds": 14768200 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 8, + "Operations": 9, + "Nanoseconds": 18440400 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 9, + "Operations": 10, + "Nanoseconds": 21516300 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 10, + "Operations": 11, + "Nanoseconds": 20485000 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 11, + "Operations": 12, + "Nanoseconds": 25991800 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 12, + "Operations": 13, + "Nanoseconds": 24538900 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 13, + "Operations": 14, + "Nanoseconds": 30255300 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 14, + "Operations": 15, + "Nanoseconds": 27933500 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 15, + "Operations": 16, + "Nanoseconds": 31059700 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 16, + "Operations": 32, + "Nanoseconds": 63905200 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 17, + "Operations": 64, + "Nanoseconds": 111009300 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 18, + "Operations": 128, + "Nanoseconds": 268925200 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 19, + "Operations": 256, + "Nanoseconds": 716804800 + }, + { + "IterationMode": "Workload", + "IterationStage": "Warmup", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 256, + "Nanoseconds": 220782800 + }, + { + "IterationMode": "Workload", + "IterationStage": "Warmup", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 256, + "Nanoseconds": 174724700 + }, + { + "IterationMode": "Workload", + "IterationStage": "Warmup", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 256, + "Nanoseconds": 127336100 + }, + { + "IterationMode": "Workload", + "IterationStage": "Actual", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 256, + "Nanoseconds": 119132800 + }, + { + "IterationMode": "Workload", + "IterationStage": "Actual", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 256, + "Nanoseconds": 119413500 + }, + { + "IterationMode": "Workload", + "IterationStage": "Actual", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 256, + "Nanoseconds": 122619600 + }, + { + "IterationMode": "Workload", + "IterationStage": "Result", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 256, + "Nanoseconds": 119132800 + }, + { + "IterationMode": "Workload", + "IterationStage": "Result", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 256, + "Nanoseconds": 119413500 + }, + { + "IterationMode": "Workload", + "IterationStage": "Result", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 256, + "Nanoseconds": 122619600 + } + ], + "Metrics": [ + { + "Value": 58.59375, + "Descriptor": { + "Id": "Gen0Collects", + "DisplayName": "Gen0", + "Legend": "GC Generation 0 collects per 1000 operations", + "NumberFormat": "#0.0000", + "UnitType": 0, + "Unit": "Count", + "TheGreaterTheBetter": false, + "PriorityInCategory": 0 + } + }, + { + "Value": 11.71875, + "Descriptor": { + "Id": "Gen1Collects", + "DisplayName": "Gen1", + "Legend": "GC Generation 1 collects per 1000 operations", + "NumberFormat": "#0.0000", + "UnitType": 0, + "Unit": "Count", + "TheGreaterTheBetter": false, + "PriorityInCategory": 1 + } + }, + { + "Value": 0, + "Descriptor": { + "Id": "Gen2Collects", + "DisplayName": "Gen2", + "Legend": "GC Generation 2 collects per 1000 operations", + "NumberFormat": "#0.0000", + "UnitType": 0, + "Unit": "Count", + "TheGreaterTheBetter": false, + "PriorityInCategory": 2 + } + }, + { + "Value": 396052, + "Descriptor": { + "Id": "Allocated Memory", + "DisplayName": "Allocated", + "Legend": "Allocated memory per single operation (managed only, inclusive, 1KB = 1024B)", + "NumberFormat": "0.##", + "UnitType": 2, + "Unit": "B", + "TheGreaterTheBetter": false, + "PriorityInCategory": 3 + } + } + ] + }, + { + "DisplayInfo": "Descriptions.PetStoreJson: ShortRun(IterationCount=3, LaunchCount=1, WarmupCount=3)", + "Namespace": "performance", + "Type": "Descriptions", + "Method": "PetStoreJson", + "MethodTitle": "PetStoreJson", + "Parameters": "", + "FullName": "performance.Descriptions.PetStoreJson", + "HardwareIntrinsics": "AVX-512F+CD+BW+DQ+VL+VBMI,AES,BMI1,BMI2,FMA,LZCNT,PCLMUL,POPCNT VectorSize=256", + "Statistics": { + "OriginalValues": [ 164686.81640625, 164494.04296875, 168749.0234375 ], + "N": 3, + "Min": 164494.04296875, + "LowerFence": 161399.1943359375, + "Q1": 164590.4296875, + "Median": 164686.81640625, + "Mean": 165976.62760416666, + "Q3": 166717.919921875, + "UpperFence": 169909.1552734375, + "Max": 168749.0234375, + "InterquartileRange": 2127.490234375, + "LowerOutliers": [], + "UpperOutliers": [], + "AllOutliers": [], + "StandardError": 1387.3144791363893, + "Variance": 5773924.392064413, + "StandardDeviation": 2402.8991639401793, + "Skewness": 0.38211513228079363, + "Kurtosis": 0.6666666666666727, + "ConfidenceInterval": { + "N": 3, + "Mean": 165976.62760416666, + "StandardError": 1387.3144791363893, + "Level": 12, + "Margin": 43837.82576352267, + "Lower": 122138.80184064398, + "Upper": 209814.45336768933 + }, + "Percentiles": { + "P0": 164494.04296875, + "P25": 164590.4296875, + "P50": 164686.81640625, + "P67": 166067.966796875, + "P80": 167124.140625, + "P85": 167530.361328125, + "P90": 167936.58203125, + "P95": 168342.802734375, + "P100": 168749.0234375 + } + }, + "Memory": { + "Gen0Collections": 40, + "Gen1Collections": 9, + "Gen2Collections": 0, + "TotalOperations": 1024, + "BytesAllocatedPerOperation": 254585 + }, + "Measurements": [ + { + "IterationMode": "Overhead", + "IterationStage": "Jitting", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 229900 + }, + { + "IterationMode": "Workload", + "IterationStage": "Jitting", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 49778600 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 2, + "Nanoseconds": 1747400 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 3, + "Nanoseconds": 1888900 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 4, + "Nanoseconds": 2252800 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 4, + "Operations": 5, + "Nanoseconds": 3001800 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 5, + "Operations": 6, + "Nanoseconds": 4090800 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 6, + "Operations": 7, + "Nanoseconds": 4234800 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 7, + "Operations": 8, + "Nanoseconds": 5649900 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 8, + "Operations": 9, + "Nanoseconds": 5566900 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 9, + "Operations": 10, + "Nanoseconds": 7057700 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 10, + "Operations": 11, + "Nanoseconds": 7532000 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 11, + "Operations": 12, + "Nanoseconds": 8156400 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 12, + "Operations": 13, + "Nanoseconds": 7620800 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 13, + "Operations": 14, + "Nanoseconds": 8519200 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 14, + "Operations": 15, + "Nanoseconds": 10029200 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 15, + "Operations": 16, + "Nanoseconds": 10782300 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 16, + "Operations": 32, + "Nanoseconds": 19995000 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 17, + "Operations": 64, + "Nanoseconds": 40188000 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 18, + "Operations": 128, + "Nanoseconds": 74045000 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 19, + "Operations": 256, + "Nanoseconds": 146500400 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 20, + "Operations": 512, + "Nanoseconds": 305057600 + }, + { + "IterationMode": "Workload", + "IterationStage": "Pilot", + "LaunchIndex": 1, + "IterationIndex": 21, + "Operations": 1024, + "Nanoseconds": 590308900 + }, + { + "IterationMode": "Workload", + "IterationStage": "Warmup", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1024, + "Nanoseconds": 476135100 + }, + { + "IterationMode": "Workload", + "IterationStage": "Warmup", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 1024, + "Nanoseconds": 190273500 + }, + { + "IterationMode": "Workload", + "IterationStage": "Warmup", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 1024, + "Nanoseconds": 170380100 + }, + { + "IterationMode": "Workload", + "IterationStage": "Actual", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1024, + "Nanoseconds": 168639300 + }, + { + "IterationMode": "Workload", + "IterationStage": "Actual", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 1024, + "Nanoseconds": 168441900 + }, + { + "IterationMode": "Workload", + "IterationStage": "Actual", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 1024, + "Nanoseconds": 172799000 + }, + { + "IterationMode": "Workload", + "IterationStage": "Result", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1024, + "Nanoseconds": 168639300 + }, + { + "IterationMode": "Workload", + "IterationStage": "Result", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 1024, + "Nanoseconds": 168441900 + }, + { + "IterationMode": "Workload", + "IterationStage": "Result", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 1024, + "Nanoseconds": 172799000 + } + ], + "Metrics": [ + { + "Value": 39.0625, + "Descriptor": { + "Id": "Gen0Collects", + "DisplayName": "Gen0", + "Legend": "GC Generation 0 collects per 1000 operations", + "NumberFormat": "#0.0000", + "UnitType": 0, + "Unit": "Count", + "TheGreaterTheBetter": false, + "PriorityInCategory": 0 + } + }, + { + "Value": 8.7890625, + "Descriptor": { + "Id": "Gen1Collects", + "DisplayName": "Gen1", + "Legend": "GC Generation 1 collects per 1000 operations", + "NumberFormat": "#0.0000", + "UnitType": 0, + "Unit": "Count", + "TheGreaterTheBetter": false, + "PriorityInCategory": 1 + } + }, + { + "Value": 0, + "Descriptor": { + "Id": "Gen2Collects", + "DisplayName": "Gen2", + "Legend": "GC Generation 2 collects per 1000 operations", + "NumberFormat": "#0.0000", + "UnitType": 0, + "Unit": "Count", + "TheGreaterTheBetter": false, + "PriorityInCategory": 2 + } + }, + { + "Value": 254585, + "Descriptor": { + "Id": "Allocated Memory", + "DisplayName": "Allocated", + "Legend": "Allocated memory per single operation (managed only, inclusive, 1KB = 1024B)", + "NumberFormat": "0.##", + "UnitType": 2, + "Unit": "B", + "TheGreaterTheBetter": false, + "PriorityInCategory": 3 + } + } + ] + }, + { + "DisplayInfo": "Descriptions.GHESYaml: ShortRun(IterationCount=3, LaunchCount=1, WarmupCount=3)", + "Namespace": "performance", + "Type": "Descriptions", + "Method": "GHESYaml", + "MethodTitle": "GHESYaml", + "Parameters": "", + "FullName": "performance.Descriptions.GHESYaml", + "HardwareIntrinsics": "AVX-512F+CD+BW+DQ+VL+VBMI,AES,BMI1,BMI2,FMA,LZCNT,PCLMUL,POPCNT VectorSize=256", + "Statistics": { + "OriginalValues": [ 945590600, 929477300, 871151200 ], + "N": 3, + "Min": 871151200, + "LowerFence": 844484700, + "Q1": 900314250, + "Median": 929477300, + "Mean": 915406366.6666666, + "Q3": 937533950, + "UpperFence": 993363500, + "Max": 945590600, + "InterquartileRange": 37219700, + "LowerOutliers": [], + "UpperOutliers": [], + "AllOutliers": [], + "StandardError": 22611202.546107784, + "Variance": 1533799441743333.5, + "StandardDeviation": 39163751.63008944, + "Skewness": -0.3129062028807021, + "Kurtosis": 0.6666666666666653, + "ConfidenceInterval": { + "N": 3, + "Mean": 915406366.6666666, + "StandardError": 22611202.546107784, + "Level": 12, + "Margin": 714492620.4021431, + "Lower": 200913746.2645235, + "Upper": 1629898987.0688097 + }, + "Percentiles": { + "P0": 871151200, + "P25": 900314250, + "P50": 929477300, + "P67": 934955822, + "P80": 939145280, + "P85": 940756610, + "P90": 942367940, + "P95": 943979270, + "P100": 945590600 + } + }, + "Memory": { + "Gen0Collections": 68, + "Gen1Collections": 22, + "Gen2Collections": 4, + "TotalOperations": 1, + "BytesAllocatedPerOperation": 409271848 + }, + "Measurements": [ + { + "IterationMode": "Overhead", + "IterationStage": "Jitting", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 238300 + }, + { + "IterationMode": "Workload", + "IterationStage": "Jitting", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 1805606300 + }, + { + "IterationMode": "Overhead", + "IterationStage": "Jitting", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 1, + "Nanoseconds": 600 + }, + { + "IterationMode": "Workload", + "IterationStage": "Jitting", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 1, + "Nanoseconds": 1068747500 + }, + { + "IterationMode": "Workload", + "IterationStage": "Warmup", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 998100500 + }, + { + "IterationMode": "Workload", + "IterationStage": "Warmup", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 1, + "Nanoseconds": 922151200 + }, + { + "IterationMode": "Workload", + "IterationStage": "Warmup", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 1, + "Nanoseconds": 915421700 + }, + { + "IterationMode": "Workload", + "IterationStage": "Actual", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 945590600 + }, + { + "IterationMode": "Workload", + "IterationStage": "Actual", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 1, + "Nanoseconds": 929477300 + }, + { + "IterationMode": "Workload", + "IterationStage": "Actual", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 1, + "Nanoseconds": 871151200 + }, + { + "IterationMode": "Workload", + "IterationStage": "Result", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 945590600 + }, + { + "IterationMode": "Workload", + "IterationStage": "Result", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 1, + "Nanoseconds": 929477300 + }, + { + "IterationMode": "Workload", + "IterationStage": "Result", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 1, + "Nanoseconds": 871151200 + } + ], + "Metrics": [ + { + "Value": 68000, + "Descriptor": { + "Id": "Gen0Collects", + "DisplayName": "Gen0", + "Legend": "GC Generation 0 collects per 1000 operations", + "NumberFormat": "#0.0000", + "UnitType": 0, + "Unit": "Count", + "TheGreaterTheBetter": false, + "PriorityInCategory": 0 + } + }, + { + "Value": 22000, + "Descriptor": { + "Id": "Gen1Collects", + "DisplayName": "Gen1", + "Legend": "GC Generation 1 collects per 1000 operations", + "NumberFormat": "#0.0000", + "UnitType": 0, + "Unit": "Count", + "TheGreaterTheBetter": false, + "PriorityInCategory": 1 + } + }, + { + "Value": 4000, + "Descriptor": { + "Id": "Gen2Collects", + "DisplayName": "Gen2", + "Legend": "GC Generation 2 collects per 1000 operations", + "NumberFormat": "#0.0000", + "UnitType": 0, + "Unit": "Count", + "TheGreaterTheBetter": false, + "PriorityInCategory": 2 + } + }, + { + "Value": 409271848, + "Descriptor": { + "Id": "Allocated Memory", + "DisplayName": "Allocated", + "Legend": "Allocated memory per single operation (managed only, inclusive, 1KB = 1024B)", + "NumberFormat": "0.##", + "UnitType": 2, + "Unit": "B", + "TheGreaterTheBetter": false, + "PriorityInCategory": 3 + } + } + ] + }, + { + "DisplayInfo": "Descriptions.GHESJson: ShortRun(IterationCount=3, LaunchCount=1, WarmupCount=3)", + "Namespace": "performance", + "Type": "Descriptions", + "Method": "GHESJson", + "MethodTitle": "GHESJson", + "Parameters": "", + "FullName": "performance.Descriptions.GHESJson", + "HardwareIntrinsics": "AVX-512F+CD+BW+DQ+VL+VBMI,AES,BMI1,BMI2,FMA,LZCNT,PCLMUL,POPCNT VectorSize=256", + "Statistics": { + "OriginalValues": [ 486026300, 468580000, 457221900 ], + "N": 3, + "Min": 457221900, + "LowerFence": 441297650, + "Q1": 462900950, + "Median": 468580000, + "Mean": 470609400, + "Q3": 477303150, + "UpperFence": 498906450, + "Max": 486026300, + "InterquartileRange": 14402200, + "LowerOutliers": [], + "UpperOutliers": [], + "AllOutliers": [], + "StandardError": 8376797.580420177, + "Variance": 210512213110000, + "StandardDeviation": 14509039.014007784, + "Skewness": 0.13713498071671384, + "Kurtosis": 0.6666666666666666, + "ConfidenceInterval": { + "N": 3, + "Mean": 470609400, + "StandardError": 8376797.580420177, + "Level": 12, + "Margin": 264698882.84836096, + "Lower": 205910517.15163904, + "Upper": 735308282.848361 + }, + "Percentiles": { + "P0": 457221900, + "P25": 462900950, + "P50": 468580000, + "P67": 474511742, + "P80": 479047780, + "P85": 480792410, + "P90": 482537040, + "P95": 484281670, + "P100": 486026300 + } + }, + "Memory": { + "Gen0Collections": 42, + "Gen1Collections": 15, + "Gen2Collections": 3, + "TotalOperations": 1, + "BytesAllocatedPerOperation": 267416792 + }, + "Measurements": [ + { + "IterationMode": "Overhead", + "IterationStage": "Jitting", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 609500 + }, + { + "IterationMode": "Workload", + "IterationStage": "Jitting", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 1017050000 + }, + { + "IterationMode": "Overhead", + "IterationStage": "Jitting", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 1, + "Nanoseconds": 600 + }, + { + "IterationMode": "Workload", + "IterationStage": "Jitting", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 1, + "Nanoseconds": 836928600 + }, + { + "IterationMode": "Workload", + "IterationStage": "Warmup", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 626599200 + }, + { + "IterationMode": "Workload", + "IterationStage": "Warmup", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 1, + "Nanoseconds": 501412100 + }, + { + "IterationMode": "Workload", + "IterationStage": "Warmup", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 1, + "Nanoseconds": 495906300 + }, + { + "IterationMode": "Workload", + "IterationStage": "Actual", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 486026300 + }, + { + "IterationMode": "Workload", + "IterationStage": "Actual", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 1, + "Nanoseconds": 468580000 + }, + { + "IterationMode": "Workload", + "IterationStage": "Actual", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 1, + "Nanoseconds": 457221900 + }, + { + "IterationMode": "Workload", + "IterationStage": "Result", + "LaunchIndex": 1, + "IterationIndex": 1, + "Operations": 1, + "Nanoseconds": 486026300 + }, + { + "IterationMode": "Workload", + "IterationStage": "Result", + "LaunchIndex": 1, + "IterationIndex": 2, + "Operations": 1, + "Nanoseconds": 468580000 + }, + { + "IterationMode": "Workload", + "IterationStage": "Result", + "LaunchIndex": 1, + "IterationIndex": 3, + "Operations": 1, + "Nanoseconds": 457221900 + } + ], + "Metrics": [ + { + "Value": 42000, + "Descriptor": { + "Id": "Gen0Collects", + "DisplayName": "Gen0", + "Legend": "GC Generation 0 collects per 1000 operations", + "NumberFormat": "#0.0000", + "UnitType": 0, + "Unit": "Count", + "TheGreaterTheBetter": false, + "PriorityInCategory": 0 + } + }, + { + "Value": 15000, + "Descriptor": { + "Id": "Gen1Collects", + "DisplayName": "Gen1", + "Legend": "GC Generation 1 collects per 1000 operations", + "NumberFormat": "#0.0000", + "UnitType": 0, + "Unit": "Count", + "TheGreaterTheBetter": false, + "PriorityInCategory": 1 + } + }, + { + "Value": 3000, + "Descriptor": { + "Id": "Gen2Collects", + "DisplayName": "Gen2", + "Legend": "GC Generation 2 collects per 1000 operations", + "NumberFormat": "#0.0000", + "UnitType": 0, + "Unit": "Count", + "TheGreaterTheBetter": false, + "PriorityInCategory": 2 + } + }, + { + "Value": 267416792, + "Descriptor": { + "Id": "Allocated Memory", + "DisplayName": "Allocated", + "Legend": "Allocated memory per single operation (managed only, inclusive, 1KB = 1024B)", + "NumberFormat": "0.##", + "UnitType": 2, + "Unit": "B", + "TheGreaterTheBetter": false, + "PriorityInCategory": 3 + } + } + ] + } + ] +} From 90edf8e7662468fd4ad23e1b884ab76fed5d2a23 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Wed, 28 May 2025 15:30:09 +0300 Subject: [PATCH 11/12] chore: resolve merge conflicts --- .../Extensions/CollectionExtensions.cs | 2 +- .../Extensions/OpenApiExtensibleExtensions.cs | 1 + .../Reader/V2/OpenApiOperationDeserializer.cs | 1 - .../Services/CopyReferences.cs | 2 + .../Writers/OpenApiWriterSettings.cs | 4 +- .../TryLoadReferenceV2Tests.cs | 1 + .../V2Tests/OpenApiDocumentTests.cs | 1 + .../Extensions/CollectionExtensionsTests.cs | 5 - .../Models/OpenApiRequestBodyTests.cs | 1 + .../Models/OpenApiTagTests.cs | 1 + .../PublicApi/PublicApi.approved.txt | 353 +++++++++--------- 11 files changed, 191 insertions(+), 181 deletions(-) diff --git a/src/Microsoft.OpenApi/Extensions/CollectionExtensions.cs b/src/Microsoft.OpenApi/Extensions/CollectionExtensions.cs index 982b76cb5..60c6f4f95 100644 --- a/src/Microsoft.OpenApi/Extensions/CollectionExtensions.cs +++ b/src/Microsoft.OpenApi/Extensions/CollectionExtensions.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; -namespace Microsoft.OpenApi.Extensions +namespace Microsoft.OpenApi { /// /// Dictionary extension methods diff --git a/src/Microsoft.OpenApi/Extensions/OpenApiExtensibleExtensions.cs b/src/Microsoft.OpenApi/Extensions/OpenApiExtensibleExtensions.cs index fc7c0ac4e..266e36020 100644 --- a/src/Microsoft.OpenApi/Extensions/OpenApiExtensibleExtensions.cs +++ b/src/Microsoft.OpenApi/Extensions/OpenApiExtensibleExtensions.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. using System; +using System.Collections.Generic; namespace Microsoft.OpenApi { diff --git a/src/Microsoft.OpenApi/Reader/V2/OpenApiOperationDeserializer.cs b/src/Microsoft.OpenApi/Reader/V2/OpenApiOperationDeserializer.cs index c01a57c85..4adf036ba 100644 --- a/src/Microsoft.OpenApi/Reader/V2/OpenApiOperationDeserializer.cs +++ b/src/Microsoft.OpenApi/Reader/V2/OpenApiOperationDeserializer.cs @@ -5,7 +5,6 @@ using System.Linq; using System; using System.Text.Json.Nodes; -using Microsoft.OpenApi.Interfaces; namespace Microsoft.OpenApi.Reader.V2 { diff --git a/src/Microsoft.OpenApi/Services/CopyReferences.cs b/src/Microsoft.OpenApi/Services/CopyReferences.cs index b08a5f234..ab740e509 100644 --- a/src/Microsoft.OpenApi/Services/CopyReferences.cs +++ b/src/Microsoft.OpenApi/Services/CopyReferences.cs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. +using System.Collections.Generic; + namespace Microsoft.OpenApi; internal class CopyReferences(OpenApiDocument target) : OpenApiVisitorBase { diff --git a/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs b/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs index 35404ba82..bcaef6e1d 100644 --- a/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs +++ b/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs @@ -1,4 +1,6 @@ -namespace Microsoft.OpenApi +using System.Collections.Generic; + +namespace Microsoft.OpenApi { /// /// Configuration settings to control how OpenAPI documents are written diff --git a/test/Microsoft.OpenApi.Readers.Tests/ReferenceService/TryLoadReferenceV2Tests.cs b/test/Microsoft.OpenApi.Readers.Tests/ReferenceService/TryLoadReferenceV2Tests.cs index aed44a1c5..b20f72e9a 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/ReferenceService/TryLoadReferenceV2Tests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/ReferenceService/TryLoadReferenceV2Tests.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. +using System.Collections.Generic; using System.IO; using System.Threading.Tasks; using Xunit; diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs index d57b4e2ee..5845e4bbf 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. using System; +using System.Collections.Generic; using System.IO; using System.Net.Http; using System.Threading; diff --git a/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.cs b/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.cs index fb803c34e..7c5f49f1e 100644 --- a/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.cs +++ b/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.cs @@ -4,11 +4,6 @@ using System.IO; using System.Net.Http; using System.Threading.Tasks; -using Microsoft.OpenApi.Extensions; -using Microsoft.OpenApi.Models; -using Microsoft.OpenApi.Models.Interfaces; -using Microsoft.OpenApi.Models.References; -using Microsoft.OpenApi.Writers; using VerifyXunit; using Xunit; diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.cs index 65e1a14bf..5da25b013 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. +using System.Collections.Generic; using System.Globalization; using System.IO; using System.Threading.Tasks; diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.cs index a5d02b431..2110e473b 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. +using System.Collections.Generic; using System.Globalization; using System.IO; using System.Threading.Tasks; diff --git a/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt b/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt index 2672bf812..be3ae75cf 100644 --- a/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt +++ b/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt @@ -29,6 +29,12 @@ namespace Microsoft.OpenApi public override string Expression { get; } public string? Fragment { get; } } + public static class CollectionExtensions + { + public static System.Collections.Generic.List Sort(this System.Collections.Generic.IEnumerable source, System.Collections.Generic.IComparer comparer) { } + public static System.Collections.Generic.IDictionary Sort(this System.Collections.Generic.IDictionary source, System.Collections.Generic.IComparer comparer) + where TKey : notnull { } + } public class CompositeExpression : Microsoft.OpenApi.RuntimeExpression { public System.Collections.Generic.List ContainedExpressions; @@ -78,7 +84,7 @@ namespace Microsoft.OpenApi public interface IDiagnostic { } public interface IMetadataContainer { - System.Collections.Generic.Dictionary? Metadata { get; set; } + System.Collections.Generic.IDictionary? Metadata { get; set; } } public interface IOpenApiCallback : Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.IOpenApiReferenceable, Microsoft.OpenApi.IOpenApiSerializable, Microsoft.OpenApi.IShallowCopyable { @@ -96,7 +102,7 @@ namespace Microsoft.OpenApi } public interface IOpenApiExtensible : Microsoft.OpenApi.IOpenApiElement { - System.Collections.Generic.Dictionary? Extensions { get; set; } + System.Collections.Generic.IDictionary? Extensions { get; set; } } public interface IOpenApiExtension { @@ -106,10 +112,10 @@ namespace Microsoft.OpenApi { bool AllowEmptyValue { get; } bool AllowReserved { get; } - System.Collections.Generic.Dictionary? Content { get; } + System.Collections.Generic.IDictionary? Content { get; } bool Deprecated { get; } System.Text.Json.Nodes.JsonNode? Example { get; } - System.Collections.Generic.Dictionary? Examples { get; } + System.Collections.Generic.IDictionary? Examples { get; } bool Explode { get; } bool Required { get; } Microsoft.OpenApi.IOpenApiSchema? Schema { get; } @@ -119,7 +125,7 @@ namespace Microsoft.OpenApi { string? OperationId { get; } string? OperationRef { get; } - System.Collections.Generic.Dictionary? Parameters { get; } + System.Collections.Generic.IDictionary? Parameters { get; } Microsoft.OpenApi.RuntimeExpressionAnyWrapper? RequestBody { get; } Microsoft.OpenApi.OpenApiServer? Server { get; } } @@ -127,10 +133,10 @@ namespace Microsoft.OpenApi { bool AllowEmptyValue { get; } bool AllowReserved { get; } - System.Collections.Generic.Dictionary? Content { get; } + System.Collections.Generic.IDictionary? Content { get; } bool Deprecated { get; } System.Text.Json.Nodes.JsonNode? Example { get; } - System.Collections.Generic.Dictionary? Examples { get; } + System.Collections.Generic.IDictionary? Examples { get; } bool Explode { get; } Microsoft.OpenApi.ParameterLocation? In { get; } string? Name { get; } @@ -141,8 +147,8 @@ namespace Microsoft.OpenApi public interface IOpenApiPathItem : Microsoft.OpenApi.IOpenApiDescribedElement, Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.IOpenApiReferenceable, Microsoft.OpenApi.IOpenApiSerializable, Microsoft.OpenApi.IOpenApiSummarizedElement, Microsoft.OpenApi.IShallowCopyable { System.Collections.Generic.Dictionary? Operations { get; } - System.Collections.Generic.List? Parameters { get; } - System.Collections.Generic.List? Servers { get; } + System.Collections.Generic.IList? Parameters { get; } + System.Collections.Generic.IList? Servers { get; } } public interface IOpenApiReadOnlyDescribedElement : Microsoft.OpenApi.IOpenApiElement { @@ -150,7 +156,7 @@ namespace Microsoft.OpenApi } public interface IOpenApiReadOnlyExtensible { - System.Collections.Generic.Dictionary? Extensions { get; } + System.Collections.Generic.IDictionary? Extensions { get; } } public interface IOpenApiReader { @@ -174,35 +180,35 @@ namespace Microsoft.OpenApi public interface IOpenApiReferenceable : Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiSerializable { } public interface IOpenApiRequestBody : Microsoft.OpenApi.IOpenApiDescribedElement, Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.IOpenApiReferenceable, Microsoft.OpenApi.IOpenApiSerializable, Microsoft.OpenApi.IShallowCopyable { - System.Collections.Generic.Dictionary? Content { get; } + System.Collections.Generic.IDictionary? Content { get; } bool Required { get; } Microsoft.OpenApi.IOpenApiParameter? ConvertToBodyParameter(Microsoft.OpenApi.IOpenApiWriter writer); System.Collections.Generic.IEnumerable? ConvertToFormDataParameters(Microsoft.OpenApi.IOpenApiWriter writer); } public interface IOpenApiResponse : Microsoft.OpenApi.IOpenApiDescribedElement, Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.IOpenApiReferenceable, Microsoft.OpenApi.IOpenApiSerializable, Microsoft.OpenApi.IShallowCopyable { - System.Collections.Generic.Dictionary? Content { get; } - System.Collections.Generic.Dictionary? Headers { get; } - System.Collections.Generic.Dictionary? Links { get; } + System.Collections.Generic.IDictionary? Content { get; } + System.Collections.Generic.IDictionary? Headers { get; } + System.Collections.Generic.IDictionary? Links { get; } } public interface IOpenApiSchema : Microsoft.OpenApi.IOpenApiDescribedElement, Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.IOpenApiReferenceable, Microsoft.OpenApi.IOpenApiSerializable, Microsoft.OpenApi.IShallowCopyable { Microsoft.OpenApi.IOpenApiSchema? AdditionalProperties { get; } bool AdditionalPropertiesAllowed { get; } - System.Collections.Generic.List? AllOf { get; } - System.Collections.Generic.List? AnyOf { get; } + System.Collections.Generic.IList? AllOf { get; } + System.Collections.Generic.IList? AnyOf { get; } string? Comment { get; } string? Const { get; } System.Text.Json.Nodes.JsonNode? Default { get; } - System.Collections.Generic.Dictionary? Definitions { get; } - System.Collections.Generic.Dictionary>? DependentRequired { get; } + System.Collections.Generic.IDictionary? Definitions { get; } + System.Collections.Generic.IDictionary>? DependentRequired { get; } bool Deprecated { get; } Microsoft.OpenApi.OpenApiDiscriminator? Discriminator { get; } string? DynamicAnchor { get; } string? DynamicRef { get; } - System.Collections.Generic.List? Enum { get; } + System.Collections.Generic.IList? Enum { get; } System.Text.Json.Nodes.JsonNode? Example { get; } - System.Collections.Generic.List? Examples { get; } + System.Collections.Generic.IList? Examples { get; } string? ExclusiveMaximum { get; } string? ExclusiveMinimum { get; } Microsoft.OpenApi.OpenApiExternalDocs? ExternalDocs { get; } @@ -219,19 +225,19 @@ namespace Microsoft.OpenApi string? Minimum { get; } decimal? MultipleOf { get; } Microsoft.OpenApi.IOpenApiSchema? Not { get; } - System.Collections.Generic.List? OneOf { get; } + System.Collections.Generic.IList? OneOf { get; } string? Pattern { get; } - System.Collections.Generic.Dictionary? PatternProperties { get; } - System.Collections.Generic.Dictionary? Properties { get; } + System.Collections.Generic.IDictionary? PatternProperties { get; } + System.Collections.Generic.IDictionary? Properties { get; } bool ReadOnly { get; } - System.Collections.Generic.HashSet? Required { get; } + System.Collections.Generic.ISet? Required { get; } System.Uri? Schema { get; } string? Title { get; } Microsoft.OpenApi.JsonSchemaType? Type { get; } bool UnevaluatedProperties { get; } bool? UniqueItems { get; } - System.Collections.Generic.Dictionary? UnrecognizedKeywords { get; } - System.Collections.Generic.Dictionary? Vocabulary { get; } + System.Collections.Generic.IDictionary? UnrecognizedKeywords { get; } + System.Collections.Generic.IDictionary? Vocabulary { get; } bool WriteOnly { get; } Microsoft.OpenApi.OpenApiXml? Xml { get; } } @@ -338,7 +344,7 @@ namespace Microsoft.OpenApi public class OpenApiCallback : Microsoft.OpenApi.IOpenApiCallback, Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiExtensible, Microsoft.OpenApi.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.IOpenApiReferenceable, Microsoft.OpenApi.IOpenApiSerializable, Microsoft.OpenApi.IShallowCopyable { public OpenApiCallback() { } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public System.Collections.Generic.Dictionary? PathItems { get; set; } public void AddPathItem(Microsoft.OpenApi.RuntimeExpression expression, Microsoft.OpenApi.IOpenApiPathItem pathItem) { } public Microsoft.OpenApi.IOpenApiCallback CreateShallowCopy() { } @@ -349,7 +355,7 @@ namespace Microsoft.OpenApi public class OpenApiCallbackReference : Microsoft.OpenApi.BaseOpenApiReferenceHolder, Microsoft.OpenApi.IOpenApiCallback, Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.IOpenApiReferenceable, Microsoft.OpenApi.IOpenApiSerializable, Microsoft.OpenApi.IShallowCopyable { public OpenApiCallbackReference(string referenceId, Microsoft.OpenApi.OpenApiDocument? hostDocument = null, string? externalResource = null) { } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public System.Collections.Generic.Dictionary? PathItems { get; } public override Microsoft.OpenApi.IOpenApiCallback CopyReferenceAsTargetElementWithOverrides(Microsoft.OpenApi.IOpenApiCallback source) { } public Microsoft.OpenApi.IOpenApiCallback CreateShallowCopy() { } @@ -359,17 +365,17 @@ namespace Microsoft.OpenApi { public OpenApiComponents() { } public OpenApiComponents(Microsoft.OpenApi.OpenApiComponents? components) { } - public System.Collections.Generic.Dictionary? Callbacks { get; set; } - public System.Collections.Generic.Dictionary? Examples { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } - public System.Collections.Generic.Dictionary? Headers { get; set; } - public System.Collections.Generic.Dictionary? Links { get; set; } - public System.Collections.Generic.Dictionary? Parameters { get; set; } - public System.Collections.Generic.Dictionary? PathItems { get; set; } - public System.Collections.Generic.Dictionary? RequestBodies { get; set; } - public System.Collections.Generic.Dictionary? Responses { get; set; } - public System.Collections.Generic.Dictionary? Schemas { get; set; } - public System.Collections.Generic.Dictionary? SecuritySchemes { get; set; } + public System.Collections.Generic.IDictionary? Callbacks { get; set; } + public System.Collections.Generic.IDictionary? Examples { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Headers { get; set; } + public System.Collections.Generic.IDictionary? Links { get; set; } + public System.Collections.Generic.IDictionary? Parameters { get; set; } + public System.Collections.Generic.IDictionary? PathItems { get; set; } + public System.Collections.Generic.IDictionary? RequestBodies { get; set; } + public System.Collections.Generic.IDictionary? Responses { get; set; } + public System.Collections.Generic.IDictionary? Schemas { get; set; } + public System.Collections.Generic.IDictionary? SecuritySchemes { get; set; } public virtual void SerializeAsV2(Microsoft.OpenApi.IOpenApiWriter writer) { } public virtual void SerializeAsV3(Microsoft.OpenApi.IOpenApiWriter writer) { } public virtual void SerializeAsV31(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -542,7 +548,7 @@ namespace Microsoft.OpenApi public OpenApiContact() { } public OpenApiContact(Microsoft.OpenApi.OpenApiContact contact) { } public string? Email { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public string? Name { get; set; } public System.Uri? Url { get; set; } public virtual void SerializeAsV2(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -558,8 +564,8 @@ namespace Microsoft.OpenApi { public OpenApiDiscriminator() { } public OpenApiDiscriminator(Microsoft.OpenApi.OpenApiDiscriminator discriminator) { } - public System.Collections.Generic.Dictionary? Extensions { get; set; } - public System.Collections.Generic.Dictionary? Mapping { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Mapping { get; set; } public string? PropertyName { get; set; } public void SerializeAsV2(Microsoft.OpenApi.IOpenApiWriter writer) { } public void SerializeAsV3(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -571,16 +577,16 @@ namespace Microsoft.OpenApi public OpenApiDocument(Microsoft.OpenApi.OpenApiDocument? document) { } public System.Uri BaseUri { get; } public Microsoft.OpenApi.OpenApiComponents? Components { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public Microsoft.OpenApi.OpenApiExternalDocs? ExternalDocs { get; set; } public Microsoft.OpenApi.OpenApiInfo Info { get; set; } public System.Uri? JsonSchemaDialect { get; set; } - public System.Collections.Generic.Dictionary? Metadata { get; set; } + public System.Collections.Generic.IDictionary? Metadata { get; set; } public Microsoft.OpenApi.OpenApiPaths Paths { get; set; } - public System.Collections.Generic.List? Security { get; set; } - public System.Collections.Generic.List? Servers { get; set; } - public System.Collections.Generic.HashSet? Tags { get; set; } - public System.Collections.Generic.Dictionary? Webhooks { get; set; } + public System.Collections.Generic.IList? Security { get; set; } + public System.Collections.Generic.IList? Servers { get; set; } + public System.Collections.Generic.ISet? Tags { get; set; } + public System.Collections.Generic.IDictionary? Webhooks { get; set; } public Microsoft.OpenApi.OpenApiWorkspace? Workspace { get; set; } public bool AddComponent(string id, T componentToRegister) { } public System.Threading.Tasks.Task GetHashCodeAsync(System.Threading.CancellationToken cancellationToken = default) { } @@ -611,8 +617,8 @@ namespace Microsoft.OpenApi public bool? AllowReserved { get; set; } public string? ContentType { get; set; } public bool? Explode { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } - public System.Collections.Generic.Dictionary? Headers { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Headers { get; set; } public Microsoft.OpenApi.ParameterStyle? Style { get; set; } public virtual void SerializeAsV2(Microsoft.OpenApi.IOpenApiWriter writer) { } public virtual void SerializeAsV3(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -631,7 +637,7 @@ namespace Microsoft.OpenApi { public OpenApiExample() { } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public string? ExternalValue { get; set; } public string? Summary { get; set; } public System.Text.Json.Nodes.JsonNode? Value { get; set; } @@ -644,7 +650,7 @@ namespace Microsoft.OpenApi { public OpenApiExampleReference(string referenceId, Microsoft.OpenApi.OpenApiDocument? hostDocument = null, string? externalResource = null) { } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public string? ExternalValue { get; } public string? Summary { get; set; } public System.Text.Json.Nodes.JsonNode? Value { get; } @@ -664,7 +670,7 @@ namespace Microsoft.OpenApi { protected OpenApiExtensibleDictionary() { } protected OpenApiExtensibleDictionary(System.Collections.Generic.Dictionary dictionary, System.Collections.Generic.Dictionary? extensions = null) { } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public void SerializeAsV2(Microsoft.OpenApi.IOpenApiWriter writer) { } public void SerializeAsV3(Microsoft.OpenApi.IOpenApiWriter writer) { } public void SerializeAsV31(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -684,7 +690,7 @@ namespace Microsoft.OpenApi public OpenApiExternalDocs() { } public OpenApiExternalDocs(Microsoft.OpenApi.OpenApiExternalDocs externalDocs) { } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public System.Uri? Url { get; set; } public virtual void SerializeAsV2(Microsoft.OpenApi.IOpenApiWriter writer) { } public virtual void SerializeAsV3(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -706,13 +712,13 @@ namespace Microsoft.OpenApi public OpenApiHeader() { } public bool AllowEmptyValue { get; set; } public bool AllowReserved { get; set; } - public System.Collections.Generic.Dictionary? Content { get; set; } + public System.Collections.Generic.IDictionary? Content { get; set; } public bool Deprecated { get; set; } public string? Description { get; set; } public System.Text.Json.Nodes.JsonNode? Example { get; set; } - public System.Collections.Generic.Dictionary? Examples { get; set; } + public System.Collections.Generic.IDictionary? Examples { get; set; } public bool Explode { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public bool Required { get; set; } public Microsoft.OpenApi.IOpenApiSchema? Schema { get; set; } public Microsoft.OpenApi.ParameterStyle? Style { get; set; } @@ -726,13 +732,13 @@ namespace Microsoft.OpenApi public OpenApiHeaderReference(string referenceId, Microsoft.OpenApi.OpenApiDocument? hostDocument = null, string? externalResource = null) { } public bool AllowEmptyValue { get; } public bool AllowReserved { get; } - public System.Collections.Generic.Dictionary? Content { get; } + public System.Collections.Generic.IDictionary? Content { get; } public bool Deprecated { get; } public string? Description { get; set; } public System.Text.Json.Nodes.JsonNode? Example { get; } - public System.Collections.Generic.Dictionary? Examples { get; } + public System.Collections.Generic.IDictionary? Examples { get; } public bool Explode { get; } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public bool Required { get; } public Microsoft.OpenApi.IOpenApiSchema? Schema { get; } public Microsoft.OpenApi.ParameterStyle? Style { get; } @@ -745,7 +751,7 @@ namespace Microsoft.OpenApi public OpenApiInfo(Microsoft.OpenApi.OpenApiInfo info) { } public Microsoft.OpenApi.OpenApiContact? Contact { get; set; } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public Microsoft.OpenApi.OpenApiLicense? License { get; set; } public string? Summary { get; set; } public System.Uri? TermsOfService { get; set; } @@ -786,7 +792,7 @@ namespace Microsoft.OpenApi { public OpenApiLicense() { } public OpenApiLicense(Microsoft.OpenApi.OpenApiLicense license) { } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public string? Identifier { get; set; } public string? Name { get; set; } public System.Uri? Url { get; set; } @@ -803,10 +809,10 @@ namespace Microsoft.OpenApi { public OpenApiLink() { } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public string? OperationId { get; set; } public string? OperationRef { get; set; } - public System.Collections.Generic.Dictionary? Parameters { get; set; } + public System.Collections.Generic.IDictionary? Parameters { get; set; } public Microsoft.OpenApi.RuntimeExpressionAnyWrapper? RequestBody { get; set; } public Microsoft.OpenApi.OpenApiServer? Server { get; set; } public Microsoft.OpenApi.IOpenApiLink CreateShallowCopy() { } @@ -818,10 +824,10 @@ namespace Microsoft.OpenApi { public OpenApiLinkReference(string referenceId, Microsoft.OpenApi.OpenApiDocument? hostDocument = null, string? externalResource = null) { } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public string? OperationId { get; } public string? OperationRef { get; } - public System.Collections.Generic.Dictionary? Parameters { get; } + public System.Collections.Generic.IDictionary? Parameters { get; } public Microsoft.OpenApi.RuntimeExpressionAnyWrapper? RequestBody { get; } public Microsoft.OpenApi.OpenApiServer? Server { get; } public override Microsoft.OpenApi.IOpenApiLink CopyReferenceAsTargetElementWithOverrides(Microsoft.OpenApi.IOpenApiLink source) { } @@ -832,10 +838,10 @@ namespace Microsoft.OpenApi { public OpenApiMediaType() { } public OpenApiMediaType(Microsoft.OpenApi.OpenApiMediaType? mediaType) { } - public System.Collections.Generic.Dictionary? Encoding { get; set; } + public System.Collections.Generic.IDictionary? Encoding { get; set; } public System.Text.Json.Nodes.JsonNode? Example { get; set; } - public System.Collections.Generic.Dictionary? Examples { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Examples { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public Microsoft.OpenApi.IOpenApiSchema? Schema { get; set; } public virtual void SerializeAsV2(Microsoft.OpenApi.IOpenApiWriter writer) { } public virtual void SerializeAsV3(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -853,7 +859,7 @@ namespace Microsoft.OpenApi public OpenApiOAuthFlow() { } public OpenApiOAuthFlow(Microsoft.OpenApi.OpenApiOAuthFlow oAuthFlow) { } public System.Uri? AuthorizationUrl { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public System.Uri? RefreshUrl { get; set; } public System.Collections.Generic.IDictionary? Scopes { get; set; } public System.Uri? TokenUrl { get; set; } @@ -872,7 +878,7 @@ namespace Microsoft.OpenApi public OpenApiOAuthFlows(Microsoft.OpenApi.OpenApiOAuthFlows oAuthFlows) { } public Microsoft.OpenApi.OpenApiOAuthFlow? AuthorizationCode { get; set; } public Microsoft.OpenApi.OpenApiOAuthFlow? ClientCredentials { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public Microsoft.OpenApi.OpenApiOAuthFlow? Implicit { get; set; } public Microsoft.OpenApi.OpenApiOAuthFlow? Password { get; set; } public virtual void SerializeAsV2(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -884,20 +890,20 @@ namespace Microsoft.OpenApi public const bool DeprecatedDefault = false; public OpenApiOperation() { } public OpenApiOperation(Microsoft.OpenApi.OpenApiOperation operation) { } - public System.Collections.Generic.Dictionary? Callbacks { get; set; } + public System.Collections.Generic.IDictionary? Callbacks { get; set; } public bool Deprecated { get; set; } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public Microsoft.OpenApi.OpenApiExternalDocs? ExternalDocs { get; set; } - public System.Collections.Generic.Dictionary? Metadata { get; set; } + public System.Collections.Generic.IDictionary? Metadata { get; set; } public string? OperationId { get; set; } - public System.Collections.Generic.List? Parameters { get; set; } + public System.Collections.Generic.IList? Parameters { get; set; } public Microsoft.OpenApi.IOpenApiRequestBody? RequestBody { get; set; } public Microsoft.OpenApi.OpenApiResponses? Responses { get; set; } - public System.Collections.Generic.List? Security { get; set; } - public System.Collections.Generic.List? Servers { get; set; } + public System.Collections.Generic.IList? Security { get; set; } + public System.Collections.Generic.IList? Servers { get; set; } public string? Summary { get; set; } - public System.Collections.Generic.HashSet? Tags { get; set; } + public System.Collections.Generic.ISet? Tags { get; set; } public virtual void SerializeAsV2(Microsoft.OpenApi.IOpenApiWriter writer) { } public virtual void SerializeAsV3(Microsoft.OpenApi.IOpenApiWriter writer) { } public virtual void SerializeAsV31(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -907,13 +913,13 @@ namespace Microsoft.OpenApi public OpenApiParameter() { } public bool AllowEmptyValue { get; set; } public bool AllowReserved { get; set; } - public System.Collections.Generic.Dictionary? Content { get; set; } + public System.Collections.Generic.IDictionary? Content { get; set; } public bool Deprecated { get; set; } public string? Description { get; set; } public System.Text.Json.Nodes.JsonNode? Example { get; set; } - public System.Collections.Generic.Dictionary? Examples { get; set; } + public System.Collections.Generic.IDictionary? Examples { get; set; } public bool Explode { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public Microsoft.OpenApi.ParameterLocation? In { get; set; } public string? Name { get; set; } public bool Required { get; set; } @@ -929,13 +935,13 @@ namespace Microsoft.OpenApi public OpenApiParameterReference(string referenceId, Microsoft.OpenApi.OpenApiDocument? hostDocument = null, string? externalResource = null) { } public bool AllowEmptyValue { get; } public bool AllowReserved { get; } - public System.Collections.Generic.Dictionary? Content { get; } + public System.Collections.Generic.IDictionary? Content { get; } public bool Deprecated { get; } public string? Description { get; set; } public System.Text.Json.Nodes.JsonNode? Example { get; } - public System.Collections.Generic.Dictionary? Examples { get; } + public System.Collections.Generic.IDictionary? Examples { get; } public bool Explode { get; } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public Microsoft.OpenApi.ParameterLocation? In { get; } public string? Name { get; } public bool Required { get; } @@ -955,10 +961,10 @@ namespace Microsoft.OpenApi { public OpenApiPathItem() { } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public System.Collections.Generic.Dictionary? Operations { get; set; } - public System.Collections.Generic.List? Parameters { get; set; } - public System.Collections.Generic.List? Servers { get; set; } + public System.Collections.Generic.IList? Parameters { get; set; } + public System.Collections.Generic.IList? Servers { get; set; } public string? Summary { get; set; } public void AddOperation(System.Net.Http.HttpMethod operationType, Microsoft.OpenApi.OpenApiOperation operation) { } public Microsoft.OpenApi.IOpenApiPathItem CreateShallowCopy() { } @@ -970,10 +976,10 @@ namespace Microsoft.OpenApi { public OpenApiPathItemReference(string referenceId, Microsoft.OpenApi.OpenApiDocument? hostDocument = null, string? externalResource = null) { } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public System.Collections.Generic.Dictionary? Operations { get; } - public System.Collections.Generic.List? Parameters { get; } - public System.Collections.Generic.List? Servers { get; } + public System.Collections.Generic.IList? Parameters { get; } + public System.Collections.Generic.IList? Servers { get; } public string? Summary { get; set; } public override Microsoft.OpenApi.IOpenApiPathItem CopyReferenceAsTargetElementWithOverrides(Microsoft.OpenApi.IOpenApiPathItem source) { } public Microsoft.OpenApi.IOpenApiPathItem CreateShallowCopy() { } @@ -1030,9 +1036,9 @@ namespace Microsoft.OpenApi public class OpenApiRequestBody : Microsoft.OpenApi.IOpenApiDescribedElement, Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiExtensible, Microsoft.OpenApi.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.IOpenApiReferenceable, Microsoft.OpenApi.IOpenApiRequestBody, Microsoft.OpenApi.IOpenApiSerializable, Microsoft.OpenApi.IShallowCopyable { public OpenApiRequestBody() { } - public System.Collections.Generic.Dictionary? Content { get; set; } + public System.Collections.Generic.IDictionary? Content { get; set; } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public bool Required { get; set; } public Microsoft.OpenApi.IOpenApiParameter ConvertToBodyParameter(Microsoft.OpenApi.IOpenApiWriter writer) { } public System.Collections.Generic.IEnumerable ConvertToFormDataParameters(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -1044,9 +1050,9 @@ namespace Microsoft.OpenApi public class OpenApiRequestBodyReference : Microsoft.OpenApi.BaseOpenApiReferenceHolder, Microsoft.OpenApi.IOpenApiDescribedElement, Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.IOpenApiReferenceable, Microsoft.OpenApi.IOpenApiRequestBody, Microsoft.OpenApi.IOpenApiSerializable, Microsoft.OpenApi.IShallowCopyable { public OpenApiRequestBodyReference(string referenceId, Microsoft.OpenApi.OpenApiDocument? hostDocument = null, string? externalResource = null) { } - public System.Collections.Generic.Dictionary? Content { get; } + public System.Collections.Generic.IDictionary? Content { get; } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public bool Required { get; } public Microsoft.OpenApi.IOpenApiParameter? ConvertToBodyParameter(Microsoft.OpenApi.IOpenApiWriter writer) { } public System.Collections.Generic.IEnumerable? ConvertToFormDataParameters(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -1057,11 +1063,11 @@ namespace Microsoft.OpenApi public class OpenApiResponse : Microsoft.OpenApi.IOpenApiDescribedElement, Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiExtensible, Microsoft.OpenApi.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.IOpenApiReferenceable, Microsoft.OpenApi.IOpenApiResponse, Microsoft.OpenApi.IOpenApiSerializable, Microsoft.OpenApi.IShallowCopyable { public OpenApiResponse() { } - public System.Collections.Generic.Dictionary? Content { get; set; } + public System.Collections.Generic.IDictionary? Content { get; set; } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } - public System.Collections.Generic.Dictionary? Headers { get; set; } - public System.Collections.Generic.Dictionary? Links { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Headers { get; set; } + public System.Collections.Generic.IDictionary? Links { get; set; } public Microsoft.OpenApi.IOpenApiResponse CreateShallowCopy() { } public virtual void SerializeAsV2(Microsoft.OpenApi.IOpenApiWriter writer) { } public virtual void SerializeAsV3(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -1070,11 +1076,11 @@ namespace Microsoft.OpenApi public class OpenApiResponseReference : Microsoft.OpenApi.BaseOpenApiReferenceHolder, Microsoft.OpenApi.IOpenApiDescribedElement, Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiReadOnlyExtensible, Microsoft.OpenApi.IOpenApiReferenceable, Microsoft.OpenApi.IOpenApiResponse, Microsoft.OpenApi.IOpenApiSerializable, Microsoft.OpenApi.IShallowCopyable { public OpenApiResponseReference(string referenceId, Microsoft.OpenApi.OpenApiDocument? hostDocument = null, string? externalResource = null) { } - public System.Collections.Generic.Dictionary? Content { get; } + public System.Collections.Generic.IDictionary? Content { get; } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; } - public System.Collections.Generic.Dictionary? Headers { get; } - public System.Collections.Generic.Dictionary? Links { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Headers { get; } + public System.Collections.Generic.IDictionary? Links { get; } public override Microsoft.OpenApi.IOpenApiResponse CopyReferenceAsTargetElementWithOverrides(Microsoft.OpenApi.IOpenApiResponse source) { } public Microsoft.OpenApi.IOpenApiResponse CreateShallowCopy() { } } @@ -1104,13 +1110,13 @@ namespace Microsoft.OpenApi public OpenApiSchema() { } public Microsoft.OpenApi.IOpenApiSchema? AdditionalProperties { get; set; } public bool AdditionalPropertiesAllowed { get; set; } - public System.Collections.Generic.List? AllOf { get; set; } - public System.Collections.Generic.List? AnyOf { get; set; } + public System.Collections.Generic.IList? AllOf { get; set; } + public System.Collections.Generic.IList? AnyOf { get; set; } public string? Comment { get; set; } public string? Const { get; set; } public System.Text.Json.Nodes.JsonNode? Default { get; set; } - public System.Collections.Generic.Dictionary? Definitions { get; set; } - public System.Collections.Generic.Dictionary>? DependentRequired { get; set; } + public System.Collections.Generic.IDictionary? Definitions { get; set; } + public System.Collections.Generic.IDictionary>? DependentRequired { get; set; } public bool Deprecated { get; set; } public string? Description { get; set; } public Microsoft.OpenApi.OpenApiDiscriminator? Discriminator { get; set; } @@ -1121,7 +1127,7 @@ namespace Microsoft.OpenApi public System.Collections.Generic.IList? Examples { get; set; } public string? ExclusiveMaximum { get; set; } public string? ExclusiveMinimum { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public Microsoft.OpenApi.OpenApiExternalDocs? ExternalDocs { get; set; } public string? Format { get; set; } public string? Id { get; set; } @@ -1137,10 +1143,10 @@ namespace Microsoft.OpenApi public string? Minimum { get; set; } public decimal? MultipleOf { get; set; } public Microsoft.OpenApi.IOpenApiSchema? Not { get; set; } - public System.Collections.Generic.List? OneOf { get; set; } + public System.Collections.Generic.IList? OneOf { get; set; } public string? Pattern { get; set; } - public System.Collections.Generic.Dictionary? PatternProperties { get; set; } - public System.Collections.Generic.Dictionary? Properties { get; set; } + public System.Collections.Generic.IDictionary? PatternProperties { get; set; } + public System.Collections.Generic.IDictionary? Properties { get; set; } public bool ReadOnly { get; set; } public System.Collections.Generic.ISet? Required { get; set; } public System.Uri? Schema { get; set; } @@ -1162,24 +1168,24 @@ namespace Microsoft.OpenApi public OpenApiSchemaReference(string referenceId, Microsoft.OpenApi.OpenApiDocument? hostDocument = null, string? externalResource = null) { } public Microsoft.OpenApi.IOpenApiSchema? AdditionalProperties { get; } public bool AdditionalPropertiesAllowed { get; } - public System.Collections.Generic.List? AllOf { get; } - public System.Collections.Generic.List? AnyOf { get; } + public System.Collections.Generic.IList? AllOf { get; } + public System.Collections.Generic.IList? AnyOf { get; } public string? Comment { get; } public string? Const { get; } public System.Text.Json.Nodes.JsonNode? Default { get; } - public System.Collections.Generic.Dictionary? Definitions { get; } - public System.Collections.Generic.Dictionary>? DependentRequired { get; } + public System.Collections.Generic.IDictionary? Definitions { get; } + public System.Collections.Generic.IDictionary>? DependentRequired { get; } public bool Deprecated { get; } public string? Description { get; set; } public Microsoft.OpenApi.OpenApiDiscriminator? Discriminator { get; } public string? DynamicAnchor { get; } public string? DynamicRef { get; } - public System.Collections.Generic.List? Enum { get; } + public System.Collections.Generic.IList? Enum { get; } public System.Text.Json.Nodes.JsonNode? Example { get; } - public System.Collections.Generic.List? Examples { get; } + public System.Collections.Generic.IList? Examples { get; } public string? ExclusiveMaximum { get; } public string? ExclusiveMinimum { get; } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public Microsoft.OpenApi.OpenApiExternalDocs? ExternalDocs { get; } public string? Format { get; } public string? Id { get; } @@ -1194,19 +1200,19 @@ namespace Microsoft.OpenApi public string? Minimum { get; } public decimal? MultipleOf { get; } public Microsoft.OpenApi.IOpenApiSchema? Not { get; } - public System.Collections.Generic.List? OneOf { get; } + public System.Collections.Generic.IList? OneOf { get; } public string? Pattern { get; } - public System.Collections.Generic.Dictionary? PatternProperties { get; } - public System.Collections.Generic.Dictionary? Properties { get; } + public System.Collections.Generic.IDictionary? PatternProperties { get; } + public System.Collections.Generic.IDictionary? Properties { get; } public bool ReadOnly { get; } - public System.Collections.Generic.HashSet? Required { get; } + public System.Collections.Generic.ISet? Required { get; } public System.Uri? Schema { get; } public string? Title { get; } public Microsoft.OpenApi.JsonSchemaType? Type { get; } public bool UnevaluatedProperties { get; } public bool? UniqueItems { get; } - public System.Collections.Generic.Dictionary? UnrecognizedKeywords { get; } - public System.Collections.Generic.Dictionary? Vocabulary { get; } + public System.Collections.Generic.IDictionary? UnrecognizedKeywords { get; } + public System.Collections.Generic.IDictionary? Vocabulary { get; } public bool WriteOnly { get; } public Microsoft.OpenApi.OpenApiXml? Xml { get; } public override Microsoft.OpenApi.IOpenApiSchema CopyReferenceAsTargetElementWithOverrides(Microsoft.OpenApi.IOpenApiSchema source) { } @@ -1219,7 +1225,7 @@ namespace Microsoft.OpenApi public static class OpenApiSchemaRules { public static Microsoft.OpenApi.ValidationRule ValidateSchemaDiscriminator { get; } - public static bool TraverseSchemaElements(string discriminatorName, System.Collections.Generic.List? childSchema) { } + public static bool TraverseSchemaElements(string discriminatorName, System.Collections.Generic.IList? childSchema) { } public static bool ValidateChildSchemaAgainstDiscriminator(Microsoft.OpenApi.IOpenApiSchema schema, string? discriminatorName) { } } public class OpenApiSecurityRequirement : System.Collections.Generic.Dictionary>, Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiSerializable @@ -1234,7 +1240,7 @@ namespace Microsoft.OpenApi public OpenApiSecurityScheme() { } public string? BearerFormat { get; set; } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public Microsoft.OpenApi.OpenApiOAuthFlows? Flows { get; set; } public Microsoft.OpenApi.ParameterLocation? In { get; set; } public string? Name { get; set; } @@ -1251,7 +1257,7 @@ namespace Microsoft.OpenApi public OpenApiSecuritySchemeReference(string referenceId, Microsoft.OpenApi.OpenApiDocument? hostDocument = null, string? externalResource = null) { } public string? BearerFormat { get; } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public Microsoft.OpenApi.OpenApiOAuthFlows? Flows { get; } public Microsoft.OpenApi.ParameterLocation? In { get; } public string? Name { get; } @@ -1285,9 +1291,9 @@ namespace Microsoft.OpenApi public OpenApiServer() { } public OpenApiServer(Microsoft.OpenApi.OpenApiServer server) { } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public string? Url { get; set; } - public System.Collections.Generic.Dictionary? Variables { get; set; } + public System.Collections.Generic.IDictionary? Variables { get; set; } public virtual void SerializeAsV2(Microsoft.OpenApi.IOpenApiWriter writer) { } public virtual void SerializeAsV3(Microsoft.OpenApi.IOpenApiWriter writer) { } public virtual void SerializeAsV31(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -1308,7 +1314,7 @@ namespace Microsoft.OpenApi public string? Default { get; set; } public string? Description { get; set; } public System.Collections.Generic.List? Enum { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public void SerializeAsV2(Microsoft.OpenApi.IOpenApiWriter writer) { } public void SerializeAsV3(Microsoft.OpenApi.IOpenApiWriter writer) { } public void SerializeAsV31(Microsoft.OpenApi.IOpenApiWriter writer) { } @@ -1323,7 +1329,7 @@ namespace Microsoft.OpenApi { public OpenApiTag() { } public string? Description { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public Microsoft.OpenApi.OpenApiExternalDocs? ExternalDocs { get; set; } public string? Name { get; set; } public Microsoft.OpenApi.IOpenApiTag CreateShallowCopy() { } @@ -1335,7 +1341,7 @@ namespace Microsoft.OpenApi { public OpenApiTagReference(string referenceId, Microsoft.OpenApi.OpenApiDocument? hostDocument = null, string? externalResource = null) { } public string? Description { get; } - public System.Collections.Generic.Dictionary? Extensions { get; } + public System.Collections.Generic.IDictionary? Extensions { get; } public Microsoft.OpenApi.OpenApiExternalDocs? ExternalDocs { get; } public string? Name { get; } public override Microsoft.OpenApi.IOpenApiTag? Target { get; } @@ -1366,11 +1372,11 @@ namespace Microsoft.OpenApi public class OpenApiUrlTreeNode { public static readonly System.Collections.Generic.IReadOnlyDictionary MermaidNodeStyles; - public System.Collections.Generic.Dictionary> AdditionalData { get; set; } - public System.Collections.Generic.Dictionary Children { get; } + public System.Collections.Generic.IDictionary> AdditionalData { get; set; } + public System.Collections.Generic.IDictionary Children { get; } public bool IsParameter { get; } public string Path { get; set; } - public System.Collections.Generic.Dictionary PathItems { get; } + public System.Collections.Generic.IDictionary PathItems { get; } public string Segment { get; } public void AddAdditionalData(System.Collections.Generic.Dictionary> additionalData) { } public void Attach(Microsoft.OpenApi.OpenApiDocument doc, string label) { } @@ -1415,14 +1421,14 @@ namespace Microsoft.OpenApi public override void Visit(Microsoft.OpenApi.OpenApiServer server) { } public override void Visit(Microsoft.OpenApi.OpenApiServerVariable serverVariable) { } public override void Visit(Microsoft.OpenApi.OpenApiTag tag) { } - public override void Visit(System.Collections.Generic.Dictionary operations) { } - public override void Visit(System.Collections.Generic.Dictionary callbacks) { } - public override void Visit(System.Collections.Generic.Dictionary examples) { } - public override void Visit(System.Collections.Generic.Dictionary headers) { } - public override void Visit(System.Collections.Generic.Dictionary links) { } - public override void Visit(System.Collections.Generic.Dictionary encodings) { } - public override void Visit(System.Collections.Generic.Dictionary content) { } - public override void Visit(System.Collections.Generic.Dictionary serverVariables) { } + public override void Visit(System.Collections.Generic.IDictionary operations) { } + public override void Visit(System.Collections.Generic.IDictionary callbacks) { } + public override void Visit(System.Collections.Generic.IDictionary examples) { } + public override void Visit(System.Collections.Generic.IDictionary headers) { } + public override void Visit(System.Collections.Generic.IDictionary links) { } + public override void Visit(System.Collections.Generic.IDictionary encodings) { } + public override void Visit(System.Collections.Generic.IDictionary content) { } + public override void Visit(System.Collections.Generic.IDictionary serverVariables) { } public override void Visit(System.Collections.Generic.List example) { } } public class OpenApiValidatorError : Microsoft.OpenApi.OpenApiError @@ -1472,21 +1478,21 @@ namespace Microsoft.OpenApi public virtual void Visit(Microsoft.OpenApi.OpenApiServerVariable serverVariable) { } public virtual void Visit(Microsoft.OpenApi.OpenApiTag tag) { } public virtual void Visit(Microsoft.OpenApi.OpenApiTagReference tag) { } - public virtual void Visit(System.Collections.Generic.Dictionary operations) { } - public virtual void Visit(System.Collections.Generic.Dictionary callbacks) { } - public virtual void Visit(System.Collections.Generic.Dictionary examples) { } - public virtual void Visit(System.Collections.Generic.Dictionary headers) { } - public virtual void Visit(System.Collections.Generic.Dictionary links) { } - public virtual void Visit(System.Collections.Generic.Dictionary webhooks) { } - public virtual void Visit(System.Collections.Generic.Dictionary encodings) { } - public virtual void Visit(System.Collections.Generic.Dictionary content) { } - public virtual void Visit(System.Collections.Generic.Dictionary serverVariables) { } - public virtual void Visit(System.Collections.Generic.HashSet openApiTags) { } - public virtual void Visit(System.Collections.Generic.HashSet openApiTags) { } + public virtual void Visit(System.Collections.Generic.IDictionary operations) { } + public virtual void Visit(System.Collections.Generic.IDictionary callbacks) { } + public virtual void Visit(System.Collections.Generic.IDictionary examples) { } + public virtual void Visit(System.Collections.Generic.IDictionary headers) { } + public virtual void Visit(System.Collections.Generic.IDictionary links) { } + public virtual void Visit(System.Collections.Generic.IDictionary webhooks) { } + public virtual void Visit(System.Collections.Generic.IDictionary encodings) { } + public virtual void Visit(System.Collections.Generic.IDictionary content) { } + public virtual void Visit(System.Collections.Generic.IDictionary serverVariables) { } + public virtual void Visit(System.Collections.Generic.IList parameters) { } + public virtual void Visit(System.Collections.Generic.IList openApiSecurityRequirements) { } + public virtual void Visit(System.Collections.Generic.IList servers) { } + public virtual void Visit(System.Collections.Generic.ISet openApiTags) { } + public virtual void Visit(System.Collections.Generic.ISet openApiTags) { } public virtual void Visit(System.Collections.Generic.List example) { } - public virtual void Visit(System.Collections.Generic.List parameters) { } - public virtual void Visit(System.Collections.Generic.List openApiSecurityRequirements) { } - public virtual void Visit(System.Collections.Generic.List servers) { } public virtual void Visit(System.Text.Json.Nodes.JsonNode node) { } } public class OpenApiWalker @@ -1511,7 +1517,7 @@ namespace Microsoft.OpenApi public static class OpenApiWriterAnyExtensions { public static void WriteAny(this Microsoft.OpenApi.IOpenApiWriter writer, System.Text.Json.Nodes.JsonNode? node) { } - public static void WriteExtensions(this Microsoft.OpenApi.IOpenApiWriter writer, System.Collections.Generic.Dictionary? extensions, Microsoft.OpenApi.OpenApiSpecVersion specVersion) { } + public static void WriteExtensions(this Microsoft.OpenApi.IOpenApiWriter writer, System.Collections.Generic.IDictionary? extensions, Microsoft.OpenApi.OpenApiSpecVersion specVersion) { } } public abstract class OpenApiWriterBase : Microsoft.OpenApi.IOpenApiWriter { @@ -1564,13 +1570,13 @@ namespace Microsoft.OpenApi { public static void WriteOptionalCollection(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.IEnumerable? elements, System.Action action) { } public static void WriteOptionalCollection(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.IEnumerable? elements, System.Action action) { } - public static void WriteOptionalMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.Dictionary>? elements, System.Action> action) { } - public static void WriteOptionalMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.Dictionary? elements, System.Action action) { } - public static void WriteOptionalMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.Dictionary? elements, System.Action action) { } - public static void WriteOptionalMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.Dictionary? elements, System.Action action) { } - public static void WriteOptionalMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.Dictionary? elements, System.Action action) + public static void WriteOptionalMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.IDictionary>? elements, System.Action> action) { } + public static void WriteOptionalMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.IDictionary? elements, System.Action action) { } + public static void WriteOptionalMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.IDictionary? elements, System.Action action) { } + public static void WriteOptionalMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.IDictionary? elements, System.Action action) { } + public static void WriteOptionalMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.IDictionary? elements, System.Action action) where T : Microsoft.OpenApi.IOpenApiElement { } - public static void WriteOptionalMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.Dictionary? elements, System.Action action) + public static void WriteOptionalMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.IDictionary? elements, System.Action action) where T : Microsoft.OpenApi.IOpenApiElement { } public static void WriteOptionalObject(this Microsoft.OpenApi.IOpenApiWriter writer, string name, T? value, System.Action action) { } public static void WriteOptionalOrEmptyCollection(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.IEnumerable? elements, System.Action action) { } @@ -1583,8 +1589,8 @@ namespace Microsoft.OpenApi where T : struct { } public static void WriteRequiredCollection(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.IEnumerable elements, System.Action action) where T : Microsoft.OpenApi.IOpenApiElement { } - public static void WriteRequiredMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.Dictionary? elements, System.Action action) { } - public static void WriteRequiredMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.Dictionary? elements, System.Action action) + public static void WriteRequiredMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.IDictionary? elements, System.Action action) { } + public static void WriteRequiredMap(this Microsoft.OpenApi.IOpenApiWriter writer, string name, System.Collections.Generic.IDictionary? elements, System.Action action) where T : Microsoft.OpenApi.IOpenApiElement { } public static void WriteRequiredObject(this Microsoft.OpenApi.IOpenApiWriter writer, string name, T? value, System.Action action) { } public static void WriteRequiredProperty(this Microsoft.OpenApi.IOpenApiWriter writer, string name, string? value) { } @@ -1592,6 +1598,7 @@ namespace Microsoft.OpenApi public class OpenApiWriterSettings { public OpenApiWriterSettings() { } + public System.Collections.Generic.IComparer? Comparer { get; set; } public bool InlineExternalReferences { get; set; } public bool InlineLocalReferences { get; set; } } @@ -1600,7 +1607,7 @@ namespace Microsoft.OpenApi public OpenApiXml() { } public OpenApiXml(Microsoft.OpenApi.OpenApiXml xml) { } public bool Attribute { get; set; } - public System.Collections.Generic.Dictionary? Extensions { get; set; } + public System.Collections.Generic.IDictionary? Extensions { get; set; } public string? Name { get; set; } public System.Uri? Namespace { get; set; } public string? Prefix { get; set; } @@ -1628,9 +1635,9 @@ namespace Microsoft.OpenApi public class OperationSearch : Microsoft.OpenApi.OpenApiVisitorBase { public OperationSearch(System.Func predicate) { } - public System.Collections.Generic.List SearchResults { get; } + public System.Collections.Generic.IList SearchResults { get; } public override void Visit(Microsoft.OpenApi.IOpenApiPathItem pathItem) { } - public override void Visit(System.Collections.Generic.List parameters) { } + public override void Visit(System.Collections.Generic.IList parameters) { } } public enum ParameterLocation { @@ -1749,7 +1756,7 @@ namespace Microsoft.OpenApi public SearchResult() { } public Microsoft.OpenApi.CurrentKeys? CurrentKeys { get; set; } public Microsoft.OpenApi.OpenApiOperation? Operation { get; set; } - public System.Collections.Generic.List? Parameters { get; set; } + public System.Collections.Generic.IList? Parameters { get; set; } } public enum SecuritySchemeType { @@ -1796,13 +1803,13 @@ namespace Microsoft.OpenApi public ValidationRuleSet(Microsoft.OpenApi.ValidationRuleSet ruleSet) { } public ValidationRuleSet(System.Collections.Generic.Dictionary> rules) { } public int Count { get; } - public System.Collections.Generic.List Rules { get; } + public System.Collections.Generic.IList Rules { get; } public void Add(System.Type key, Microsoft.OpenApi.ValidationRule rule) { } public void Add(System.Type key, System.Collections.Generic.List rules) { } public void Clear() { } public bool Contains(System.Type key, Microsoft.OpenApi.ValidationRule rule) { } public bool ContainsKey(System.Type key) { } - public System.Collections.Generic.List FindRules(System.Type type) { } + public System.Collections.Generic.IList FindRules(System.Type type) { } public System.Collections.Generic.IEnumerator GetEnumerator() { } public bool Remove(Microsoft.OpenApi.ValidationRule rule) { } public bool Remove(System.Type key) { } @@ -1898,9 +1905,9 @@ namespace Microsoft.OpenApi.Reader public class OpenApiDiagnostic : Microsoft.OpenApi.IDiagnostic { public OpenApiDiagnostic() { } - public System.Collections.Generic.List Errors { get; set; } + public System.Collections.Generic.IList Errors { get; set; } public Microsoft.OpenApi.OpenApiSpecVersion SpecificationVersion { get; set; } - public System.Collections.Generic.List Warnings { get; set; } + public System.Collections.Generic.IList Warnings { get; set; } public void AppendDiagnostic(Microsoft.OpenApi.Reader.OpenApiDiagnostic diagnosticToAdd, string? fileNameToAdd = null) { } } public class OpenApiJsonReader : Microsoft.OpenApi.IOpenApiReader From 25d45ed06009063f6d5a0c46367b63c2279c0f4c Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Mon, 2 Jun 2025 19:50:17 +0300 Subject: [PATCH 12/12] chore: rename setting; make extension class/methods internal --- src/Microsoft.OpenApi/Extensions/CollectionExtensions.cs | 6 +++--- src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs | 6 +++--- src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs | 4 ++-- .../Extensions/CollectionExtensionsTests.cs | 4 ++-- .../PublicApi/PublicApi.approved.txt | 8 +------- 5 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/Microsoft.OpenApi/Extensions/CollectionExtensions.cs b/src/Microsoft.OpenApi/Extensions/CollectionExtensions.cs index 60c6f4f95..303c8ffed 100644 --- a/src/Microsoft.OpenApi/Extensions/CollectionExtensions.cs +++ b/src/Microsoft.OpenApi/Extensions/CollectionExtensions.cs @@ -7,12 +7,12 @@ namespace Microsoft.OpenApi /// /// Dictionary extension methods /// - public static class CollectionExtensions + internal static class CollectionExtensions { /// /// Returns a new dictionary with entries sorted by key using a custom comparer. /// - public static IDictionary Sort( + internal static IDictionary Sort( this IDictionary source, IComparer comparer) where TKey : notnull @@ -33,7 +33,7 @@ public static IDictionary Sort( /// /// Sorts any IEnumerable using the specified comparer and returns a List. /// - public static List Sort(this IEnumerable source, IComparer comparer) + internal static List Sort(this IEnumerable source, IComparer comparer) { #if NET7_0_OR_GREATER ArgumentNullException.ThrowIfNull(source); diff --git a/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs b/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs index bbb034ac5..5974924c0 100644 --- a/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs +++ b/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs @@ -421,7 +421,7 @@ private static void WriteCollectionInternal( { var settings = writer.GetSettings(); - if (settings?.Comparer is IComparer typedComparer) + if (settings?.KeyComparer is IComparer typedComparer) { elements = elements.Sort(typedComparer); } @@ -465,9 +465,9 @@ private static void WriteMapInternal( if (elements != null) { var settings = writer.GetSettings(); - if (settings?.Comparer != null) + if (settings?.KeyComparer != null) { - elements = elements.Sort(settings.Comparer); // sort using custom comparer + elements = elements.Sort(settings.KeyComparer); // sort using custom comparer } foreach (var item in elements) diff --git a/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs b/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs index bcaef6e1d..cbd3344b2 100644 --- a/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs +++ b/src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs @@ -25,8 +25,8 @@ internal bool ShouldInlineReference(OpenApiReference reference) } /// - /// Custom comparer for sorting collections. + /// Specifies a comparer used to sort string-based collection keys, such as components or tags. /// - public IComparer? Comparer { get; set; } + public IComparer? KeyComparer { get; set; } } } diff --git a/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.cs b/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.cs index 7c5f49f1e..49d8e325a 100644 --- a/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.cs +++ b/test/Microsoft.OpenApi.Tests/Extensions/CollectionExtensionsTests.cs @@ -140,7 +140,7 @@ public async Task SortOpenApiDocumentUsingCustomComparerSucceeds(OpenApiSpecVers var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); var settings = new OpenApiWriterSettings { - Comparer = StringComparer.OrdinalIgnoreCase + KeyComparer = StringComparer.OrdinalIgnoreCase }; var writer = new OpenApiYamlWriter(outputStringWriter, settings); @@ -168,7 +168,7 @@ public async Task SortHashSetsWorks() var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); var settings = new OpenApiWriterSettings { - Comparer = StringComparer.OrdinalIgnoreCase + KeyComparer = StringComparer.OrdinalIgnoreCase }; var writer = new OpenApiYamlWriter(outputStringWriter, settings); diff --git a/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt b/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt index be3ae75cf..19248ec7b 100644 --- a/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt +++ b/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt @@ -29,12 +29,6 @@ namespace Microsoft.OpenApi public override string Expression { get; } public string? Fragment { get; } } - public static class CollectionExtensions - { - public static System.Collections.Generic.List Sort(this System.Collections.Generic.IEnumerable source, System.Collections.Generic.IComparer comparer) { } - public static System.Collections.Generic.IDictionary Sort(this System.Collections.Generic.IDictionary source, System.Collections.Generic.IComparer comparer) - where TKey : notnull { } - } public class CompositeExpression : Microsoft.OpenApi.RuntimeExpression { public System.Collections.Generic.List ContainedExpressions; @@ -1598,9 +1592,9 @@ namespace Microsoft.OpenApi public class OpenApiWriterSettings { public OpenApiWriterSettings() { } - public System.Collections.Generic.IComparer? Comparer { get; set; } public bool InlineExternalReferences { get; set; } public bool InlineLocalReferences { get; set; } + public System.Collections.Generic.IComparer? KeyComparer { get; set; } } public class OpenApiXml : Microsoft.OpenApi.IOpenApiElement, Microsoft.OpenApi.IOpenApiExtensible, Microsoft.OpenApi.IOpenApiSerializable {