Skip to content

Commit

Permalink
Adds OpenApiDocGeneratorPlugin. Closes microsoft#425 (microsoft#428)
Browse files Browse the repository at this point in the history
  • Loading branch information
waldekmastykarz authored Dec 18, 2023
1 parent a1785c9 commit f2b6915
Show file tree
Hide file tree
Showing 7 changed files with 917 additions and 26 deletions.
24 changes: 24 additions & 0 deletions dev-proxy-abstractions/ProxyUtils.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System.Reflection;
using System.Text.RegularExpressions;
using Microsoft.Data.Sqlite;
using Titanium.Web.Proxy.Http;
Expand Down Expand Up @@ -253,4 +254,27 @@ string search
var origin = uri.GetLeftPart(UriPartial.Authority);
return RemoveExtraSlashesFromUrl($"{origin}/{queryVersion}/{requestUrl + search}");
}

private static Assembly? _assembly;
internal static Assembly GetAssembly()
=> _assembly ??= (Assembly.GetEntryAssembly() ?? Assembly.GetExecutingAssembly());

private static string _productVersion = string.Empty;
public static string ProductVersion {
get {
if (_productVersion == string.Empty) {
var assembly = GetAssembly();
var assemblyVersionAttribute = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>();

if (assemblyVersionAttribute is null) {
_productVersion = assembly.GetName().Version?.ToString() ?? "";
}
else {
_productVersion = assemblyVersionAttribute.InformationalVersion;
}
}

return _productVersion;
}
}
}
Loading

0 comments on commit f2b6915

Please sign in to comment.