aboutsummaryrefslogtreecommitdiffstats
path: root/code/api/src/Utilities
diff options
context:
space:
mode:
authorivarlovlie <git@ivarlovlie.no>2022-10-25 11:51:37 +0200
committerivarlovlie <git@ivarlovlie.no>2022-10-25 11:51:37 +0200
commit0005595703b2f3f7083ce4ba19bf5770057c75bd (patch)
tree193a897f61a9a5e566961601de4cf42ae85984a0 /code/api/src/Utilities
parent585c5c8537eb21dfc9f16108548e63d9ced3d971 (diff)
downloadgreatoffice-0005595703b2f3f7083ce4ba19bf5770057c75bd.tar.xz
greatoffice-0005595703b2f3f7083ce4ba19bf5770057c75bd.zip
.
Diffstat (limited to 'code/api/src/Utilities')
-rw-r--r--code/api/src/Utilities/SwaggerDefaultValues.cs2
-rw-r--r--code/api/src/Utilities/SwaggerGenOptionsExtensions.cs8
2 files changed, 5 insertions, 5 deletions
diff --git a/code/api/src/Utilities/SwaggerDefaultValues.cs b/code/api/src/Utilities/SwaggerDefaultValues.cs
index 4b5c764..5e73fa8 100644
--- a/code/api/src/Utilities/SwaggerDefaultValues.cs
+++ b/code/api/src/Utilities/SwaggerDefaultValues.cs
@@ -27,7 +27,7 @@ public class SwaggerDefaultValues : IOperationFilter
var response = operation.Responses[responseKey];
foreach (var contentType in response.Content.Keys) {
- if (!responseType.ApiResponseFormats.Any(x => x.MediaType == contentType)) {
+ if (responseType.ApiResponseFormats.All(x => x.MediaType != contentType)) {
response.Content.Remove(contentType);
}
}
diff --git a/code/api/src/Utilities/SwaggerGenOptionsExtensions.cs b/code/api/src/Utilities/SwaggerGenOptionsExtensions.cs
index 0a7e07f..9b70194 100644
--- a/code/api/src/Utilities/SwaggerGenOptionsExtensions.cs
+++ b/code/api/src/Utilities/SwaggerGenOptionsExtensions.cs
@@ -1,5 +1,5 @@
#nullable enable
-using IOL.GreatOffice.Api.Endpoints.V1;
+using IOL.GreatOffice.Api.Endpoints;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.AspNetCore.Mvc.Controllers;
using Swashbuckle.AspNetCore.SwaggerGen;
@@ -10,7 +10,7 @@ public static class SwaggerGenOptionsExtensions
{
/// <summary>
/// Updates Swagger document to support ApiEndpoints.<br/><br/>
- /// For controllers inherited from <see cref="V1_EndpointBase"/>:<br/>
+ /// For controllers inherited from <see cref="EndpointBase"/>:<br/>
/// - Replaces action Tag with <c>[namespace]</c><br/>
/// </summary>
public static void UseApiEndpoints(this SwaggerGenOptions options) {
@@ -22,7 +22,7 @@ public static class SwaggerGenOptionsExtensions
throw new InvalidOperationException($"Unable to determine tag for endpoint: {api.ActionDescriptor.DisplayName}");
}
- if (actionDescriptor.ControllerTypeInfo.GetBaseTypesAndThis().Any(t => t == typeof(V1_EndpointBase))) {
+ if (actionDescriptor.ControllerTypeInfo.GetBaseTypesAndThis().Any(t => t == typeof(EndpointBase))) {
return new[] {
actionDescriptor.ControllerTypeInfo.Namespace?.Split('.').Last()
};
@@ -34,7 +34,7 @@ public static class SwaggerGenOptionsExtensions
}
public static IEnumerable<Type> GetBaseTypesAndThis(this Type type) {
- Type? current = type;
+ var current = type;
while (current != null) {
yield return current;
current = current.BaseType;