Correct version specification in Swagger spec [APIDeploy]

This commit is contained in:
Jordan Brown
2020-04-17 16:33:43 -04:00
parent 8c7e16dc28
commit 8bacd2de37
3 changed files with 26 additions and 2 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
<!-- This is the authorative version list -->
<!-- Integration tests will ensure they match across the board -->
<TgsCoreVersion>4.1.0</TgsCoreVersion>
<TgsApiVersion>5.0.0</TgsApiVersion>
<TgsApiVersion>5.0.1</TgsApiVersion>
<TgsClientVersion>5.0.0</TgsClientVersion>
<TgsDmapiVersion>5.0.0</TgsDmapiVersion>
<TgsControlPanelVersion>0.1.6</TgsControlPanelVersion>
@@ -11,6 +11,7 @@ using Tgstation.Server.Api;
using Tgstation.Server.Api.Models;
using Tgstation.Server.Api.Rights;
using Tgstation.Server.Host.Controllers;
using Tgstation.Server.Host.Extensions;
namespace Tgstation.Server.Host.Core
{
@@ -121,7 +122,7 @@ namespace Tgstation.Server.Host.Core
new OpenApiInfo
{
Title = "TGS API",
Version = "v4"
Version = ApiHeaders.Version.Semver()
});
// Important to do this before applying our own filters
@@ -0,0 +1,23 @@
using System;
namespace Tgstation.Server.Host.Extensions
{
/// <summary>
/// Extensions for the <see cref="Version"/> <see langword="class"/>.
/// </summary>
static class VersionExtensions
{
/// <summary>
/// Converts a given <paramref name="version"/> into a semver <see cref="string"/>.
/// </summary>
/// <param name="version">The <see cref="Version"/> to convert.</param>
/// <returns>A semver <see cref="string"/> base on <paramref name="version"/>.</returns>
public static string Semver(this Version version)
{
if (version == null)
throw new ArgumentNullException(nameof(version));
return $"{version.Major}.{version.Minor}.{version.Build}";
}
}
}