Skip to content

Commit 1b4ad07

Browse files
committed
fix: revert to using IDictionary for collections
1 parent 6c82aa6 commit 1b4ad07

File tree

96 files changed

+599
-580
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+599
-580
lines changed

src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ internal static class OpenApiExtensibleExtensions
1313
/// <param name="extensions">A dictionary of <see cref="IOpenApiExtension"/>.</param>
1414
/// <param name="extensionKey">The key corresponding to the <see cref="IOpenApiExtension"/>.</param>
1515
/// <returns>A <see cref="string"/> value matching the provided extensionKey. Return null when extensionKey is not found. </returns>
16-
internal static string GetExtension(this Dictionary<string, IOpenApiExtension> extensions, string extensionKey)
16+
internal static string GetExtension(this IDictionary<string, IOpenApiExtension> extensions, string extensionKey)
1717
{
1818
if (extensions.TryGetValue(extensionKey, out var value) && value is JsonNodeExtension { Node: JsonValue castValue } && castValue.TryGetValue<string>(out var stringValue))
1919
{

src/Microsoft.OpenApi.Hidi/StatsVisitor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public override void Visit(IOpenApiSchema schema)
2727

2828
public int HeaderCount { get; set; }
2929

30-
public override void Visit(Dictionary<string, IOpenApiHeader> headers)
30+
public override void Visit(IDictionary<string, IOpenApiHeader> headers)
3131
{
3232
HeaderCount++;
3333
}

src/Microsoft.OpenApi.Workbench/StatsVisitor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public override void Visit(IOpenApiSchema schema)
2727

2828
public int HeaderCount { get; set; }
2929

30-
public override void Visit(Dictionary<string, IOpenApiHeader> headers)
30+
public override void Visit(IDictionary<string, IOpenApiHeader> headers)
3131
{
3232
HeaderCount++;
3333
}

src/Microsoft.OpenApi/Extensions/OpenApiExtensibleExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static void AddExtension<T>(this T element, string name, IOpenApiExtensio
3333
throw new OpenApiException(string.Format(SRResource.ExtensionFieldNameMustBeginWithXDash, name));
3434
}
3535

36-
element.Extensions ??= [];
36+
element.Extensions ??= new Dictionary<string, IOpenApiExtension>();
3737
element.Extensions[name] = Utils.CheckArgumentNull(any);
3838
}
3939
}

src/Microsoft.OpenApi/Interfaces/IMetadataContainer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ public interface IMetadataContainer
1414
/// A collection of properties associated with the current OpenAPI element to be used by the application.
1515
/// Metadata are NOT (de)serialized with the schema and can be used for custom properties.
1616
/// </summary>
17-
Dictionary<string, object>? Metadata { get; set; }
17+
IDictionary<string, object>? Metadata { get; set; }
1818
}

src/Microsoft.OpenApi/Interfaces/IOpenApiExtensible.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ public interface IOpenApiExtensible : IOpenApiElement
1313
/// <summary>
1414
/// Specification extensions.
1515
/// </summary>
16-
Dictionary<string, IOpenApiExtension>? Extensions { get; set; }
16+
IDictionary<string, IOpenApiExtension>? Extensions { get; set; }
1717
}
1818
}

src/Microsoft.OpenApi/Interfaces/IOpenApiReadOnlyExtensible.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ public interface IOpenApiReadOnlyExtensible
1010
/// <summary>
1111
/// Specification extensions.
1212
/// </summary>
13-
Dictionary<string, IOpenApiExtension>? Extensions { get; }
13+
IDictionary<string, IOpenApiExtension>? Extensions { get; }
1414

1515
}

src/Microsoft.OpenApi/Models/Interfaces/IOpenApiHeader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ public interface IOpenApiHeader : IOpenApiDescribedElement, IOpenApiReadOnlyExte
5555
/// <summary>
5656
/// Examples of the media type.
5757
/// </summary>
58-
public Dictionary<string, IOpenApiExample>? Examples { get; }
58+
public IDictionary<string, IOpenApiExample>? Examples { get; }
5959

6060
/// <summary>
6161
/// A map containing the representations for the header.
6262
/// </summary>
63-
public Dictionary<string, OpenApiMediaType>? Content { get; }
63+
public IDictionary<string, OpenApiMediaType>? Content { get; }
6464

6565
}

src/Microsoft.OpenApi/Models/Interfaces/IOpenApiLink.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public interface IOpenApiLink : IOpenApiDescribedElement, IOpenApiReadOnlyExtens
2424
/// <summary>
2525
/// A map representing parameters to pass to an operation as specified with operationId or identified via operationRef.
2626
/// </summary>
27-
public Dictionary<string, RuntimeExpressionAnyWrapper>? Parameters { get; }
27+
public IDictionary<string, RuntimeExpressionAnyWrapper>? Parameters { get; }
2828

2929
/// <summary>
3030
/// A literal value or {expression} to use as a request body when calling the target operation.

src/Microsoft.OpenApi/Models/Interfaces/IOpenApiParameter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public interface IOpenApiParameter : IOpenApiDescribedElement, IOpenApiReadOnlyE
8181
/// Furthermore, if referencing a schema which contains an example,
8282
/// the examples value SHALL override the example provided by the schema.
8383
/// </summary>
84-
public Dictionary<string, IOpenApiExample>? Examples { get; }
84+
public IDictionary<string, IOpenApiExample>? Examples { get; }
8585

8686
/// <summary>
8787
/// Example of the media type. The example SHOULD match the specified schema and encoding properties
@@ -102,5 +102,5 @@ public interface IOpenApiParameter : IOpenApiDescribedElement, IOpenApiReadOnlyE
102102
/// When example or examples are provided in conjunction with the schema object,
103103
/// the example MUST follow the prescribed serialization strategy for the parameter.
104104
/// </summary>
105-
public Dictionary<string, OpenApiMediaType>? Content { get; }
105+
public IDictionary<string, OpenApiMediaType>? Content { get; }
106106
}

0 commit comments

Comments
 (0)