Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
83c9278
Use ConcurrentDictionary For Improving GetEnumFromDisplayName
Aug 31, 2024
819b468
Bump docker/build-push-action from 6.7.0 to 6.9.0
dependabot[bot] Sep 30, 2024
e03f1d2
Bump Microsoft.OData.Edm from 8.0.1 to 8.0.2
dependabot[bot] Sep 30, 2024
9c77314
Merge pull request #1848 from microsoft/dependabot/nuget/Microsoft.OD…
baywet Oct 1, 2024
bd82cc2
Merge pull request #1847 from microsoft/dependabot/github_actions/doc…
andrueastman Oct 1, 2024
36fac8f
Bump Microsoft.OpenApi.OData from 2.0.0-preview.2 to 2.0.0-preview.3
dependabot[bot] Oct 3, 2024
bc1f6a0
Merge pull request #1858 from microsoft/dependabot/nuget/Microsoft.Op…
baywet Oct 4, 2024
eb3a991
Bump up Hidi version
irvinesunday Oct 4, 2024
6123803
Merge pull request #1859 from microsoft/is/bump-up-hidi
irvinesunday Oct 4, 2024
dfd6aeb
Merge pull request #1809 from Mahdigln/GetEnumFromDisplayName
MaggieKimani1 Oct 8, 2024
34de044
Bump System.Text.Json from 8.0.4 to 8.0.5
dependabot[bot] Oct 8, 2024
41b0f36
Bump Microsoft.Windows.Compatibility from 8.0.8 to 8.0.10
dependabot[bot] Oct 8, 2024
51e2cd1
Merge pull request #1864 from microsoft/dependabot/nuget/Microsoft.Wi…
baywet Oct 8, 2024
5e6e1b3
Merge pull request #1862 from microsoft/dependabot/nuget/System.Text.…
andrueastman Oct 9, 2024
a3b0011
Bump Microsoft.Extensions.Logging and Microsoft.Extensions.Logging.Ab…
dependabot[bot] Oct 9, 2024
ca39123
Merge pull request #1863 from microsoft/dependabot/nuget/multi-852bd6…
andrueastman Oct 9, 2024
21d71e9
Merge remote-tracking branch 'origin/vnext' into mk/sync-dependabot-u…
MaggieKimani1 Oct 9, 2024
a572a5f
Bump up STJ version
MaggieKimani1 Oct 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ jobs:
id: getversion
- name: Push to GitHub Packages - Nightly
if: ${{ github.ref == 'refs/heads/vnext' }}
uses: docker/build-push-action@v6.7.0
uses: docker/build-push-action@v6.9.0
with:
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly
- name: Push to GitHub Packages - Release
if: ${{ github.ref == 'refs/heads/master' }}
uses: docker/build-push-action@v6.7.0
uses: docker/build-push-action@v6.9.0
with:
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.getversion.outputs.version }}
12 changes: 6 additions & 6 deletions src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Nullable>enable</Nullable>
<ToolCommandName>hidi</ToolCommandName>
<PackageOutputPath>./../../artifacts</PackageOutputPath>
<Version>1.4.10</Version>
<Version>1.4.11</Version>
<Description>OpenAPI.NET CLI tool for slicing OpenAPI documents</Description>
<SignAssembly>true</SignAssembly>
<!-- https://github.com/dotnet/sourcelink/blob/main/docs/README.md#embeduntrackedsources -->
Expand All @@ -29,23 +29,23 @@

<ItemGroup>
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.11.20">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageReference Include="Microsoft.OData.Edm" Version="8.0.1" />
<PackageReference Include="Microsoft.OpenApi.OData" Version="2.0.0-preview.2" />
<PackageReference Include="Microsoft.OData.Edm" Version="8.0.2" />
<PackageReference Include="Microsoft.OpenApi.OData" Version="2.0.0-preview.3" />
<PackageReference Include="Microsoft.OpenApi.ApiManifest" Version="0.5.0-preview" />
<PackageReference Include="System.CommandLine.Hosting" Version="0.4.0-alpha.22272.1" />
<!--STJ
required until Microsoft.Extensions.Logging.Console and Microsoft.Extensions.Configuration.Json
update their dependencies -->
<PackageReference Include="System.Text.Json" Version="8.0.4" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</PackageReference>

<PackageReference Include="SharpYaml" Version="2.1.1" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Windows.Compatibility" Version="8.0.8" />
<PackageReference Include="Microsoft.Windows.Compatibility" Version="8.0.10" />
<!-- Microsoft.Windows.Compatibility 8.0.8 depends on 8.0.0 this dependency can be removed once they update theirs -->
<PackageReference Include="System.Formats.Asn1" Version="8.0.1" />
</ItemGroup>
Expand Down
22 changes: 15 additions & 7 deletions src/Microsoft.OpenApi/Extensions/StringExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

using System;
using System.Collections.Concurrent;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using Microsoft.OpenApi.Attributes;
Expand All @@ -13,6 +13,8 @@ namespace Microsoft.OpenApi.Extensions
/// </summary>
public static class StringExtensions
{
private static readonly ConcurrentDictionary<Type, ConcurrentDictionary<string, object>> EnumDisplayCache = new();

/// <summary>
/// Gets the enum value based on the given enum type and display name.
/// </summary>
Expand All @@ -21,22 +23,28 @@ public static class StringExtensions
{
var type = typeof(T);
if (!type.IsEnum)
{
return default;
}

var displayMap = EnumDisplayCache.GetOrAdd(type, _ => new ConcurrentDictionary<string, object>(StringComparer.OrdinalIgnoreCase));

if (displayMap.TryGetValue(displayName, out var cachedValue))
return (T)cachedValue;


foreach (var field in type.GetFields(BindingFlags.Public | BindingFlags.Static))
{
var displayAttribute = (DisplayAttribute)field.GetCustomAttribute(typeof(DisplayAttribute));
if (displayAttribute != null && displayAttribute.Name == displayName)
var displayAttribute = field.GetCustomAttribute<DisplayAttribute>();
if (displayAttribute != null && displayAttribute.Name.Equals(displayName, StringComparison.OrdinalIgnoreCase))
{
return (T)field.GetValue(null);
var enumValue = (T)field.GetValue(null);
displayMap.TryAdd(displayName, enumValue);
return enumValue;
}
}

return default;
}
internal static string ToFirstCharacterLowerCase(this string input)
=> string.IsNullOrEmpty(input) ? string.Empty : char.ToLowerInvariant(input[0]) + input.Substring(1);
=> string.IsNullOrEmpty(input) ? string.Empty : char.ToLowerInvariant(input[0]) + input.Substring(1);
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi/Microsoft.OpenApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Text.Json" Version="8.0.4" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" PrivateAssets="all" />
<!--STJ required until Microsoft.Extensions.Logging.Console and Microsoft.Extensions.Configuration.Json update their dependencies -->
<PackageReference Include="System.Text.Json" Version="8.0.4" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading